-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "*" | ||
} | ||
} | ||
} |