Skip to content

Commit

Permalink
Add intial nmllite version
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed May 28, 2024
1 parent 9ebf05b commit 49d0ccd
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,15 @@ OpenWormMuscleModel.egg-info
/NeuroML2/*_main.json
arm64
/NeuroML2/LEMS_NeuronMuscle_eden.py
/NeuroML2/nmllite/CaPool.nml
/NeuroML2/nmllite/IClamp_SingleCompMuscle.gv.png
/NeuroML2/nmllite/IClamp_SingleCompMuscle.net.png
/NeuroML2/nmllite/LEMS_Sim_IClamp_SingleCompMuscle.png
/NeuroML2/nmllite/LEMS_Sim_IClamp_SingleCompMuscle.xml
/NeuroML2/nmllite/Leak.channel.nml
/NeuroML2/nmllite/*dat
/NeuroML2/nmllite/SingleCompMuscle.cell.nml
/NeuroML2/nmllite/ca_boyle.channel.nml
/NeuroML2/nmllite/k_fast.channel.nml
/NeuroML2/nmllite/k_slow.channel.nml
/NeuroML2/nmllite/report.Sim_IClamp_SingleCompMuscle.txt
74 changes: 74 additions & 0 deletions NeuroML2/nmllite/GenerateExamples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from neuromllite import *
from neuromllite.NetworkGenerator import *
from neuromllite.utils import create_new_model
import sys

sys.path.append("..")


def generate(cell, duration=45, config='IClamp',parameters = None):

reference = "%s_%s"%(config, cell)

cell_id = '%sCell'%cell
cell_nmll = Cell(id=cell_id, neuroml2_source_file='../%s.cell.nml'%(cell))

################################################################################
### Add some inputs

if 'IClamp' in config:

if not parameters:
parameters = {}
parameters['stim_amp'] = '700pA'
parameters['offset_stim_amp'] = '-120 pA'

input_source0 = InputSource(id='iclamp_stim',
neuroml2_input='PulseGenerator',
parameters={'amplitude':'stim_amp', 'delay':'5ms', 'duration':'20ms'})

input_source1 = InputSource(id='iclamp_offset',
neuroml2_input='PulseGenerator',
parameters={'amplitude':'offset_stim_amp', 'delay':'0ms', 'duration':'10000ms'})


else:

if not parameters:
parameters = {}
parameters['average_rate'] = '100 Hz'
parameters['number_per_cell'] = '10'

input_source0 = InputSource(id='pfs0',
neuroml2_input='PoissonFiringSynapse',
parameters={'average_rate':'average_rate',
'synapse':syn_exc.id,
'spike_target':"./%s"%syn_exc.id})

sim, net = create_new_model(reference,
duration,
dt=0.025, # ms
temperature=34, # degC
default_region='Worm',
parameters = parameters,
cell_for_default_population=cell_nmll,
input_for_default_population=input_source0)

net.input_sources.append(input_source1)
net.inputs.append(Input(id='input_offset',
input_source=input_source1.id,
population=net.populations[0].id,
percentage=100))
net.to_json_file()

return sim, net



if __name__ == "__main__":

sim, net = generate('SingleCompMuscle', 45, config="IClamp")


check_to_generate_or_run(sys.argv, sim)

68 changes: 68 additions & 0 deletions NeuroML2/nmllite/IClamp_SingleCompMuscle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"IClamp_SingleCompMuscle": {
"version": "NeuroMLlite v0.5.9",
"notes": "A network model: IClamp_SingleCompMuscle",
"parameters": {
"stim_amp": "700pA",
"offset_stim_amp": "-120 pA"
},
"cells": {
"SingleCompMuscleCell": {
"neuroml2_source_file": "../SingleCompMuscle.cell.nml"
}
},
"input_sources": {
"iclamp_stim": {
"parameters": {
"amplitude": "stim_amp",
"delay": "5ms",
"duration": "20ms"
},
"neuroml2_input": "PulseGenerator"
},
"iclamp_offset": {
"parameters": {
"amplitude": "offset_stim_amp",
"delay": "0ms",
"duration": "10000ms"
},
"neuroml2_input": "PulseGenerator"
}
},
"regions": {
"Worm": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"width": 1000.0,
"height": 100.0,
"depth": 1000.0
}
},
"populations": {
"pop_SingleCompMuscleCell": {
"size": 1,
"component": "SingleCompMuscleCell",
"properties": {
"color": "0.8 0 0"
},
"random_layout": {
"region": "Worm"
}
}
},
"inputs": {
"Stim_iclamp_stim": {
"input_source": "iclamp_stim",
"population": "pop_SingleCompMuscleCell",
"percentage": 100
},
"input_offset": {
"input_source": "iclamp_offset",
"population": "pop_SingleCompMuscleCell",
"percentage": 100
}
},
"temperature": 34.0
}
}
29 changes: 29 additions & 0 deletions NeuroML2/nmllite/IClamp_SingleCompMuscle.net.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<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.1.xsd" id="IClamp_SingleCompMuscle">
<notes>Generated by NeuroMLlite v0.5.9
Generated network: IClamp_SingleCompMuscle
Generation seed: 1234
NeuroMLlite parameters:
offset_stim_amp = -120 pA
stim_amp = 700pA</notes>
<include href="../SingleCompMuscle.cell.nml"/>
<pulseGenerator id="iclamp_stim" delay="5ms" duration="20ms" amplitude="700pA"/>
<pulseGenerator id="iclamp_offset" delay="0ms" duration="10000ms" amplitude="-120 pA"/>
<network id="IClamp_SingleCompMuscle" type="networkWithTemperature" temperature="34.0degC">
<notes>A network model: IClamp_SingleCompMuscle</notes>
<property tag="recommended_dt_ms" value="0.025"/>
<property tag="recommended_duration_ms" value="45.0"/>
<population id="pop_SingleCompMuscleCell" component="SingleCompMuscleCell" size="1" type="populationList">
<property tag="color" value="0.8 0 0"/>
<property tag="region" value="Worm"/>
<instance id="0">
<location x="966.453535692138757" y="44.073259917535268" z="7.491470058587191"/>
</instance>
</population>
<inputList id="Stim_iclamp_stim" population="pop_SingleCompMuscleCell" component="iclamp_stim">
<input id="0" target="../pop_SingleCompMuscleCell/0/SingleCompMuscleCell" destination="synapses"/>
</inputList>
<inputList id="input_offset" population="pop_SingleCompMuscleCell" component="iclamp_offset">
<input id="0" target="../pop_SingleCompMuscleCell/0/SingleCompMuscleCell" destination="synapses"/>
</inputList>
</network>
</neuroml>
12 changes: 12 additions & 0 deletions NeuroML2/nmllite/Sim_IClamp_SingleCompMuscle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Sim_IClamp_SingleCompMuscle": {
"version": "NeuroMLlite v0.5.9",
"network": "IClamp_SingleCompMuscle.json",
"duration": 45.0,
"dt": 0.025,
"seed": 12345,
"record_traces": {
"all": "*"
}
}
}

0 comments on commit 49d0ccd

Please sign in to comment.