|
| 1 | +from neuromllite import * |
| 2 | +from neuromllite.NetworkGenerator import * |
| 3 | +from neuromllite.utils import create_new_model |
| 4 | +import sys |
| 5 | + |
| 6 | +sys.path.append("..") |
| 7 | + |
| 8 | +colors = {'PassiveCell':'0 0 0.8', 'cADpyr229_L23_PC_5ecbf9b163_0_0':'0.8 0 0', 'pyr_4_sym':'0 0 0.8', 'IB':'0.8 0 0', 'IBR':'0.8 0 0'} |
| 9 | + |
| 10 | +def generate(cell, duration, config='IClamp'): |
| 11 | + |
| 12 | + reference = "%s_%s"%(config, cell) |
| 13 | + |
| 14 | + cell_id = '%s'%cell |
| 15 | + cell_nmll = Cell(id=cell_id, neuroml2_source_file='%s.cell.nml'%(cell)) |
| 16 | + |
| 17 | + ################################################################################ |
| 18 | + ### Add some inputs |
| 19 | + |
| 20 | + if 'IClamp' in config: |
| 21 | + parameters = {} |
| 22 | + parameters['stim_amp'] = '350pA' |
| 23 | + parameters['stim_delay'] = '100ms' |
| 24 | + parameters['stim_dur'] = '500ms' |
| 25 | + input_source = InputSource(id='iclamp_0', |
| 26 | + neuroml2_input='PulseGenerator', |
| 27 | + parameters={'amplitude':'stim_amp', 'delay':'stim_delay', 'duration':'stim_dur'}) |
| 28 | + |
| 29 | + |
| 30 | + else: |
| 31 | + |
| 32 | + parameters = {} |
| 33 | + parameters['average_rate'] = '100 Hz' |
| 34 | + parameters['number_per_cell'] = '10' |
| 35 | + input_source = InputSource(id='pfs0', |
| 36 | + neuroml2_input='PoissonFiringSynapse', |
| 37 | + parameters={'average_rate':'average_rate', |
| 38 | + 'synapse':syn_exc.id, |
| 39 | + 'spike_target':"./%s"%syn_exc.id}) |
| 40 | + |
| 41 | + sim, net = create_new_model(reference, |
| 42 | + duration, |
| 43 | + dt=0.01, # ms |
| 44 | + temperature=34, # degC |
| 45 | + default_region='Cortex', |
| 46 | + parameters = parameters, |
| 47 | + cell_for_default_population=cell_nmll, |
| 48 | + color_for_default_population=colors[cell], |
| 49 | + input_for_default_population=input_source) |
| 50 | + |
| 51 | + sim.recordVariables={'2/v':{'all':'*'}} |
| 52 | + ''' |
| 53 | + sim.recordVariables={'biophys/membraneProperties/Na_all/Na/m/q':{'all':'*'}, |
| 54 | + 'biophys/membraneProperties/Na_all/Na/h/q':{'all':'*'}, |
| 55 | + 'biophys/membraneProperties/Kd_all/Kd/n/q':{'all':'*'}} |
| 56 | + |
| 57 | + if cell != 'FS': |
| 58 | + sim.recordVariables['biophys/membraneProperties/IM_all/IM/p/q']={'all':'*'} |
| 59 | + |
| 60 | + if cell == 'IB' or cell == 'IBR': |
| 61 | + sim.recordVariables['biophys/membraneProperties/IL_all/IL/q/q']={'all':'*'} |
| 62 | + sim.recordVariables['biophys/membraneProperties/IL_all/IL/r/q']={'all':'*'} |
| 63 | + |
| 64 | + if cell == 'LTS': |
| 65 | + sim.recordVariables['biophys/membraneProperties/IT_all/IT/s/q']={'all':'*'} |
| 66 | + sim.recordVariables['biophys/membraneProperties/IT_all/IT/u/q']={'all':'*'}''' |
| 67 | + |
| 68 | + sim.to_json_file() |
| 69 | + |
| 70 | + return sim, net |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +if __name__ == "__main__": |
| 75 | + |
| 76 | + if '-all' in sys.argv: |
| 77 | + for cell in colors: |
| 78 | + generate('PassiveCell', 700, config="IClamp") |
| 79 | + generate('pyr_4_sym', 700, config="IClamp") |
| 80 | + generate('cADpyr229_L23_PC_5ecbf9b163_0_0', 700, config="IClamp") |
| 81 | + |
| 82 | + |
| 83 | + else: |
| 84 | + #generate('IFcurve_PV') |
| 85 | + #generate('olm') |
| 86 | + sim, net = generate('pyr_4_sym', 700, config="IClamp") |
| 87 | + #generate('olm', 1000, config="PoissonFiringSynapse") |
| 88 | + #generate('bistratified') |
| 89 | + #generate('IClamp_Pyr') |
| 90 | + |
| 91 | + check_to_generate_or_run(sys.argv, sim) |
| 92 | + |
0 commit comments