def IntFire1(cell_prop): """Loads a point integrate and fire neuron""" model_params = cell_prop.model_params hobj = h.IntFire1() hobj.tau = model_params['tau'] * 1000.0 # Convert from seconds to ms. hobj.refrac = model_params['refrac'] * 1000.0 # Convert from seconds to ms. return hobj
def IntFire1(cell, template_name, dynamics_params): """Loads a point integrate and fire neuron""" hobj = h.IntFire1() hobj.tau = dynamics_params['tau'] * 1000.0 # Convert from seconds to ms. hobj.refrac = dynamics_params[ 'refrac'] * 1000.0 # Convert from seconds to ms. return hobj
def IntFire1(cell_prop): """Set parameters for the IntFire1 cell models.""" params_file = cell_prop['params_file'] with open(params_file) as params_file: params = json.load(params_file) hobj = h.IntFire1() hobj.tau = params['tau'] * 1000.0 # Convert from seconds to ms. hobj.refrac = params['refrac'] * 1000.0 # Convert from seconds to ms. return hobj
def __init__(self): self.cell = h.IntFire1() self.cell.m = 0. self.recorder = h.NetCon(self.cell, None) self.spk = h.Vector() self.recorder.record(self.spk)
#Store temporary data in soma, axon, bd, ad = constructGeometry(x) Soma.append(soma) Axon.append(axon) BD.append(bd) AD.append(ad) #Set biophysics for the different neural structures. IAF will contain all data pertaining to the refractory period between spikes. IAF = [] counter = 0 for i in range(0, numNeurons): for sec in Axon[i]: sec.insert('hh') sec.nseg = numSegs IAF.append(h.IntFire1(0.5)) IAF[counter].tau = tau IAF[counter].refrac = refrac for seg in sec: seg.hh.gnabar = 0.25 seg.hh.gl = .0001666 seg.hh.el = -60.0 counter = counter + 1 for sec in BD[i]: sec.insert('pas') sec.nseg = numSegs IAF.append(h.IntFire1(0.5)) IAF[counter].tau = tau IAF[counter].refrac = refrac counter = counter + 1 for seg in sec:
from neuron import h, gui h.tstop = 100 h.load_file('netparmpi.hoc') ncell = 128 pnm = h.ParallelNetManager(ncell) pc = pnm.pc # try with multiple threads pnm.pc.nthread(32) pnm.round_robin() for i in range(ncell): if pnm.gid_exists(i): pnm.register_cell(i, h.IntFire1()) for i in range(ncell): pnm.nc_append(i, (i + 1) % ncell, -1, 1.1, 2) # stimulate if pnm.gid_exists(4): stim = h.NetStim(.5) ncstim = h.NetCon(stim, pnm.pc.gid2obj(4)) ncstim.weight[0] = 1.1 ncstim.delay = 1 stim.number = 1 stim.start = 1 pnm.set_maxstep(100) # will end up being 2
tempSectionName = "soma" + connections[i][9] print tempSectionName print soma8.name syn.append(h.ExpSyn(float(connections[i][8]), sec = tempSectionName)) """ syn1 = h.ExpSyn(0.5, sec=soma1) syn2 = h.ExpSyn(0.5, sec=soma2) syn3 = h.ExpSyn(0.5, sec=soma3) syn4 = h.ExpSyn(0.5, sec=soma4) syn5 = h.ExpSyn(0.5, sec=soma5) syn6 = h.ExpSyn(0.5, sec=soma6) syn7 = h.ExpSyn(0.5, sec=soma7) syn8 = h.ExpSyn(0.5, sec=soma8) syn9 = h.ExpSyn(0.5, sec=soma5) IAF = h.IntFire1(0.5, sec=soma1) IAF.tau = 10 IAF.refrac = 5 # connect the pre - synaptic section to the # synapse object soma2.push() nc1 = h.NetCon(soma2(0.5)._ref_v, syn1) nc1.weight[0] = 1.0 soma3.push() nc2 = h.NetCon(soma3(0.5)._ref_v, syn2) nc2.weight[0] = 1.0 soma4.push() nc3 = h.NetCon(soma4(0.5)._ref_v, syn3) nc3.weight[0] = 1.0
def runSimulation(numSegs, tau, refrac, simTime, numNeurons, path, current): """ This defintion will analyze a specific random network geometry and random connectivity type. """ print 'Run simulation!!' #Create lists for somas, axons, basal dendrites, and apical dendrites for each neuron in the network. Soma = [] Axon = [] Dend = [] #Begin creating neurons individually from the various geometrical files. for index in range(0, numNeurons): soma, axon, dend = constructGeometry(index, dendrites, connections, numNeurons) Soma.append(soma) Axon.append(axon) Dend.append(dend) #Set biophysics for the different neural structures. IAF will contain all data pertaining to the refractory period between spikes. IAF = [] counter = 0 for i in range(0, numNeurons): for sec in Dend[i]: sec.insert('pas') sec.nseg = numSegs IAF.append(h.IntFire1(0.5)) IAF[counter].tau = tau IAF[counter].refrac = refrac counter = counter + 1 for seg in sec: seg.pas.g = 0.0002 seg.pas.e = -65 for sec in Soma: sec.insert('hh') sec.nseg = numSegs IAF.append(h.IntFire1(0.5)) IAF[counter].tau = tau IAF[counter].refrac = refrac for seg in sec: seg.hh.gnabar = 0.25 seg.hh.gl = .0001666 seg.hh.el = -60.0 counter = counter + 1 for sec in Axon: sec.insert('hh') sec.nseg = numSegs IAF.append(h.IntFire1(0.5)) IAF[counter].tau = tau IAF[counter].refrac = refrac for seg in sec: seg.hh.gnabar = 0.25 seg.hh.gl = .0001666 seg.hh.el = -60.0 counter = counter + 1 #Import connectivity between neurons. synapses, networkConnections = constructConnections( connections, dendrites, numNeurons, Soma, Axon, Dend) #Create vectors for recording potentials, currents, etc in the neural network during the simulation. vec = recordData(numNeurons, Soma) #Stimulate system with random noise. stims = [] for i in range(0, numNeurons): #stim.append(h.IClamp(Soma[i](0.5) )) #stim[i].delay = 5 #stim[i].dur = 100 #stim[i].amp = 10 stims.append(makeStimulus(Soma[i], simTime)) # run the simulation h.load_file("stdrun.hoc") h.init() h.tstop = simTime h.run() #Save spiking data for visual representation. file = open(path + 'spikes' + str(current) + '.txt', "wb") print path + 'spikes' + str(current) + '.txt' for i in range(0, len(vec['t '])): for j in range(0, numNeurons + 1): for var in vec: if (var == str(j + 1)): file.write(str(vec[var][i]) + "\n") elif (j == numNeurons) & (var == 't '): file.write(str(vec['t '][i]) + "\n") file.close() #Destroy neuron sections. Dend = [] Axon = [] Soma = []