Пример #1
0
def setup(parameter_set,
          generate=False,
          duration=400,
          dt=0.05,
          target_directory='examples',
          data_reader="UpdatedSpreadsheetDataReader",
          param_overrides={},
          config_param_overrides={},
          verbose=True):
    
    exec('from parameters_%s import ParameterisedModel'%parameter_set, globals())
    params = ParameterisedModel()

    params.set_bioparameter("unphysiological_offset_current", "0pA", "Testing TapWithdrawal", "0")
    params.set_bioparameter("unphysiological_offset_current_del", "0 ms", "Testing TapWithdrawal", "0")
    params.set_bioparameter("unphysiological_offset_current_dur", "2000 ms", "Testing TapWithdrawal", "0")

    VA_motors = ["VA%s" % c for c in range_incl(1, 12)]
    VB_motors = ["VB%s" % c for c in range_incl(1, 11)]
    DA_motors = ["DA%s" % c for c in range_incl(1, 9)]
    DB_motors = ["DB%s" % c for c in range_incl(1, 7)]
    DD_motors = ["DD%s" % c for c in range_incl(1, 6)]
    VD_motors = ["VD%s" % c for c in range_incl(1, 13)]
    AS_motors = ["AS%s" % c for c in range_incl(1, 11)]
    AS_motors = []
    TW_cells = ['AVAL', 'AVAR', 'AVBL', 'AVBR', 'PVCL', 'PVCR', 'AVDL', 'AVDR', 'DVA', 'PVDL', 'PVDR', 'PLML', 'PLMR',
                'AVM', 'ALML', 'ALMR']
    TW_sensory = ["PLML", "PLMR", "AVM", "ALML", "ALMR"]
    all_motors = list(VA_motors + VB_motors + DA_motors + DB_motors + DD_motors + VD_motors + AS_motors)
    #all_motors = []
    
    #neurons = ['AVAL', 'AVAR', 'AVBL', 'AVBR', 'PVCL', 'PVCR', 'AVDL', 'AVDR', 'DVA', 'PVDL', 'PVDR', 'PLML', 'PLMR', 'AVM', 'ALML', 'ALMR']

    muscles_to_include = False
    #muscles_to_include = True # ALL muscles
    #muscles_to_include = ['MVL01', 'MVL10']

    cells = list(TW_cells + all_motors)
    
    cells_to_plot = list(cells)
    #cells_to_plot = ["VB5", "VA4"]

    cells += [  # 'AS1', 'AS10', 'AS11', 'AS2', 'AS3', 'AS4', 'AS5', 'AS6', 'AS7', 'AS8', 'AS9',
        # 'AVFL', 'AVFR', 'AVKR', 'AVL',
        # 'CEPVL', 'CEPVR',
        #
        #
        # 'DVB',
        # 'HSNL', 'HSNR',
        # 'IL1DL', 'IL1DR', 'IL1L', 'IL1R', 'IL1VL', 'IL1VR',
        # 'PDA', 'PDB',
        # 'PVNL', 'PVNR',
        # 'RID', 'RIML', 'RIMR', 'RIVL', 'RIVR',
        # 'RMDDL', 'RMDDR', 'RMDL', 'RMDR', 'RMDVL', 'RMDVR', 'RMED', 'RMEL', 'RMER', 'RMEV', 'RMFL', 'RMGL', 'RMGR',
        # 'RMHL', 'RMHR',
        # 'SMBDL', 'SMBDR', 'SMBVL', 'SMBVR', 'SMDDL', 'SMDDR', 'SMDVL', 'SMDVR',
        # 'URADL', 'URADR', 'URAVL', 'URAVR',
        # 'VC1', 'VC2', 'VC3', 'VC4', 'VC5', 'VC6',
    ]

    # cells = None
    #cells_to_stimulate = ['PLML', 'PLMR', 'AVM']
    cells_to_stimulate = []

    #cells_to_plot = ['AVAL', 'AVAR', 'AVBL', 'AVBR', 'PLML', 'PLMR', 'AVM', 'ALML', 'ALMR', 'PVDL', 'PVDR', 'AVDL', 'AVDR']
    #cells_to_plot = ['PLML', 'AVM', 'AVBL', 'AVAL']
    #cells_to_plot = cells
    #cells_to_plot += motors
    reference = "c302_%s_TapWithdrawal" % parameter_set

    conn_polarity_override = {
        'ALML-ALML':'inh',
        'ALML-PVCL':'inh',
        'ALML-PVCR':'inh',
        'ALML-AVDR':'inh', ##
        'ALMR-PVCR':'inh',

        'AVM-PVCL':'inh',
        'AVM-PVCR':'inh',
        'AVM-AVBL':'inh',
        'AVM-AVBR':'inh',
        'AVM-AVDL':'inh', ##
        'AVM-AVDR':'inh', ##

        'PVDL-PVDR':'inh',
        'PVDL-PVCL':'exc',
        'PVDL-PVCR':'exc',
        'PVDL-AVAL':'inh',
        'PVDL-AVAR':'inh',
        'PVDL-AVDL':'inh',
        'PVDL-AVDR':'inh',
        'PVDR-PVDL':'inh',
        'PVDR-DVA':'exc',
        'PVDR-PVCL':'exc',
        'PVDR-PVCR':'exc',
        'PVDR-AVAL':'inh',
        'PVDR-AVAR':'inh',
        'PVDR-AVDL':'inh',

        'DVA-PVCL':'inh',#
        'DVA-PVCR':'inh',#
        'DVA-AVAL':'inh',
        'DVA-AVAR':'inh',
        'DVA-AVBL':'inh',#
        'DVA-AVBR':'inh',#
        'DVA-AVDR':'inh',

        'PVCL-DVA':'exc',
        'PVCL-PVCL':'inh',
        'PVCL-PVCR':'inh',
        'PVCL-AVAL':'inh',
        'PVCL-AVAR':'inh',
        'PVCL-AVBL':'exc',
        'PVCL-AVBR':'exc',
        'PVCL-AVDL':'inh',
        'PVCL-AVDR':'inh',
        'PVCR-PVDL':'inh',
        'PVCR-PVDR':'inh',
        'PVCR-DVA':'exc',
        'PVCR-PVCL':'inh',
        'PVCR-AVAL':'inh',
        'PVCR-AVAR':'inh',
        'PVCR-AVBL':'exc',
        'PVCR-AVBR':'exc',
        'PVCR-AVDL':'inh',
        'PVCR-AVDR':'inh',

        'AVAL-PVCL':'inh',
        'AVAL-PVCR':'inh',
        'AVAL-AVAR':'inh',
        'AVAL-AVBL':'inh',
        'AVAL-AVDL':'inh',
        'AVAL-AVDR':'inh',

        'AVAR-PVCL':'inh',
        'AVAR-PVCR':'inh',
        'AVAR-AVAL':'inh',
        'AVAR-AVBL':'inh',
        'AVAR-AVBR':'inh',
        'AVAR-AVDL':'inh',
        'AVAR-AVDR':'inh',

        'AVBL-DVA':'inh',
        'AVBL-PVCR':'inh',
        'AVBL-AVAL':'inh',
        'AVBL-AVAR':'inh',
        'AVBL-AVBR':'inh',
        'AVBL-AVDR':'inh',
        'AVBR-AVAL':'inh',
        'AVBR-AVAR':'inh',
        'AVBR-AVBL':'inh',
        'AVBR-AVDL':'inh',

        'AVDL-PVCL':'inh',
        'AVDL-AVAL':'exc',
        'AVDL-AVAR':'exc',
        'AVDL-AVDR':'exc',
        'AVDR-PVCR':'inh',
        'AVDR-AVAL':'exc',
        'AVDR-AVAR':'exc',
        'AVDR-AVBL':'inh',
        'AVDR-AVDL':'exc',

        'DA9-DVA':'inh',

        'DVA-DA2':'inh',
        'PVCL-DA5':'inh',
        'PVCL-DA8':'inh',
        'PVCR-DA2':'inh',
        'PVCR-DA4':'inh',
        'PVCR-DA5':'inh',
        'PVCR-DA7':'inh',
        'AVBL-DA5':'inh',
        'AVBL-DA7':'inh',
        'AVBR-DA3':'inh',
        'AVBR-DA4':'inh',
        'AVBR-DA7':'inh',
        'AVDL-DA1':'inh',
        'AVDL-DA2':'inh',
        'AVDL-DA3':'inh',
        'AVDL-DA4':'inh',
        'AVDL-DA5':'inh',
        'AVDL-DA8':'inh',
        'AVDR-DA1':'inh',
        'AVDR-DA2':'inh',
        'AVDR-DA3':'inh',
        'AVDR-DA4':'inh',
        'AVDR-DA5':'inh',
        'AVDR-DA8':'inh',
        'DB1-DA1':'inh',
        'DB1-DA2':'inh',
        'DB2-DA2':'inh',
        'DB2-DA3':'inh',
        'DB2-DA4':'inh',
        'DB3-DA4':'inh',
        'DB3-DA5':'inh',
        'DB4-DA5':'inh',
        'DB5-DA6':'inh',
        'DB5-DA7':'inh',
        'DB5-DA8':'inh',
        'DB6-DA8':'inh',
        'DB6-DA9':'inh',
        'DB7-DA9':'inh',

        'AVAR-DB2':'inh',
        'AVAR-DB3':'inh',
        'AVAL-DB7':'inh',
        'DA1-DB1':'inh',
        'DA2-DA3':'inh',
        'DA2-DB1':'inh',
        'DA3-DB3':'inh',
        'DA4-DB2':'inh',
        'DA5-DB4':'inh',
        'DA6-DB5':'inh',
        'DA7-DB6':'inh',
        'DA8-DB7':'inh',
        'DA9-DB7':'inh',


        'DVA-VA2':'inh',
        'DVA-VA6':'inh',
        'DVA-VA8':'inh',
        'DVA-VA12':'inh',
        'PVCL-VA11':'inh',
        'PVDR-VA9':'inh',
        'PVDR-VA12':'inh',
        'AVBL-VA2':'inh',
        'AVBL-VA10':'inh',
        'AVBR-VA3':'inh',
        'AVBR-VA4':'inh',
        'AVDL-VA3':'inh',
        'AVDL-VA5':'inh',
        'AVDL-VA10':'inh',
        'AVDL-VA12':'inh',
        'AVDR-VA2':'inh',
        'AVDR-VA3':'inh',
        'AVDR-VA5':'inh',
        'AVDR-VA11':'inh',

        'VB1-VA1':'inh',
        'VB1-VA2':'inh',
        'VB1-VA3':'inh',
        'VB1-VA4':'inh',
        'VB2-VA2':'inh',
        'VB2-VA3':'inh',
        'VB3-VA4':'inh',
        'VB3-VA5':'inh',
        'VB4-VA4':'inh',
        'VB4-VA5':'inh',
        'VB5-VA6':'inh',
        'VB6-VA7':'inh',
        'VB6-VA8':'inh',
        'VB7-VA9':'inh',
        'VB7-VA10':'inh',
        'VB8-VA11':'inh',
        'VB9-VA11':'inh',
        'VB10-VA11':'inh',
        'VB11-VA12':'inh',

        'VB11-PVCR':'inh',
        'VB4-VB5':'inh',


        'VA2-VB1':'inh',
        'VA2-VB2':'inh',
        'VA3-VB2':'inh',
        'VA3-VB3':'inh',
        'VA4-AVDL':'inh',
        'VA4-VB3':'inh',
        'VA4-VB4':'inh',
        'VA5-VB4':'inh',
        'VA6-VB4':'inh',
        'VA6-VB5':'inh',
        'VA7-VB6':'inh',
        'VA8-VB6':'inh',
        'VA9-VB7':'inh',
        'VA9-VB8':'inh',
        'VA10-VB8':'inh',
        'VA10-VB9':'inh',
        'VA11-VB10':'inh',
        'VA12-PVCL':'inh',
        'VA12-PVCR':'inh',
        'VA12-DB7':'inh',
        'VA12-VB11':'inh',


        'AVM-VB3':'inh',
        #'VB4-VB5':'exc',

        #'DD1-DA2':'inh',
        #'DD1-VB2':'inh',
        #'DD2-DA3':'inh',
        #'DD3-DA5':'inh',
    }

    conn_number_override = {
        #'PVCL-AVDL':7*0.1,
        #'PVCL-AVDR':11*0.1,
        #'PVCR-AVDL':16*0.1,
        #'PVCR-AVDR':6*0.1,

        #'PVCR-AVDR_GJ':2 * 0.01,
        #'AVDR-PVCR_GJ':2 * 0.01,

        'PVCL-AVAL_GJ':5 * 0.01,
        'AVAL-PVCL_GJ':5 * 0.01,
        'PVCL-AVAR_GJ':10 * 0.01,
        'AVAR-PVCL_GJ':10 * 0.01,
        'PVCR-AVAL_GJ':15 * 0.01,
        'AVAL-PVCR_GJ':15 * 0.01,
        'PVCR-AVAR_GJ':22 * 0.01,
        'AVAR-PVCR_GJ':22 * 0.01,

        'PVCL-PLML_GJ':4 * 0.01, ##
        'PVCR-PLMR_GJ':8 * 0.01, ##

        #'AVDL-AVM_GJ':8 * 0.01,
        #'ALML-AVM_GJ':1 * 0.01,
        #'ALMR-AVM_GJ':1 * 0.01,
        
        #'AVDR-ALMR_GJ':1 * 0.01,

        # 'AVDL-AVAL':37*0.1,
        # 'AVDL-AVAR':37*0.1,
        # 'AVDR-AVAL':41*0.1,
        # 'AVDR-AVAR':52*0.1,

        # 'AVDL-AVAL_GJ':7*0.1,
        # 'AVAL-AVDL_GJ':7*0.1,
        # 'AVDL-AVAR_GJ':2*0.1,
        # 'AVAR-AVDL_GJ':2*0.1,
        # 'AVDR-AVAL_GJ':9*0.1,
        # 'AVAL-AVDR_GJ':9*0.1,
        # 'AVDR-AVAR_GJ':15*0.1,
        # 'AVAR-AVDR_GJ':15*0.1,


        # 'ALMR-AVDR_GJ':2*5,
        # 'AVDR-ALMR_GJ':2*5,

        'AVAR-AVBL_GJ':3*0.01,
        'AVBL-AVAR_GJ':3*0.01,

        # 'AVAR-AVAL_GJ':18*2,
        # 'AVAL-AVAR_GJ':18*2,


        'PVDL-AVAR_GJ':4 * 0.01,
        'AVAR-PVDL_GJ':4 * 0.01,
        'PVDR-AVAL_GJ':6 * 0.01,
        'AVAL-PVDR_GJ':6 * 0.01,

        'AVBL-VA11_GJ':1 * 0.01,
        'VA11-AVBL_GJ':1 * 0.01,
        'AVBR-VA11_GJ':3 * 0.01,
        'VA11-AVBR_GJ':3 * 0.01,
        'PVCR-VA11_GJ':3 * 0.01,
        'VA11-PVCR_GJ':3 * 0.01,
        'DVA-VA11_GJ':1 * 0.01,
        'VA11-DVA_GJ':1 * 0.01,

        'PVCL-VA12_GJ':18 * 0.01,
        'VA12-PVCL_GJ':18 * 0.01,
        'PVCR-VA12_GJ':8 * 0.01,
        'VA12-PVCR_GJ':8 * 0.01,

        'AVAL-VB11_GJ':2 * 0.01,
        'VB11-AVAL_GJ':2 * 0.01,

        'PVCL-DA4_GJ':1 * 0.01,
        'DA4-PVCL_GJ':1 * 0.01,

        'PVCL-DA7_GJ':1 * 0.01,
        'DA7-PVCL_GJ':1 * 0.01,
        'PVCR-DA7_GJ':3 * 0.01,
        'DA7-PVCR_GJ':3 * 0.01,

        'PVCL-DA8_GJ':17 * 0.01,
        'DA8-PVCL_GJ':17 * 0.01,
        'PVCR-DA8_GJ':1 * 0.01,
        'DA8-PVCR_GJ':1 * 0.01,

        'DVA-DA9_GJ':3 * 0.01,
        'DA9-DVA_GJ':3 * 0.01,
        'PVCR-DA9_GJ':3 * 0.01,
        'DA9-PVCR_GJ':3 * 0.01,

        'DB7-VA10_GJ':1 * 0.01,
        'VA10-DB7_GJ':1 * 0.01,

        'VA4-VB3_GJ':1 * 0.01,
        'VB3-VA4_GJ':1 * 0.01,


        'VA11-VB10_GJ':3 * 0.01,
        'VB10-VA11_GJ':3 * 0.01,

        'VA12-VB11_GJ':7 * 0.01,
        'VB11-VA12_GJ':7 * 0.01,

        'VB11-DA9_GJ':7 * 0.01,
        'DA9-VB11_GJ':7 * 0.01,
    }
    
    nml_doc = None

    if generate:
        nml_doc = c302.generate(reference,
                                params,
                                cells=cells,
                                cells_to_plot=cells_to_plot,
                                cells_to_stimulate=cells_to_stimulate,
                                conn_polarity_override=conn_polarity_override,
                                conn_number_override=conn_number_override,
                                muscles_to_include=muscles_to_include,
                                duration=duration,
                                dt=dt,
                                target_directory=target_directory,
                                data_reader=data_reader,
                                param_overrides=param_overrides,
                                verbose=verbose)

        stim_amplitude = "6pA"
        # stim_amplitude = "5.135697186048022pA"

        for vb in VB_motors:
            c302.add_new_sinusoidal_input(nml_doc, cell=vb, delay="0ms", duration="1000ms", amplitude="3pA",
                                          period="150ms", params=params)

        for db in DB_motors:
            c302.add_new_sinusoidal_input(nml_doc, cell=db, delay="0ms", duration="1000ms", amplitude="3pA",
                                          period="150ms", params=params)

        #c302.add_new_input(nml_doc, "AVM", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "ALML", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "ALMR", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "PLML", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "PLMR", "10ms", "700ms", stim_amplitude, params)

        nml_file = target_directory + '/' + reference + '.net.nml'
        writers.NeuroMLWriter.write(nml_doc, nml_file)  # Write over network file written above...

        c302.print_("(Re)written network file to: " + nml_file)

    return cells, cells_to_stimulate, params, muscles_to_include, nml_doc
Пример #2
0
def setup(parameter_set,
          generate=False,
          duration=1000,
          dt=0.05,
          target_directory='examples',
          data_reader="SpreadsheetDataReader",
          param_overrides={},
          config_param_overrides={},
          verbose=True):
    
    exec ('from parameters_%s import ParameterisedModel' % parameter_set)
    params = ParameterisedModel()

    params.set_bioparameter("unphysiological_offset_current", "0pA", "Testing TapWithdrawal", "0")
    params.set_bioparameter("unphysiological_offset_current_del", "0 ms", "Testing TapWithdrawal", "0")
    params.set_bioparameter("unphysiological_offset_current_dur", "2000 ms", "Testing TapWithdrawal", "0")

    VA_motors = ["VA%s" % c for c in range_incl(1, 12)]
    VB_motors = ["VB%s" % c for c in range_incl(1, 11)]
    DA_motors = ["DA%s" % c for c in range_incl(1, 9)]
    DB_motors = ["DB%s" % c for c in range_incl(1, 7)]
    DD_motors = ["DD%s" % c for c in range_incl(1, 6)]
    VD_motors = ["VD%s" % c for c in range_incl(1, 13)]
    AS_motors = ["AS%s" % c for c in range_incl(1, 11)]

    cells = list(VB_motors + DB_motors + DD_motors + VD_motors + AS_motors + VA_motors + DA_motors)
    #cells = ['VB1', 'VB2', 'DB1', 'DB2', 'DD1', 'DD2', 'VD1', 'VD2', 'AS1', 'AS2']
    # cells += ['AVAL']
    # cells += ['DB6']

    muscles_to_include = True
    muscles_to_include = ['MVL07', 'MVL08', 'MVL09', 'MVR07', 'MVR08', 'MVR09', 'MDL07', 'MDL08', 'MDL09', 'MDR07', 'MDR08', 'MDR09']

    cells_to_stimulate = []
    #cells_to_stimulate = ['VA1']

    cells_to_plot = list(VB_motors + DB_motors)
    cells_to_plot = ['VB1', 'VB2', 'DB1', 'DB2', 'DD1', 'DD2', 'VD1', 'VD2', 'AS1', 'AS2']
    reference = "c302_%s_SinusoidalInputTest" % parameter_set

    conns_to_include = [
    ]

    conn_polarity_override = {

    }

    conn_number_override = {
    }

    nml_doc = None
    if generate:
        nml_doc = c302.generate(reference,
                                params,
                                cells=cells,
                                cells_to_plot=cells_to_plot,
                                cells_to_stimulate=cells_to_stimulate,
                                conns_to_include=conns_to_include,
                                conn_polarity_override=conn_polarity_override,
                                conn_number_override=conn_number_override,
                                muscles_to_include=muscles_to_include,
                                duration=duration,
                                dt=dt,
                                target_directory=target_directory,
                                data_reader=data_reader,
                                param_overrides=param_overrides,
                                verbose=verbose)
        
        #for b_type in [b for b in cells if b.startswith("VB") or b.startswith("DB")]:
        #    c302.add_new_sinusoidal_input(nml_doc, cell=b_type, delay="0ms", duration="1000ms", amplitude="6pA",
        #                                  period="150ms", params=params)

        c302.add_new_sinusoidal_input(nml_doc, cell="VB1", delay="0ms", duration="1000ms", amplitude="3pA", period="150ms", params=params)

        #for vb in VB_motors:
        #    c302.add_new_sinusoidal_input(nml_doc, cell=vb, delay="0ms", duration="1000ms", amplitude="3pA",
        #                                  period="150ms", params=params)

        #for db in DB_motors:
        #    c302.add_new_sinusoidal_input(nml_doc, cell=db, delay="0ms", duration="1000ms", amplitude="3pA",
        #                                  period="150ms", params=params)

        nml_file = target_directory + '/' + reference + '.net.nml'
        writers.NeuroMLWriter.write(nml_doc, nml_file)  # Write over network file written above...

        print("(Re)written network file to: " + nml_file)


    return cells, cells_to_stimulate, params, muscles_to_include, nml_doc
def setup(parameter_set,
          generate=False,
          duration=400,
          dt=0.05,
          target_directory='examples',
          data_reader="UpdatedSpreadsheetDataReader",
          param_overrides={},
          config_param_overrides={},
          verbose=True):
    
    exec('from parameters_%s import ParameterisedModel'%parameter_set, globals())
    params = ParameterisedModel()

    params.set_bioparameter("unphysiological_offset_current", "0pA", "Testing TapWithdrawal", "0")
    params.set_bioparameter("unphysiological_offset_current_del", "0 ms", "Testing TapWithdrawal", "0")
    params.set_bioparameter("unphysiological_offset_current_dur", "2000 ms", "Testing TapWithdrawal", "0")

    VA_motors = ["VA%s" % c for c in range_incl(1, 12)]
    VB_motors = ["VB%s" % c for c in range_incl(1, 11)]
    DA_motors = ["DA%s" % c for c in range_incl(1, 9)]
    DB_motors = ["DB%s" % c for c in range_incl(1, 7)]
    DD_motors = ["DD%s" % c for c in range_incl(1, 6)]
    VD_motors = ["VD%s" % c for c in range_incl(1, 13)]
    AS_motors = ["AS%s" % c for c in range_incl(1, 11)]
    AS_motors = []
    TW_cells = ['AVAL', 'AVAR', 'AVBL', 'AVBR', 'PVCL', 'PVCR', 'AVDL', 'AVDR', 'DVA', 'PVDL', 'PVDR', 'PLML', 'PLMR',
                'AVM', 'ALML', 'ALMR']
    TW_sensory = ["PLML", "PLMR", "AVM", "ALML", "ALMR"]
    all_motors = list(VA_motors + VB_motors + DA_motors + DB_motors + DD_motors + VD_motors + AS_motors)
    #all_motors = []
    
    #neurons = ['AVAL', 'AVAR', 'AVBL', 'AVBR', 'PVCL', 'PVCR', 'AVDL', 'AVDR', 'DVA', 'PVDL', 'PVDR', 'PLML', 'PLMR', 'AVM', 'ALML', 'ALMR']

    muscles_to_include = False
    #muscles_to_include = True # ALL muscles
    #muscles_to_include = ['MVL01', 'MVL10']

    cells = list(TW_cells + all_motors)
    
    cells_to_plot = list(cells)
    #cells_to_plot = ["VB5", "VA4"]

    cells += [  # 'AS1', 'AS10', 'AS11', 'AS2', 'AS3', 'AS4', 'AS5', 'AS6', 'AS7', 'AS8', 'AS9',
        # 'AVFL', 'AVFR', 'AVKR', 'AVL',
        # 'CEPVL', 'CEPVR',
        #
        #
        # 'DVB',
        # 'HSNL', 'HSNR',
        # 'IL1DL', 'IL1DR', 'IL1L', 'IL1R', 'IL1VL', 'IL1VR',
        # 'PDA', 'PDB',
        # 'PVNL', 'PVNR',
        # 'RID', 'RIML', 'RIMR', 'RIVL', 'RIVR',
        # 'RMDDL', 'RMDDR', 'RMDL', 'RMDR', 'RMDVL', 'RMDVR', 'RMED', 'RMEL', 'RMER', 'RMEV', 'RMFL', 'RMGL', 'RMGR',
        # 'RMHL', 'RMHR',
        # 'SMBDL', 'SMBDR', 'SMBVL', 'SMBVR', 'SMDDL', 'SMDDR', 'SMDVL', 'SMDVR',
        # 'URADL', 'URADR', 'URAVL', 'URAVR',
        # 'VC1', 'VC2', 'VC3', 'VC4', 'VC5', 'VC6',
    ]

    # cells = None
    #cells_to_stimulate = ['PLML', 'PLMR', 'AVM']
    cells_to_stimulate = []

    #cells_to_plot = ['AVAL', 'AVAR', 'AVBL', 'AVBR', 'PLML', 'PLMR', 'AVM', 'ALML', 'ALMR', 'PVDL', 'PVDR', 'AVDL', 'AVDR']
    #cells_to_plot = ['PLML', 'AVM', 'AVBL', 'AVAL']
    #cells_to_plot = cells
    #cells_to_plot += motors
    reference = "c302_%s_TapWithdrawal" % parameter_set

    conn_polarity_override = {
        'ALML-ALML':'inh',
        'ALML-PVCL':'inh',
        'ALML-PVCR':'inh',
        'ALML-AVDR':'inh', ##
        'ALMR-PVCR':'inh',

        'AVM-PVCL':'inh',
        'AVM-PVCR':'inh',
        'AVM-AVBL':'inh',
        'AVM-AVBR':'inh',
        'AVM-AVDL':'inh', ##
        'AVM-AVDR':'inh', ##

        'PVDL-PVDR':'inh',
        'PVDL-PVCL':'exc',
        'PVDL-PVCR':'exc',
        'PVDL-AVAL':'inh',
        'PVDL-AVAR':'inh',
        'PVDL-AVDL':'inh',
        'PVDL-AVDR':'inh',
        'PVDR-PVDL':'inh',
        'PVDR-DVA':'exc',
        'PVDR-PVCL':'exc',
        'PVDR-PVCR':'exc',
        'PVDR-AVAL':'inh',
        'PVDR-AVAR':'inh',
        'PVDR-AVDL':'inh',

        'DVA-PVCL':'inh',#
        'DVA-PVCR':'inh',#
        'DVA-AVAL':'inh',
        'DVA-AVAR':'inh',
        'DVA-AVBL':'inh',#
        'DVA-AVBR':'inh',#
        'DVA-AVDR':'inh',

        'PVCL-DVA':'exc',
        'PVCL-PVCL':'inh',
        'PVCL-PVCR':'inh',
        'PVCL-AVAL':'inh',
        'PVCL-AVAR':'inh',
        'PVCL-AVBL':'exc',
        'PVCL-AVBR':'exc',
        'PVCL-AVDL':'inh',
        'PVCL-AVDR':'inh',
        'PVCR-PVDL':'inh',
        'PVCR-PVDR':'inh',
        'PVCR-DVA':'exc',
        'PVCR-PVCL':'inh',
        'PVCR-AVAL':'inh',
        'PVCR-AVAR':'inh',
        'PVCR-AVBL':'exc',
        'PVCR-AVBR':'exc',
        'PVCR-AVDL':'inh',
        'PVCR-AVDR':'inh',

        'AVAL-PVCL':'inh',
        'AVAL-PVCR':'inh',
        'AVAL-AVAR':'inh',
        'AVAL-AVBL':'inh',
        'AVAL-AVDL':'inh',
        'AVAL-AVDR':'inh',

        'AVAR-PVCL':'inh',
        'AVAR-PVCR':'inh',
        'AVAR-AVAL':'inh',
        'AVAR-AVBL':'inh',
        'AVAR-AVBR':'inh',
        'AVAR-AVDL':'inh',
        'AVAR-AVDR':'inh',

        'AVBL-DVA':'inh',
        'AVBL-PVCR':'inh',
        'AVBL-AVAL':'inh',
        'AVBL-AVAR':'inh',
        'AVBL-AVBR':'inh',
        'AVBL-AVDR':'inh',
        'AVBR-AVAL':'inh',
        'AVBR-AVAR':'inh',
        'AVBR-AVBL':'inh',
        'AVBR-AVDL':'inh',

        'AVDL-PVCL':'inh',
        'AVDL-AVAL':'exc',
        'AVDL-AVAR':'exc',
        'AVDL-AVDR':'exc',
        'AVDR-PVCR':'inh',
        'AVDR-AVAL':'exc',
        'AVDR-AVAR':'exc',
        'AVDR-AVBL':'inh',
        'AVDR-AVDL':'exc',

        'DA9-DVA':'inh',

        'DVA-DA2':'inh',
        'PVCL-DA5':'inh',
        'PVCL-DA8':'inh',
        'PVCR-DA2':'inh',
        'PVCR-DA4':'inh',
        'PVCR-DA5':'inh',
        'PVCR-DA7':'inh',
        'AVBL-DA5':'inh',
        'AVBL-DA7':'inh',
        'AVBR-DA3':'inh',
        'AVBR-DA4':'inh',
        'AVBR-DA7':'inh',
        'AVDL-DA1':'inh',
        'AVDL-DA2':'inh',
        'AVDL-DA3':'inh',
        'AVDL-DA4':'inh',
        'AVDL-DA5':'inh',
        'AVDL-DA8':'inh',
        'AVDR-DA1':'inh',
        'AVDR-DA2':'inh',
        'AVDR-DA3':'inh',
        'AVDR-DA4':'inh',
        'AVDR-DA5':'inh',
        'AVDR-DA8':'inh',
        'DB1-DA1':'inh',
        'DB1-DA2':'inh',
        'DB2-DA2':'inh',
        'DB2-DA3':'inh',
        'DB2-DA4':'inh',
        'DB3-DA4':'inh',
        'DB3-DA5':'inh',
        'DB4-DA5':'inh',
        'DB5-DA6':'inh',
        'DB5-DA7':'inh',
        'DB5-DA8':'inh',
        'DB6-DA8':'inh',
        'DB6-DA9':'inh',
        'DB7-DA9':'inh',

        'AVAR-DB2':'inh',
        'AVAR-DB3':'inh',
        'AVAL-DB7':'inh',
        'DA1-DB1':'inh',
        'DA2-DA3':'inh',
        'DA2-DB1':'inh',
        'DA3-DB3':'inh',
        'DA4-DB2':'inh',
        'DA5-DB4':'inh',
        'DA6-DB5':'inh',
        'DA7-DB6':'inh',
        'DA8-DB7':'inh',
        'DA9-DB7':'inh',


        'DVA-VA2':'inh',
        'DVA-VA6':'inh',
        'DVA-VA8':'inh',
        'DVA-VA12':'inh',
        'PVCL-VA11':'inh',
        'PVDR-VA9':'inh',
        'PVDR-VA12':'inh',
        'AVBL-VA2':'inh',
        'AVBL-VA10':'inh',
        'AVBR-VA3':'inh',
        'AVBR-VA4':'inh',
        'AVDL-VA3':'inh',
        'AVDL-VA5':'inh',
        'AVDL-VA10':'inh',
        'AVDL-VA12':'inh',
        'AVDR-VA2':'inh',
        'AVDR-VA3':'inh',
        'AVDR-VA5':'inh',
        'AVDR-VA11':'inh',

        'VB1-VA1':'inh',
        'VB1-VA2':'inh',
        'VB1-VA3':'inh',
        'VB1-VA4':'inh',
        'VB2-VA2':'inh',
        'VB2-VA3':'inh',
        'VB3-VA4':'inh',
        'VB3-VA5':'inh',
        'VB4-VA4':'inh',
        'VB4-VA5':'inh',
        'VB5-VA6':'inh',
        'VB6-VA7':'inh',
        'VB6-VA8':'inh',
        'VB7-VA9':'inh',
        'VB7-VA10':'inh',
        'VB8-VA11':'inh',
        'VB9-VA11':'inh',
        'VB10-VA11':'inh',
        'VB11-VA12':'inh',

        'VB11-PVCR':'inh',
        'VB4-VB5':'inh',


        'VA2-VB1':'inh',
        'VA2-VB2':'inh',
        'VA3-VB2':'inh',
        'VA3-VB3':'inh',
        'VA4-AVDL':'inh',
        'VA4-VB3':'inh',
        'VA4-VB4':'inh',
        'VA5-VB4':'inh',
        'VA6-VB4':'inh',
        'VA6-VB5':'inh',
        'VA7-VB6':'inh',
        'VA8-VB6':'inh',
        'VA9-VB7':'inh',
        'VA9-VB8':'inh',
        'VA10-VB8':'inh',
        'VA10-VB9':'inh',
        'VA11-VB10':'inh',
        'VA12-PVCL':'inh',
        'VA12-PVCR':'inh',
        'VA12-DB7':'inh',
        'VA12-VB11':'inh',


        'AVM-VB3':'inh',
        #'VB4-VB5':'exc',

        #'DD1-DA2':'inh',
        #'DD1-VB2':'inh',
        #'DD2-DA3':'inh',
        #'DD3-DA5':'inh',
    }

    conn_number_override = {
        #'PVCL-AVDL':7*0.1,
        #'PVCL-AVDR':11*0.1,
        #'PVCR-AVDL':16*0.1,
        #'PVCR-AVDR':6*0.1,

        #'PVCR-AVDR_GJ':2 * 0.01,
        #'AVDR-PVCR_GJ':2 * 0.01,

        'PVCL-AVAL_GJ':5 * 0.01,
        'AVAL-PVCL_GJ':5 * 0.01,
        'PVCL-AVAR_GJ':10 * 0.01,
        'AVAR-PVCL_GJ':10 * 0.01,
        'PVCR-AVAL_GJ':15 * 0.01,
        'AVAL-PVCR_GJ':15 * 0.01,
        'PVCR-AVAR_GJ':22 * 0.01,
        'AVAR-PVCR_GJ':22 * 0.01,

        'PVCL-PLML_GJ':4 * 0.01, ##
        'PVCR-PLMR_GJ':8 * 0.01, ##

        #'AVDL-AVM_GJ':8 * 0.01,
        #'ALML-AVM_GJ':1 * 0.01,
        #'ALMR-AVM_GJ':1 * 0.01,
        
        #'AVDR-ALMR_GJ':1 * 0.01,

        # 'AVDL-AVAL':37*0.1,
        # 'AVDL-AVAR':37*0.1,
        # 'AVDR-AVAL':41*0.1,
        # 'AVDR-AVAR':52*0.1,

        # 'AVDL-AVAL_GJ':7*0.1,
        # 'AVAL-AVDL_GJ':7*0.1,
        # 'AVDL-AVAR_GJ':2*0.1,
        # 'AVAR-AVDL_GJ':2*0.1,
        # 'AVDR-AVAL_GJ':9*0.1,
        # 'AVAL-AVDR_GJ':9*0.1,
        # 'AVDR-AVAR_GJ':15*0.1,
        # 'AVAR-AVDR_GJ':15*0.1,


        # 'ALMR-AVDR_GJ':2*5,
        # 'AVDR-ALMR_GJ':2*5,

        'AVAR-AVBL_GJ':3*0.01,
        'AVBL-AVAR_GJ':3*0.01,

        # 'AVAR-AVAL_GJ':18*2,
        # 'AVAL-AVAR_GJ':18*2,


        'PVDL-AVAR_GJ':4 * 0.01,
        'AVAR-PVDL_GJ':4 * 0.01,
        'PVDR-AVAL_GJ':6 * 0.01,
        'AVAL-PVDR_GJ':6 * 0.01,

        'AVBL-VA11_GJ':1 * 0.01,
        'VA11-AVBL_GJ':1 * 0.01,
        'AVBR-VA11_GJ':3 * 0.01,
        'VA11-AVBR_GJ':3 * 0.01,
        'PVCR-VA11_GJ':3 * 0.01,
        'VA11-PVCR_GJ':3 * 0.01,
        'DVA-VA11_GJ':1 * 0.01,
        'VA11-DVA_GJ':1 * 0.01,

        'PVCL-VA12_GJ':18 * 0.01,
        'VA12-PVCL_GJ':18 * 0.01,
        'PVCR-VA12_GJ':8 * 0.01,
        'VA12-PVCR_GJ':8 * 0.01,

        'AVAL-VB11_GJ':2 * 0.01,
        'VB11-AVAL_GJ':2 * 0.01,

        'PVCL-DA4_GJ':1 * 0.01,
        'DA4-PVCL_GJ':1 * 0.01,

        'PVCL-DA7_GJ':1 * 0.01,
        'DA7-PVCL_GJ':1 * 0.01,
        'PVCR-DA7_GJ':3 * 0.01,
        'DA7-PVCR_GJ':3 * 0.01,

        'PVCL-DA8_GJ':17 * 0.01,
        'DA8-PVCL_GJ':17 * 0.01,
        'PVCR-DA8_GJ':1 * 0.01,
        'DA8-PVCR_GJ':1 * 0.01,

        'DVA-DA9_GJ':3 * 0.01,
        'DA9-DVA_GJ':3 * 0.01,
        'PVCR-DA9_GJ':3 * 0.01,
        'DA9-PVCR_GJ':3 * 0.01,

        'DB7-VA10_GJ':1 * 0.01,
        'VA10-DB7_GJ':1 * 0.01,

        'VA4-VB3_GJ':1 * 0.01,
        'VB3-VA4_GJ':1 * 0.01,


        'VA11-VB10_GJ':3 * 0.01,
        'VB10-VA11_GJ':3 * 0.01,

        'VA12-VB11_GJ':7 * 0.01,
        'VB11-VA12_GJ':7 * 0.01,

        'VB11-DA9_GJ':7 * 0.01,
        'DA9-VB11_GJ':7 * 0.01,
    }
    
    nml_doc = None

    if generate:
        nml_doc = c302.generate(reference,
                                params,
                                cells=cells,
                                cells_to_plot=cells_to_plot,
                                cells_to_stimulate=cells_to_stimulate,
                                conn_polarity_override=conn_polarity_override,
                                conn_number_override=conn_number_override,
                                muscles_to_include=muscles_to_include,
                                duration=duration,
                                dt=dt,
                                target_directory=target_directory,
                                data_reader=data_reader,
                                param_overrides=param_overrides,
                                verbose=verbose)

        stim_amplitude = "6pA"
        # stim_amplitude = "5.135697186048022pA"

        for vb in VB_motors:
            c302.add_new_sinusoidal_input(nml_doc, cell=vb, delay="0ms", duration="1000ms", amplitude="3pA",
                                          period="150ms", params=params)

        for db in DB_motors:
            c302.add_new_sinusoidal_input(nml_doc, cell=db, delay="0ms", duration="1000ms", amplitude="3pA",
                                          period="150ms", params=params)

        #c302.add_new_input(nml_doc, "AVM", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "ALML", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "ALMR", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "PLML", "10ms", "700ms", stim_amplitude, params)
        #c302.add_new_input(nml_doc, "PLMR", "10ms", "700ms", stim_amplitude, params)

        nml_file = target_directory + '/' + reference + '.net.nml'
        writers.NeuroMLWriter.write(nml_doc, nml_file)  # Write over network file written above...

        print("(Re)written network file to: " + nml_file)

    return cells, cells_to_stimulate, params, muscles_to_include, nml_doc
Пример #4
0
def setup(parameter_set,
          generate=False,
          duration=10000,
          dt=0.05,
          target_directory='examples',
          data_reader="UpdatedSpreadsheetDataReader2",
          param_overrides={},
          verbose=True,
          config_param_overrides={}):

    exec('from parameters_%s import ParameterisedModel' % parameter_set,
         globals())
    params = ParameterisedModel()

    #'''
    VA_motors = ["VA%s" % c for c in range_incl(1, 12)]
    VB_motors = ["VB%s" % c for c in range_incl(1, 11)]
    DA_motors = ["DA%s" % c for c in range_incl(1, 9)]
    DB_motors = ["DB%s" % c for c in range_incl(1, 7)]
    DD_motors = ["DD%s" % c for c in range_incl(1, 6)]
    VD_motors = ["VD%s" % c for c in range_incl(1, 13)]
    AS_motors = ["AS%s" % c for c in range_incl(1, 11)]
    #'''
    motors = list(VA_motors + VB_motors + AS_motors + DA_motors + DB_motors +
                  VD_motors + DD_motors)

    inters = ['AVBL', 'AVBR', 'AVAL', 'AVAR']

    cells = list(motors + inters)

    muscles_to_include = True

    cells_to_stimulate = []

    cells_to_plot = cells
    reference = "c302_%s_FWandBW_with_muscles" % parameter_set

    conns_to_include = []
    conns_to_exclude = [
        'VB2-VB4_GJ',
        'VB4-VB2_GJ',

        #########################################
        # Remove unwanted interneuron connections
        #########################################

        # Disconnect the AVA and AVB interneurons
        r'^AVB.-AVA.$',
        r'^AVA.-AVB.$',
        r'^AVB.-AVA._GJ$',
        r'^AVA.-AVB._GJ$',

        # Disconnect chemical stimulation from AVA and AVB
        r'^AVB.-.A\d+$',
        r'^AVB.-.B\d+$',
        r'^AVB.-.D\d+$',
        r'^AVB.-AS\d+$',
        r'^AVA.-.A\d+$',
        r'^AVA.-.B\d+$',
        r'^AVA.-.D\d+$',
        r'^AVA.-AS\d+$',

        # Disconnect AVA and AVB gap junctions not pressent.
        r'^AVB.-.A\d+_GJ$',
        r'^AVB.-AS\d+_GJ$',
        r'^AVB.-.D\d+_GJ$',
        r'^AVA.-.B\d+_GJ$',
        r'^AVA.-AS\d+_GJ$',
        r'^AVA.-.D\d+_GJ$',

        # Disconnect feedback GJ into AVA and AVB.
        r'^..\d+-AV.._GJ$',

        #########################################################
        # Remove connections not present in Haspel and O'Donovan
        #########################################################

        #'''
        r'^AS\d+-.B\d+$',
        r'^AS\d+-VA\d+$',
        r'^AS\d+-DD\d+$',
        r'^AS\d+-..\d+_GJ$',
        r'^..\d+-AS\d+_GJ$',
        r'^DA\d+-AS\d+$',
        r'^DA\d+-DD\d+$',
        r'^DA\d+-VB\d+$',
        r'^DA\d+-VA\d+$',
        r'^DA\d+-AS\d+$',
        r'^DA\d+-.B\d+_GJ$',
        r'^DA\d+-.D\d+_GJ$',
        r'^.B\d+-DA\d+_GJ$',
        r'^.D\d+-DA\d+_GJ$',
        r'^DB\d+-.A\d+$',
        r'^DB\d+-VB\d+$',
        r'^DB\d+-.A\d+_GJ$',
        r'^DB\d+-.D\d+_GJ$',
        r'^DB\d+-VB\d+_GJ$',
        r'^.A\d+-DB\d+_GJ$',
        r'^.D\d+-DB\d+_GJ$',
        r'^VB\d+-DB\d+_GJ$',
        r'^DD\d+-..\d+$',
        r'^DD\d+-VD\d+_GJ$',
        r'^DD\d+-.B\d+_GJ$',
        r'^DD\d+-.A\d+_GJ$',
        r'^VD\d+-DD\d+_GJ$',
        r'^.B\d+-DD\d+_GJ$',
        r'^.A\d+-DD\d+_GJ$',
        r'^VD\d+-D.\d+$',
        r'^VD\d+-AS\d+$',
        r'^VD\d+-VB\d+_GJ$',
        r'^VB\d+-VD\d+_GJ$',
        r'^VB\d+-DB\d+$',
        r'^VB\d+-.A\d+$',
        r'^VB\d+-AS\d+$',
        r'^VB\d+-VD\d+$',
        r'^VB\d+-VA\d+_GJ$',
        r'^VA\d+-VB\d+_GJ$',
        r'^VA\d+-.B\d+$',
        r'^VA\d+-DA\d+$',
        r'^VA\d+-AS\d+$',

        ###############################################
        # Remove connections going forward in DA and VA
        ###############################################

        #Forward connections in DA-VA
        'DA3-DA4',
        'DA2-DA3',
        'VA2-VA3',
        'VA3-VA4',
        'VA5-VA6',
        'DA9-VA12',
        'VA12-DA8',
        'VA12-DA9',
        'VA1-DA2',

        #'''
    ]

    conn_polarity_override = {
        #### NEW CIRCUIT ####
        r'^VA\d+-VD\d+$': 'inh',
        r'^DA\d+-DD\d+$': 'inh',
        r'^AS\d+-DD\d+$': 'inh',
        r'^DB\d+-DD\d+$': 'inh',
        r'^AS\d+-VD\d+$': 'inh',
        #VD-DD, VD-VA and VD-VB are already inhibitory
    }
    conn_number_override = {
        '^.+-.+$': 1,
    }

    #*********
    # INPUTS
    #*********

    input_list = []
    sine_input_list = []
    ramp_input_list = []

    #*************************
    # Head Muscles STIMULATION
    #*************************

    #FORWARD

    amp = '4pA'
    dur = '250ms'
    total_time = 4000
    total_stim = np.floor(total_time / 800).astype(int)
    for stim_num in range(total_stim):
        for muscle_num in range(7):
            mdlx = 'MDL0%s' % (muscle_num + 1)
            mdrx = 'MDR0%s' % (muscle_num + 1)
            mvlx = 'MVL0%s' % (muscle_num + 1)
            mvrx = 'MVR0%s' % (muscle_num + 1)

            if muscle_num >= 9:
                mdlx = 'MDL%s' % (muscle_num + 1)
                mdrx = 'MDR%s' % (muscle_num + 1)
                mvlx = 'MVL%s' % (muscle_num + 1)
                mvrx = 'MVR%s' % (muscle_num + 1)

            startd = '%sms' % (stim_num * 800 + muscle_num * 30)
            startv = '%sms' % ((stim_num * 800 + 400) + muscle_num * 30)

            input_list.append((mdlx, startd, dur, amp))
            input_list.append((mdrx, startd, dur, amp))
            if muscle_num != 6:
                input_list.append((mvlx, startv, dur, amp))
                input_list.append((mvrx, startv, dur, amp))

    #BACKWARD

    start = 5000
    dur = '300ms'
    for stim_num in range(total_stim):
        count = 7
        for muscle_num in range(7):
            count = count - 1
            mdlx = 'MDL0%s' % (muscle_num + 1)
            mdrx = 'MDR0%s' % (muscle_num + 1)
            mvlx = 'MVL0%s' % (muscle_num + 1)
            mvrx = 'MVR0%s' % (muscle_num + 1)

            if muscle_num >= 9:
                mdlx = 'MDL%s' % (muscle_num + 1)
                mdrx = 'MDR%s' % (muscle_num + 1)
                mvlx = 'MVL%s' % (muscle_num + 1)
                mvrx = 'MVR%s' % (muscle_num + 1)

            startd = '%sms' % (start + 700 + 400 + stim_num * 800 + count * 30)
            startv = '%sms' % (start + 700 + stim_num * 800 + count * 30)

            input_list.append((mdlx, startd, dur, amp))
            input_list.append((mdrx, startd, dur, amp))
            if muscle_num != 6:
                input_list.append((mvlx, startv, dur, amp))
                input_list.append((mvrx, startv, dur, amp))

    #*************************
    # Interneuron STIMULATION
    #*************************
    #'''
    input_list.append(('AVBL', '0ms', '4000ms', '15pA'))
    input_list.append(('AVBR', '0ms', '4000ms', '15pA'))
    input_list.append(('AVAL', '5000ms', '4000ms', '15pA'))
    input_list.append(('AVAR', '5000ms', '4000ms', '15pA'))
    #'''

    #*************************
    # DB1 and VB1 STIMULATION
    #*************************

    # Sinusoidal Input
    #'''
    sine_input_list.append(('DB1', '0ms', '5000ms', '1.5pA', '800ms'))
    sine_input_list.append(('VB1', '0ms', '5000ms', '1.5pA', '800ms'))
    sine_input_list.append(('DA9', '5000ms', '5000ms', '-1.5pA', '800ms'))
    sine_input_list.append(('VA12', '5000ms', '5000ms', '1.5pA', '800ms'))

    config_param_overrides['input'] = input_list

    param_overrides = {
        'mirrored_elec_conn_params': {

            #Connections to DB1 and VB1 have a HIGHER conductance
            r'^AVB._to_.B1_GJ$_elec_syn_gbase': '0.005 nS',

            #Connections to rest of DB and VB have a LOWER conductance
            r'^AVB._to_.B[2-9]\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^AVB._to_.B[1-9][0-9]\_GJ$_elec_syn_gbase': '0.001 nS',

            #Connections to DA9 and VA12 have a HIGHER conductance
            r'^AVA._to_DA9_GJ$_elec_syn_gbase': '0.005 nS',
            r'^AVA._to_VA12_GJ$_elec_syn_gbase': '0.005 nS',

            #Connections to rest of DA and VA have LOWER conductance
            r'^AVA._to_DA[1-8]\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^AVA._to_VA[1-9][0-1]?\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^.B\d+_to_.B\d+\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^.A\d+_to_.A\d+\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^.D\d+_to_.D\d+\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^AS\d+_to_AS\d+\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^VA\d+_to_DA\d+\_GJ$_elec_syn_gbase': '0.001 nS',
            r'^VA\d+_to_VD\d+\_GJ$_elec_syn_gbase': '0.001 nS',
        },
        'initial_memb_pot': '-50 mV',

        ##### Adjustments ######
        r'^DA\d+_to_DB\d+$_exc_syn_conductance': '0.2 nS',
        r'^DB\d+_to_VD\d+$_exc_syn_conductance': '0.2 nS',

        #*********************************
        # Connections between units (chemical)
        #*********************************

        #Connect synaptically VB1 to VB2 and so on
        r'^VB\d+_to_VB\d+$_exc_syn_conductance': '30 nS',
        r'^VB\d+_to_VB\d+$_exc_syn_ar': '0.19 per_s',
        r'^VB\d+_to_VB\d+$_exc_syn_ad': '73 per_s',
        r'^VB\d+_to_VB\d+$_exc_syn_beta': '2.81 per_mV',
        r'^VB\d+_to_VB\d+$_exc_syn_vth': '-22 mV',
        r'^VB\d+_to_VB\d+$_exc_syn_erev': '10 mV',

        #Connect synaptically DB1 to DB2 and so on
        r'^DB\d+_to_DB\d+$_exc_syn_conductance': '30 nS',
        r'^DB\d+_to_DB\d+$_exc_syn_ar': '0.08 per_s',
        r'^DB\d+_to_DB\d+$_exc_syn_ad': '18 per_s',
        r'^DB\d+_to_DB\d+$_exc_syn_beta': '0.21 per_mV',
        r'^DB\d+_to_DB\d+$_exc_syn_vth': '-10 mV',
        r'^DB\d+_to_DB\d+$_exc_syn_erev': '10 mV',

        #'''
        #Connect synaptically VA1 to VA2 and so on
        r'^VA\d+_to_VA\d+$_exc_syn_conductance': '30 nS',
        r'^VA\d+_to_VA\d+$_exc_syn_ar': '0.19 per_s',
        r'^VA\d+_to_VA\d+$_exc_syn_ad': '73 per_s',
        r'^VA\d+_to_VA\d+$_exc_syn_beta': '2.81 per_mV',
        r'^VA\d+_to_VA\d+$_exc_syn_vth': '-22 mV',
        r'^VA\d+_to_VA\d+$_exc_syn_erev': '10 mV',

        #Connect synaptically DB1 to DB2 and so on
        r'^DA\d+_to_DA\d+$_exc_syn_conductance': '30 nS',
        r'^DA\d+_to_DA\d+$_exc_syn_ar': '0.08 per_s',
        r'^DA\d+_to_DA\d+$_exc_syn_ad': '18 per_s',
        r'^DA\d+_to_DA\d+$_exc_syn_beta': '0.21 per_mV',
        r'^DA\d+_to_DA\d+$_exc_syn_vth': '-10 mV',
        r'^DA\d+_to_DA\d+$_exc_syn_erev': '10 mV',
        #'''

        #Neuro - Muscular Junction Parameters
        'neuron_to_muscle_exc_syn_conductance': '0.5 nS',
        r'^DB\d+_to_MDL\d+$_exc_syn_conductance': '0.4 nS',
        r'^DB\d+_to_MDR\d+$_exc_syn_conductance': '0.4 nS',
        r'^VB\d+_to_MVL\d+$_exc_syn_conductance': '0.6 nS',
        r'^VB\d+_to_MVR\d+$_exc_syn_conductance': '0.6 nS',
        r'^DA\d+_to_MDL\d+$_exc_syn_conductance': '0.4 nS',
        r'^DA\d+_to_MDR\d+$_exc_syn_conductance': '0.4 nS',
        r'^VA\d+_to_MVL\d+$_exc_syn_conductance': '0.6 nS',
        r'^VA\d+_to_MVR\d+$_exc_syn_conductance': '0.6 nS',
        'neuron_to_muscle_exc_syn_vth': '37 mV',
        'neuron_to_muscle_inh_syn_conductance': '0.6 nS',
        #'neuron_to_neuron_inh_syn_conductance': '0.2 nS',
        'AVBR_to_MVL16_exc_syn_conductance': '0 nS',
        'ca_conc_decay_time_muscle': '60.8 ms',
        'ca_conc_rho_muscle': '0.002338919 mol_per_m_per_A_per_s',
    }

    nml_doc = None
    if generate:
        nml_doc = c302.generate(reference,
                                params,
                                cells=cells,
                                cells_to_plot=cells_to_plot,
                                cells_to_stimulate=cells_to_stimulate,
                                conns_to_include=conns_to_include,
                                conns_to_exclude=conns_to_exclude,
                                conn_polarity_override=conn_polarity_override,
                                conn_number_override=conn_number_override,
                                muscles_to_include=muscles_to_include,
                                duration=duration,
                                dt=dt,
                                target_directory=target_directory,
                                data_reader=data_reader,
                                param_overrides=param_overrides,
                                verbose=verbose)

        #if config_param_overrides.has_key('input'):
        #    input_list = config_param_overrides['input']

        for stim_input in input_list:
            cell, start, dur, current = stim_input
            c302.add_new_input(nml_doc, cell, start, dur, current, params)

        for sine_stim_input in sine_input_list:
            cell, delay, dur, amp, period = sine_stim_input
            c302.add_new_sinusoidal_input(nml_doc, cell, delay, dur, amp,
                                          period, params)

        for ramp_stim_input in ramp_input_list:
            cell, delay, dur, start_amp, finish_amp, base_amp = ramp_stim_input
            c302.add_new_ramp_input(nml_doc, cell, delay, dur, start_amp,
                                    finish_amp, base_amp, params)

        #c302.add_new_input(nml_doc, cell='VB1', delay="1200ms", duration="1000ms", amplitude="1pA", params=params)
        #c302.add_new_input(nml_doc, cell='VB1', delay="0ms", duration="2000ms", amplitude="1.5pA", params=params)

        nml_file = target_directory + '/' + reference + '.net.nml'
        writers.NeuroMLWriter.write(
            nml_doc, nml_file)  # Write over network file written above...

        c302.print_("(Re)written network file to: " + nml_file)

    return cells, cells_to_stimulate, params, muscles_to_include, nml_doc
Пример #5
0
def setup(
        parameter_set,
        generate=False,
        duration=10000,  # Change here the duration of the simulation in ms
        dt=0.05,  # Time step 
        target_directory='examples',
        data_reader="UpdatedSpreadsheetDataReader2",
        param_overrides={},
        verbose=True,
        config_param_overrides={}):

    # Import this from the defined parameters.
    exec('from parameters_%s import ParameterisedModel' % parameter_set,
         globals())
    params = ParameterisedModel()

    #*******************************************
    # 1. DEFINE THE ELEMENTS TO SIMULATE
    #*******************************************

    cells = []
    # Neurons to include in the simulation (e.g. cells = ['AVBL', 'DB1'])

    muscles_to_include = []
    # Muscles to include in the simulation (e.g. muscles_to_include = ['MDL07'], muscles = True for all the muscles)

    cells_to_stimulate = []
    # Neurons to stimulate
    # This is used to stimulate the neurons and muscles, I use a different method to stimulate however.

    cells_to_plot = cells
    # Neurons to include in the plot (e.g. cells_to_plot = ['DB1'])
    # If you do not want to plot all the neurons defined, change cells by the only neurons you want plotted.

    reference = "c302_%s_tutorial" % parameter_set
    # Reference for the subsequent generated NeuroML files
    # (Make sure this corresponds with the script name: c302_NAME.py --> reference = "c302_%s_NAME" % parameter_set)

    #*******************************************
    # 2. DEFINE THE NETWORK CONNECTIONS
    #*******************************************

    conns_to_include = []
    # Only connections to include
    # By default, c302 takes all the connections from the connectome.
    # If you only want some specific connections, specify them here.

    conns_to_exclude = [
        'DB1-DB2',  # Exclude the chemical synapse from DB1 to DB2
        'DB1-DB2_GJ',  # Exclude the gap junction from DB1 to DB2
        'DB2-DB1_GJ',
        # Note that gap junctions need to be excluded in both ways
        r'^AVB.-DB\d+$',  # Regular expression to exclude AVBR and AVBL synapses to DB1, DB2... DB7
    ]
    # Connections to exclude or 'ablate'
    # I included some examples of connections to be excluded.
    # Search on how to use Regular Expressions in python.

    conn_polarity_override = {
        r'^VB\d+-VB\d+$': 'inh',  #Change any VB# to VB# synapse to inhibitory
        r'^DD\d+-DD\d+$': 'exc',  #Change any DD# to DD# synapse to excitatory
    }
    # Change the polarity of chemical synapses
    # c302 takes as inhibitory those synapses coming from GABAergic neurons.

    conn_number_override = {
        '^.+-.+$': 1,
    }
    # Changed the number of synapses between neurons all to 1.

    #*******************************************
    # 3. ADD INPUTS TO NEURONS AND MUSCLES
    #*******************************************
    # (This is where I define the inputs, instead of using cells_to_stimulate)

    input_list = []  # Step current input
    sine_input_list = []  # Sinusoidal input
    ramp_input_list = []  # Ramp inputs are still under development

    input_list.append((neuron, start, duration, amplitude))
    # Add a step input to a neuron, at a given time, with a duration and intensity.
    # This can also be used to stimulate muscles!
    # (e.g. input_list.append(('AVBL', '0ms', '4000ms', '15pA')))

    sine_input_list.append((neuron, start, duration, peak_amplitude, period))
    # Add a step input to a neuron, at a given time, with a duration and intensity.
    # This can also be used to stimulate muscles!
    # (e.g. sine_input_list.append(('DB1', '0ms', '5000ms', '1.5pA', '800ms')) )

    config_param_overrides['input'] = input_list

    #*******************************************
    # 4. OVERRIDE CERTAIN PARAMETERS
    #*******************************************

    param_overrides = {

        # Symmetrical Gap junctions
        'mirrored_elec_conn_params': {

            #r'^AVB._to_AVB._GJ$_elec_syn_gbase': '0.001 nS',
        },

        # Change the initial membrane potential
        'initial_memb_pot': '-50 mV',

        # Here, any parameters found in the Parameters_#.py can be changed and specified for this specific simulation.
    }

    nml_doc = None

    # Create the NeuroML file of the network using c302 functions.
    if generate:
        nml_doc = c302.generate(reference,
                                params,
                                cells=cells,
                                cells_to_plot=cells_to_plot,
                                cells_to_stimulate=cells_to_stimulate,
                                conns_to_include=conns_to_include,
                                conns_to_exclude=conns_to_exclude,
                                conn_polarity_override=conn_polarity_override,
                                conn_number_override=conn_number_override,
                                muscles_to_include=muscles_to_include,
                                duration=duration,
                                dt=dt,
                                target_directory=target_directory,
                                data_reader=data_reader,
                                param_overrides=param_overrides,
                                verbose=verbose)

        for stim_input in input_list:
            cell, start, dur, current = stim_input
            c302.add_new_input(nml_doc, cell, start, dur, current, params)

        for sine_stim_input in sine_input_list:
            cell, delay, dur, amp, period = sine_stim_input
            c302.add_new_sinusoidal_input(nml_doc, cell, delay, dur, amp,
                                          period, params)

        for ramp_stim_input in ramp_input_list:
            cell, delay, dur, start_amp, finish_amp, base_amp = ramp_stim_input
            c302.add_new_ramp_input(nml_doc, cell, delay, dur, start_amp,
                                    finish_amp, base_amp, params)

        nml_file = target_directory + '/' + reference + '.net.nml'
        writers.NeuroMLWriter.write(
            nml_doc, nml_file)  # Write over network file written above...

        c302.print_("(Re)written network file to: " + nml_file)

    return cells, cells_to_stimulate, params, muscles_to_include, nml_doc