project.generatedNetworkConnections.addSynapticConnection('aEPSP_Vervaeke_pf',
							  0, 0, 0, 0.5, 0,
							  stim_seg_detailed,
							  0.5, 0, None)
# delete all existing probes
project.generatedPlotSaves.reset()

# set up voltage recording at the specified points along the dendrite being stimulated
project.generatedPlotSaves.addPlotSaveDetails('Golgi_reduced_v', project.simPlotInfo.getSimPlot('Golgi_reduced_v'), ArrayList([0]), ArrayList(rec_segs_reduced), False, False)
project.generatedPlotSaves.addPlotSaveDetails('Golgi_detailed_v', project.simPlotInfo.getSimPlot('Golgi_detailed_v'), ArrayList([0]), ArrayList(rec_segs_detailed), False, False)

# generate and compile neuron files
print "Generating NEURON scripts..."
simulator_seed = random.getrandbits(32)
project.neuronFileManager.generateTheNeuronFiles(sim_config, None, NeuronFileManager.RUN_HOC,simulator_seed)
compile_process = ProcessManager(project.neuronFileManager.getMainHocFile())
compile_success = compile_process.compileFileWithNeuron(0,0)
# simulate
if compile_success:
    print "Simulating: simulation reference " + sim_ref
    pm.doRunNeuron(sim_config)
    timefile_path = sim_path + '/time.dat'
    while not os.path.exists(timefile_path):
	time.sleep(0.1)

data_string = "Data reference " + sim_ref
for k,i in enumerate(rec_segs_detailed):
    data_string = data_string + " " + str(i) + " " + str(rec_dists_detailed[k])
print data_string

System.exit(0)