Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed May 31, 2024
2 parents d992e40 + 42cf61b commit f82f804
Show file tree
Hide file tree
Showing 24 changed files with 484 additions and 104 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/omv-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.8, "3.10" ]
engine: [ jNeuroML_validate ]
python-version: [ "3.8", "3.10"]
engine: [ jNeuroML_validate, jNeuroML_NEURON ]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install OMV
run: |
pip install git+https://github.com/OpenSourceBrain/osb-model-validation
pip install OSBModelValidation
pip install scipy sympy matplotlib cython pandas tables
- name: Run OMV tests on engine ${{ matrix.engine }}
run: |
omv all -V --engine=${{ matrix.engine }}
- name: OMV final version info
run: |
omv list -V # list installed engines
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ __pycache__
*.log
*.dat
x86_64/
channels/*dat
NeuroML2/channels/LEMS*
NeuroML2/channels/*mod
NeuroML2/*mod
NeuroML2/*.hoc
NeuroML2/*.dat
NeuroML2/*_nrn.py
NeuroML2/*.spikes
.mypy_cache/
*.npy
11 changes: 10 additions & 1 deletion NEURON/mb/test_cell/test_kc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
kc = eval(f'h.{cellname}()')
delay = Q_(100, 'ms')
duration=Q_(500.0, 'ms')
postdelay=Q_(100.0, 'ms')
inj_current = Q_(16, 'pA')
clamp = ephys.setup_current_clamp(kc.soma, delay=delay, duration=duration, amplitude=inj_current)

Expand All @@ -43,7 +44,13 @@
tvec = h.Vector()
tvec.record(h._ref_t)

h.tstop = delay.to('ms').m + duration.to('ms').m
# record spikes
apcvec = h.Vector()
apc = h.APCount(0.5)
apc.thresh = -10
apc.record(apcvec)

h.tstop = delay.to('ms').m + duration.to('ms').m + postdelay.to('ms').m
h.v_init = Em.to('mV').m
h.init()
h.run()
Expand All @@ -59,6 +66,8 @@
data_file = 'kc_vm.npy'
np.save(data_file, data)

print(list(apcvec))

print(f'Simulated {cellname} from template file {filename}.')
print(f'Settling time {delay} followed by {inj_current} current injection for {duration}')
print(f'Saved Vm in {data_file}')
Expand Down
16 changes: 16 additions & 0 deletions NEURON/run-test-kc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Copyright 2024 Ankur Sinha
# Author: Ankur Sinha <sanjay DOT ankur AT gmail DOT com>
# File :
#

if [[ -z "${MODEL_DIR}" ]]; then
export MODEL_DIR=$(pwd)
echo "Setting model root directory to $MODEL_DIR"
echo "To use a custom path, set the MODEL_DIR environment variable to the desired path."
fi

export PYTHONPATH="${MODEL_DIR}/mb:${MODEL_DIR}/nrn:${MODEL_DIR}/morphutils:${MODEL_DIR}/common"
nrnivmodl ./mb/mod/
python ./mb/test_cell/test_kc.py
15 changes: 15 additions & 0 deletions NeuroML2/.test.kc.jnmlnrn.omt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
target: LEMS_KC_step_test.xml
engine: jNeuroML_NEURON
mep: .test.kc.mep
experiments:
stepKC:
observables:
spike times:
file:
path: KC_step_test.KC_pop.v.dat
columns: [0,1]
scaling: [1000,1000]
spike detection:
method: threshold
threshold: -10.
tolerance: 0.005087969567027844
8 changes: 8 additions & 0 deletions NeuroML2/.test.kc.mep
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
system: Testing a detailed cell

experiments:
stepKC:
expected:
spike times: [144.45000000000556, 177.64999999997536, 210.29999999994567, 242.74999999991616, 275.0499999998868, 307.19999999985754, 339.2249999998284, 371.07499999979945, 402.74999999977064, 434.1499999997421, 465.2249999997138, 495.87499999968594, 525.9749999997221, 555.3499999998289, 583.8499999999326]

# generated from test-kc.py
56 changes: 54 additions & 2 deletions NeuroML2/GGN.cell.nml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,60 @@
Yale University and UCL
</notes>
<include href="channels/pas.channel.nml"/>
<cell id="GGM">
<notes>Cell: GGM exported from NEURON ModelView. Reference: Subhasis Ray Zane N Aldworth Mark A Stopfer (2020) Feedback inhibition and its control in an insect olfactory circuit eLife 9:e53281.</notes>
<cell id="GGN">
<notes>Cell: GGN exported from NEURON ModelView. Reference: Subhasis Ray, Zane N Aldworth, Mark A Stopfer (2020) Feedback inhibition and its control in an insect olfactory circuit eLife 9:e53281.</notes>
<annotation>

<rdf:RDF
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:bqmodel="http://biomodels.net/model-qualifiers/"
>
<rdf:Description rdf:about="GGN">
<dc:title>Giant GABAergic Neuron model</dc:title>
<dc:description>Subhasis Ray, Zane N Aldworth, Mark A Stopfer (2020) Feedback inhibition and its control in an insect olfactory circuit eLife 9:e53281.</dc:description>
<dc:source>
<rdf:Bag rdf:nodeID="N0f08af6f211344f29b04cb3d3175c192">
<rdf:_1 rdf:resource="https://modeldb.science/262670"/>
</rdf:Bag>
</dc:source>
<dc:source>
<rdf:Bag rdf:nodeID="N19161119d1f64f4c85fcb0288a1327a8">
<rdf:_1 rdf:resource="https://github.com/OpenSourceBrain/262670"/>
</rdf:Bag>
</dc:source>
<dc:source>
<rdf:Bag rdf:nodeID="N8ce8cb74c0a44bfc9943bd92fa055577">
<rdf:_1 rdf:resource="https://v1.opensourcebrain.org/projects/locust-mushroom-body"/>
</rdf:Bag>
</dc:source>
<bqmodel:isDescribedBy>
<rdf:Bag rdf:nodeID="N7d8930ba1e9546d6b602231ee8f9634b">
<rdf:_1 rdf:resource="https://doi.org/10.7554/eLife.53281"/>
</rdf:Bag>
</bqmodel:isDescribedBy>
<dc:creator>
<rdf:Bag rdf:nodeID="N2039210e1f7f4ffc97970ed011e0e937">
<rdf:_1>Subhasis Ray</rdf:_1>
<rdf:_2>https://orcid.org/0000-0003-2566-7146</rdf:_2>
</rdf:Bag>
</dc:creator>
<dc:contributor>
<rdf:Bag rdf:nodeID="N7d06673bf9de4e1293ebcff99aab56d9">
<rdf:_1>Ankur Sinha</rdf:_1>
<rdf:_2>https://orcid.org/0000-0001-7568-7167</rdf:_2>
</rdf:Bag>
</dc:contributor>
<dcterms:created>
<rdf:Description rdf:nodeID="N76d82b5ef0b94239a6530a5cd976a7ac">
<dcterms:W3CDTF>2024-04-25</dcterms:W3CDTF>
</rdf:Description>
</dcterms:created>
</rdf:Description>
</rdf:RDF>

</annotation>
<morphology id="morphology">
<segment id="0" name="Seg0_soma">
<proximal x="653.463" y="-767.82" z="-280.501" diameter="0.194"/>
Expand Down
71 changes: 65 additions & 6 deletions NeuroML2/KC.cell.nml
Original file line number Diff line number Diff line change
@@ -1,11 +1,69 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="KC_doc">
<include href="channels/pas.channel.nml"/>
<include href="channels/nas.channel.nml"/>
<include href="channels/naf.channel.nml"/>
<include href="channels/kv.channel.nml"/>
<include href="channels/ka.channel.nml"/>
<include href="channels/kst.channel.nml"/>
<include href="channels/naf.channel.nml"/>
<include href="channels/nas.channel.nml"/>
<cell id="KC">
<annotation>

<rdf:RDF
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:bqmodel="http://biomodels.net/model-qualifiers/"
>
<rdf:Description rdf:about="KC">
<dc:title>Kenyon cell model</dc:title>
<dc:description>Subhasis Ray, Zane N Aldworth, Mark A Stopfer (2020) Feedback inhibition and its control in an insect olfactory circuit eLife 9:e53281.</dc:description>
<bqbiol:encodes>
<rdf:Bag rdf:nodeID="Nc00a268a26874598bff06e0876cc57ed">
<rdf:_1 rdf:resource="http://uri.neuinfo.org/nif/nifstd/nlx_147420"/>
</rdf:Bag>
</bqbiol:encodes>
<dc:source>
<rdf:Bag rdf:nodeID="N273df5f0f5134d69aa88c5f4be36205f">
<rdf:_1 rdf:resource="https://modeldb.science/262670"/>
</rdf:Bag>
</dc:source>
<dc:source>
<rdf:Bag rdf:nodeID="N52bb0f14a2c745b5ad6ad543a175b940">
<rdf:_1 rdf:resource="https://github.com/OpenSourceBrain/262670"/>
</rdf:Bag>
</dc:source>
<dc:source>
<rdf:Bag rdf:nodeID="N8ba0bc6b71f04e1297a2f41690fb845e">
<rdf:_1 rdf:resource="https://v1.opensourcebrain.org/projects/locust-mushroom-body"/>
</rdf:Bag>
</dc:source>
<bqmodel:isDescribedBy>
<rdf:Bag rdf:nodeID="N32688f93918a4ad38df9061c90c2ab30">
<rdf:_1 rdf:resource="https://doi.org/10.7554/eLife.53281"/>
</rdf:Bag>
</bqmodel:isDescribedBy>
<dc:creator>
<rdf:Bag rdf:nodeID="Ncd61d80f8e2c4b2a945b3daf84437df6">
<rdf:_1>Subhasis Ray</rdf:_1>
<rdf:_2>https://orcid.org/0000-0003-2566-7146</rdf:_2>
</rdf:Bag>
</dc:creator>
<dc:contributor>
<rdf:Bag rdf:nodeID="N8376b6c99c734829a6c8a38eca97b3da">
<rdf:_1>Ankur Sinha</rdf:_1>
<rdf:_2>https://orcid.org/0000-0001-7568-7167</rdf:_2>
</rdf:Bag>
</dc:contributor>
<dcterms:created>
<rdf:Description rdf:nodeID="Ncc1a5b98ec974d12b90db9403e67ef79">
<dcterms:W3CDTF>2024-04-25</dcterms:W3CDTF>
</rdf:Description>
</dcterms:created>
</rdf:Description>
</rdf:RDF>

</annotation>
<morphology id="morphology">
<segment id="0" name="Seg0">
<proximal x="0.0" y="0.0" z="0.0" diameter="20.0"/>
Expand All @@ -22,14 +80,15 @@
</morphology>
<biophysicalProperties id="biophys">
<membraneProperties>
<channelDensity id="pas" ionChannel="pas" condDensity=".0000975 S_per_cm2" erev="-70 mV" ion="non_specific"/>
<channelDensity id="nas" ionChannel="nas" condDensity="3e-3 S_per_cm2" erev="-58 mV" ion="na"/>
<channelDensity id="naf" ionChannel="naf" condDensity="3.5e-2 S_per_cm2" erev="-58 mV" ion="na"/>
<channelDensity id="pas" ionChannel="pas" condDensity="9.75e-5 S_per_cm2" erev="-70 mV" ion="non_specific"/>
<channelDensity id="kv" ionChannel="kv" condDensity="1.5e-3 S_per_cm2" erev="-81 mV" ion="k"/>
<channelDensity id="ka" ionChannel="ka" condDensity="1.4525e-2 S_per_cm2" erev="-81 mV" ion="k"/>
<channelDensity id="kst" ionChannel="kst" condDensity="2.0275e-3 S_per_cm2" erev="-81 mV" ion="k"/>
<channelDensity id="naf" ionChannel="naf" condDensity="3.5e-2 S_per_cm2" erev="58 mV" ion="na"/>
<channelDensity id="nas" ionChannel="nas" condDensity="3e-3 S_per_cm2" erev="58 mV" ion="na"/>
<spikeThresh value="-10mV"/>
<specificCapacitance value="1 uF_per_cm2"/>
<initMembPotential value="-80mV"/>
<initMembPotential value="-70mV"/>
</membraneProperties>
<intracellularProperties>
<resistivity value="35.4 ohm_cm"/>
Expand Down
47 changes: 47 additions & 0 deletions NeuroML2/KC.net.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="KC_doc">
<include href="channels/pas.channel.nml"/>
<include href="channels/kv.channel.nml"/>
<include href="channels/ka.channel.nml"/>
<include href="channels/kst.channel.nml"/>
<include href="channels/naf.channel.nml"/>
<include href="channels/nas.channel.nml"/>
<cell id="KC">
<morphology id="morphology">
<segment id="0" name="Seg0">
<proximal x="0.0" y="0.0" z="0.0" diameter="20.0"/>
<distal x="0.0" y="0.0" z="6.366" diameter="20.0"/>
</segment>
<segmentGroup id="soma_group" neuroLexId="GO:0043025">
<notes>Default soma segment group for the cell</notes>
<member segment="0"/>
</segmentGroup>
<segmentGroup id="all">
<notes>Default segment group for all segments in the cell</notes>
<member segment="0"/>
</segmentGroup>
</morphology>
<biophysicalProperties id="biophys">
<membraneProperties>
<channelDensity id="pas" ionChannel="pas" condDensity="9.75e-5 S_per_cm2" erev="-70 mV" ion="non_specific"/>
<channelDensity id="kv" ionChannel="kv" condDensity="1.5e-3 S_per_cm2" erev="-81 mV" ion="k"/>
<channelDensity id="ka" ionChannel="ka" condDensity="1.4525e-2 S_per_cm2" erev="-81 mV" ion="k"/>
<channelDensity id="kst" ionChannel="kst" condDensity="2.0275e-3 S_per_cm2" erev="-81 mV" ion="k"/>
<channelDensity id="naf" ionChannel="naf" condDensity="3.5e-2 S_per_cm2" erev="58 mV" ion="na"/>
<channelDensity id="nas" ionChannel="nas" condDensity="3e-3 S_per_cm2" erev="58 mV" ion="na"/>
<spikeThresh value="-10mV"/>
<specificCapacitance value="1 uF_per_cm2"/>
<initMembPotential value="-70mV"/>
</membraneProperties>
<intracellularProperties>
<resistivity value="35.4 ohm_cm"/>
</intracellularProperties>
</biophysicalProperties>
</cell>
<pulseGenerator id="pg" delay="100ms" duration="500ms" amplitude="16pA"/>
<network id="KC_net">
<population id="KC_pop" component="KC" size="1"/>
<inputList id="input_list" population="KC_pop" component="pg">
<input id="0" target="../KC_pop[0]" destination="synapses" segmentId="0"/>
</inputList>
</network>
</neuroml>
45 changes: 45 additions & 0 deletions NeuroML2/LEMS_KC_step_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<Lems>

<!--
This LEMS file has been automatically generated using PyNeuroML v1.2.8 (libNeuroML v0.5.9)
-->

<!-- Specify which component to run -->
<Target component="KC_step_test"/>

<!-- Include core NeuroML2 ComponentType definitions -->
<Include file="Cells.xml"/>
<Include file="Networks.xml"/>
<Include file="Simulation.xml"/>

<Include file="KC.net.nml"/>
<Include file="channels/pas.channel.nml"/>
<Include file="channels/kv.channel.nml"/>
<Include file="RaySigmoid.nml"/>
<Include file="channels/ka.channel.nml"/>
<Include file="channels/kst.channel.nml"/>
<Include file="channels/naf.channel.nml"/>
<Include file="channels/nas.channel.nml"/>

<Simulation id="KC_step_test" length="700.0ms" step="0.01ms" target="KC_net" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
<Display id="DispPop__KC_pop" title="Membrane potentials of cells in KC_pop" timeScale="1ms" xmin="-70.0" xmax="770.0000000000001" ymin="-90" ymax="50">
<Line id="KC_pop[0]: v" quantity="KC_pop[0]/v" scale="1mV" color="#d54f33" timeScale="1ms"/>
</Display>

<OutputFile id="Volts_file__KC_pop" fileName="KC_step_test.KC_pop.v.dat">
<OutputColumn id="v_KC_pop_0__v" quantity="KC_pop[0]/v"/>
</OutputFile>

<OutputFile id="k_dat" fileName="k.dat">
<OutputColumn id="KC_pop_0__biophys_membraneProperties_kv_iDensity" quantity="KC_pop[0]/biophys/membraneProperties/kv/iDensity"/>
</OutputFile>

<EventOutputFile id="Spikes_file__KC_pop" fileName="KC_step_test.KC_pop.spikes" format="ID_TIME">
<EventSelection id="0" select="KC_pop[0]" eventPort="spike"/>
</EventOutputFile>

</Simulation>

</Lems>
Loading

0 comments on commit f82f804

Please sign in to comment.