Skip to content

Commit

Permalink
Merge pull request #13 from openworm/development
Browse files Browse the repository at this point in the history
Development changes
  • Loading branch information
pgleeson authored Jan 14, 2025
2 parents be9d652 + ce7a8ea commit 605f7d2
Show file tree
Hide file tree
Showing 14 changed files with 1,852 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/non-omv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/omv-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down
15 changes: 12 additions & 3 deletions NeuroML2/GenerateNeuroML.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def generate_nmllite(
sim, net = create_new_model(
reference,
duration,
dt=0.025, # ms
dt=0.005, # ms
temperature=34, # degC
default_region="Worm",
parameters=parameters,
Expand Down Expand Up @@ -1246,9 +1246,18 @@ def create_cells(channels_to_include, duration=700, stim_delay=310, stim_duratio
# For testing, as some channel gates take quite some time to reach steady state, e.g. s on kqt3
additional_transient_phase = 2000

duration = 400 + additional_transient_phase
stim_delay = 310 + additional_transient_phase

import sys

if "-short" in sys.argv:
duration = 70
stim_delay = 10

create_cells(
channels_to_include,
duration=400 + additional_transient_phase,
stim_delay=310 + additional_transient_phase,
duration=duration,
stim_delay=stim_delay,
stim_duration=50,
)
2 changes: 1 addition & 1 deletion NeuroML2/IClamp_RMD.net.nml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<pulseGenerator id="iclamp_0" delay="2310ms" duration="50ms" amplitude="10pA"/>
<network id="IClamp_RMD" type="networkWithTemperature" temperature="34.0degC">
<notes>A network model: IClamp_RMD</notes>
<property tag="recommended_dt_ms" value="0.025"/>
<property tag="recommended_dt_ms" value="0.005"/>
<property tag="recommended_duration_ms" value="2400.0"/>
<population id="pop_RMD" component="RMD" size="1" type="populationList">
<property tag="color" value="0 0.8 0"/>
Expand Down
2 changes: 1 addition & 1 deletion NeuroML2/LEMS_Sim_IClamp_RMD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Include file="IClamp_RMD.net.nml"/>
<Include file="RMD.cell.nml"/>

<Simulation id="Sim_IClamp_RMD" length="2400.0ms" step="0.025ms" target="IClamp_RMD" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
<Simulation id="Sim_IClamp_RMD" length="2400.0ms" step="0.005ms" target="IClamp_RMD" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
<Display id="pop_RMD_0_biophys/membraneProperties/bk2_chans/RMD_bk2/h/q" title="Plots of pop_RMD_0_biophys/membraneProperties/bk2_chans/RMD_bk2/h/q" timeScale="1ms" xmin="-240.0" xmax="2640.0" ymin="-1" ymax="1">
<Line id="pop_RMD_0_RMD_biophys_membraneProperties_bk2_chans_RMD_bk2_h_q" quantity="pop_RMD/0/RMD/biophys/membraneProperties/bk2_chans/RMD_bk2/h/q" scale="1" color="#d54f33" timeScale="1ms"/>
</Display>
Expand Down
2 changes: 1 addition & 1 deletion NeuroML2/Sim_IClamp_AWCon.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "NeuroMLlite v0.6.0",
"network": "IClamp_AWCon.json",
"duration": 2400.0,
"dt": 0.025,
"dt": 0.005,
"seed": 12345,
"record_traces": {
"all": "*"
Expand Down
2 changes: 1 addition & 1 deletion NeuroML2/Sim_IClamp_RMD.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "NeuroMLlite v0.6.0",
"network": "IClamp_RMD.json",
"duration": 2400.0,
"dt": 0.025,
"dt": 0.005,
"seed": 12345,
"record_traces": {
"all": "*"
Expand Down
15 changes: 14 additions & 1 deletion NeuroML2/TestXPP.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
cell = "RMD"

parsed_data = parse_script("../%s.ode" % cell.replace("on", ""))

import sys

short_simulation = "-short" in sys.argv
if short_simulation:
parsed_data = parse_script("../XPP_tests/%s_edited.ode" % cell.replace("on", ""))

pprint(parsed_data)

all_g = [
Expand Down Expand Up @@ -113,9 +120,15 @@

parsed_data["settings"]["total"] = 400 + additional_transient_phase
parsed_data["settings"]["trans"] = 0
parsed_data["settings"]["dt"] = 0.01
parsed_data["settings"]["dt"] = 0.005
parsed_data["parameters"]["ton"] = 310 + additional_transient_phase
parsed_data["parameters"]["toff"] = 360 + additional_transient_phase

if short_simulation:
parsed_data["settings"]["total"] = 70
parsed_data["parameters"]["ton"] = 10
parsed_data["parameters"]["toff"] = 60

new_ode = to_xpp(parsed_data, new_ode_file)

mp_fig = "Membrane potentials"
Expand Down
17 changes: 17 additions & 0 deletions NeuroML2/regenerateAndTestShort.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -ex

# Format the code
black *.py

# This script loads in the XPP using the parser in pyNeuroML, and converts the channels to NeuroML
# It will also run a test simulation of the cells and save the results
# NOTE: make sure to update to a recent version of pyNeuroML!
python GenerateNeuroML.py -jnml -short


# This will load the original XPP using pyNeuroML, run it, save the results and plot them against the
# results generated by the NeuroML in GenerateNeuroML.py
python TestXPP.py -short


Binary file added XPP_tests/.DS_Store
Binary file not shown.
Loading

0 comments on commit 605f7d2

Please sign in to comment.