Created
January 6, 2015 08:06
Motor neron circuit for c302 (AS01, AS02, DA01, DA02, DB01, DD01, SMDDL, SMDDR)
This file contains hidden or 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
# Model of a neuromotor circuit | |
# To run: | |
# python c302_Motor.py A (uses parameters_A, requires jNeuroML to run) | |
# or | |
# python c302_Motor.py B (uses parameters_B, requires jNeuroML built from the | |
# experimental branches to run: 'python getNeuroML experimental' | |
# see https://github.com/NeuroML/jNeuroML) | |
from c302 import generate | |
from neuroml import PulseGenerator | |
from neuroml import ExplicitInput | |
from neuroml import GapJunction | |
import neuroml.writers as writers | |
import sys | |
def add_new_input(nml_doc, cell, delay, duration, amplitude): | |
stim = PulseGenerator(id="stim_"+cell, delay=delay, duration=duration, amplitude=amplitude) | |
nml_doc.pulse_generators.append(stim) | |
populations_without_location = isinstance(params.elec_syn, GapJunction) | |
target ="%s/0/%s"%(cell, params.generic_cell.id) | |
if populations_without_location: | |
target ="%s[0]"%(cell) | |
exp_input = ExplicitInput(target=target, input=stim.id) | |
nml_doc.networks[0].explicit_inputs.append(exp_input) | |
if __name__ == '__main__': | |
parameter_set = sys.argv[1] if len(sys.argv)==2 else 'A' | |
exec('import parameters_%s as params'%parameter_set) | |
cells = ['AS1','AS2','DA1','DA2','DB1','DD1','SMDDL','SMDDR'] | |
cells_to_stimulate = [] | |
reference = "c302_%s_Motor"%parameter_set | |
nml_doc = generate(reference, | |
params, | |
cells=cells, | |
cells_to_stimulate=cells_to_stimulate, | |
duration=2800, | |
dt=0.1, | |
vmin=-72 if parameter_set=='A' else -52, | |
vmax=-48 if parameter_set=='A' else -28, | |
validate=(parameter_set!='B')) | |
stim_amplitude = "0.35nA" | |
add_new_input(nml_doc, "AS1", "100ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "AS2", "400ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "DA1", "700ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "DA2", "1000ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "DB1", "1300ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "DD1", "1600ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "SMDDL", "1900ms", "200ms", stim_amplitude) | |
add_new_input(nml_doc, "SMDDR", "2200ms", "200ms", stim_amplitude) | |
nml_file = reference+'.nml' | |
writers.NeuroMLWriter.write(nml_doc, nml_file) # Write over network file written above... | |
print("(Re)written network file to: "+nml_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment