sim_refs = []

for gj_conn_type in ['2010', '2012']:
    sim_config_name = 'input_resistance_' + gj_conn_type + 'gap'
    sim_config = project.simConfigInfo.getSimConfig(sim_config_name)
    project.neuronSettings.setNoConsole()

    for trial in range(n_trials):
        # generate
        pm.doGenerate(sim_config_name, 1234)
        while pm.isGenerating():
            time.sleep(0.02)
        print('network generated')

        for amplitude in stim_amplitude_range:
            sim_ref = utils.ir_sim_ref(timestamp, gj_conn_type, amplitude,
                                       trial)
            sim_refs.append(sim_ref)
            sim_path = '../simulations/' + sim_ref
            project.simulationParameters.setReference(sim_ref)
            # set stim rate
            amplitude_in_nA = amplitude / 1000.
            for cell_type in ['Vervaeke', 'reduced']:
                stim = project.elecInputInfo.getStim('cclamp_network_' +
                                                     cell_type)
                stim.setAmp(NumberGenerator(amplitude_in_nA))
                project.elecInputInfo.updateStim(stim)
            # generate and compile neuron files
            print "Generating NEURON scripts..."
            project.neuronFileManager.setSuggestedRemoteRunTime(10)
            simulator_seed = random.getrandbits(32)
            project.neuronFileManager.generateTheNeuronFiles(
示例#2
0
dash_styles = [(4, 1.5), (None, None)]
n_trials = 1
averages = {}
sigmas = {}
lines = []

for gj_conn_type, dashes in zip(gj_conn_types, dash_styles):
    averages[gj_conn_type] = {}
    sigmas[gj_conn_type] = {}
    for cell_type, color in zip(cell_types, colors):
        averages[gj_conn_type][cell_type] = []
        sigmas[gj_conn_type][cell_type] = []
        for stim_level in stim_range:
            responses = []
            for trial in range(n_trials):
                sim_ref = utils.ir_sim_ref(timestamp, gj_conn_type, stim_level,
                                           trial)
                filename = '../simulations/{0}/Golgi_network_{1}_TTX_0.dat'.format(
                    sim_ref, cell_type)
                try:
                    responses.append(np.loadtxt(filename)[-1])
                except IOError:
                    print('Data file not found: {0}'.format(sim_ref))
            responses = np.array(responses)
            averages[gj_conn_type][cell_type].append(responses.mean())
            sigmas[gj_conn_type][cell_type].append(responses.std())
        baseline = averages[gj_conn_type][cell_type][4]
        averages[gj_conn_type][
            cell_type] = averages[gj_conn_type][cell_type] - baseline
        label = '{}, {} net'.format(cell_type, gj_conn_type)
        if n_trials > 1:
            ax.errorbar(stim_range,
for gj_conn_type in ['2010', '2012']:
    sim_config_name = 'input_resistance_' + gj_conn_type + 'gap'
    sim_config = project.simConfigInfo.getSimConfig(sim_config_name)
    project.neuronSettings.setNoConsole()

    for trial in range(n_trials):
	# generate
	pm.doGenerate(sim_config_name, 1234)
	while pm.isGenerating():
	    time.sleep(0.02)
	print('network generated')

	for amplitude in stim_amplitude_range:
	    sim_ref = utils.ir_sim_ref(timestamp,
				       gj_conn_type,
				       amplitude,
				       trial)
	    sim_refs.append(sim_ref)
	    sim_path = '../simulations/' + sim_ref
	    project.simulationParameters.setReference(sim_ref)
	    # set stim rate
	    amplitude_in_nA = amplitude/1000.
	    for cell_type in ['Vervaeke', 'reduced']:
		stim = project.elecInputInfo.getStim('cclamp_network_' + cell_type)
		stim.setAmp(NumberGenerator(amplitude_in_nA))
		project.elecInputInfo.updateStim(stim)
	    # generate and compile neuron files
	    print "Generating NEURON scripts..."
	    project.neuronFileManager.setSuggestedRemoteRunTime(10)
	    simulator_seed = random.getrandbits(32)
	    project.neuronFileManager.generateTheNeuronFiles(sim_config, None, NeuronFileManager.RUN_HOC,simulator_seed)