Exemple #1
0
def runSimulation(young_chem1_con1, young_elec1_con1, numNeurons, fileIndex, simTime, inhibInd, age, delay, stimInterval, con):
	"""
		This defintion will run the simulation.
	"""

	print 'Run simulation!!'
	
	# Load file to make model regular spiking excitory cells.
	h.load_file ("sPY_template")
	
	# Load file to make model fast spiking inhibitory cells.
	h.load_file ("sIN_template")

	#Create neurons in the networks.
	numSegs = 3
	Neurons = []
	for i in range(0, numNeurons):
		if i < inhibInd:
			neuron = h.sPY()
			Neurons.append(neuron)
		else:
			neuron = h.sIN()
			Neurons.append(neuron)

	#Import connectivity between neurons.
	gapsYoung = constructConnections1( young_elec1_con1, numNeurons, Neurons)
	synYoung,ncYoung = constructConnections2( young_chem1_con1, numNeurons, Neurons, inhibInd, delay )

	#Create vectors for recording potentials, currents, etc in the neural network during the simulation.
	vec = recordData( numNeurons, Neurons )

	#Stimulate system with random noise.
	stims = []
	for i in range(0,numNeurons):
		stims.append(makeStimulus(Neurons[i],simTime,int(stimInterval)))

	#Run the simulation.
	h.load_file("stdrun.hoc")
	h.init()
	h.tstop = simTime
	h.run()

	#Write results.
        file = open(path + 'spikes' + str(con) + '_' + str(age) + '_' + str(fileIndex) + '_' + str(stimInterval) + '.txt',"wb")

	print "Writing results to..."
	print file
	for j in range(0,numNeurons):
		canFire = 1
		var = str(j+1)
		for i in range(0,len(vec ['t '])):
			if (vec[var][i] > 0) & (canFire == 1):
				file.write(str(j+1)+"\n")
				file.write(str(vec['t '][i])+"\n")
				canFire = 0
			if (vec[var][i] < 0):
				canFire = 1
	file.close()
Exemple #2
0
def runSimulation(young_chem1_con1, young_elec1_con1, numNeurons, fileIndex, simTime, inhibInd, age, delay, stimInterval, con, strength):
	"""
		This defintion will run the simulation.
	"""

	print 'Run simulation!!'
	
	# Load file to make model regular spiking excitory cells.
	h.load_file ("sPY_template")
	
	# Load file to make model fast spiking inhibitory cells.
	h.load_file ("sIN_template")

	#Create neurons in the networks.
	numSegs = 3
	Neurons = []
	for i in range(0, numNeurons):
		if i < inhibInd:
			neuron = h.sPY()
			Neurons.append(neuron)
		else:
			neuron = h.sIN()
			Neurons.append(neuron)

	#Import connectivity between neurons.
	#gapsYoung = constructConnections1( young_elec1_con1, numNeurons, Neurons)
	synYoung,ncYoung = constructConnections2( young_chem1_con1, numNeurons, Neurons, inhibInd, delay, strength )

	#Create vectors for recording potentials, currents, etc in the neural network during the simulation.
	vec = recordData( numNeurons, Neurons )

	#Stimulate system with random noise.
	stims = []
	for i in range(0,numNeurons):
		stims.append(makeStimulus(Neurons[i],simTime,int(stimInterval)))

	#Run the simulation.
	h.load_file("stdrun.hoc")
	h.init()
	h.tstop = simTime
	h.run()
Exemple #3
0
#----------------------------------------------------------------------------
#  Create Cells
#----------------------------------------------------------------------------
print " "
print "<<==================================>>"
print "<<            CREATE CELLS          >>"
print "<<==================================>>"
print " "

h.load_file("sPY.tem")
#h.xopen("sPY.tem")      # read geometry file
PY = []  # create PY cells
PYVtrace = []
for i in range(ncorticalcells):
    cell = h.sPY()
    #cell.soma.v = randvolt.repick()
    PY.append(cell)

h.load_file("sIN.tem")
#h.xopen("sIN.tem")      # read geometry file
IN = []  # create IN cells
INVtrace = []
for i in range(ncorticalcells):
    cell = h.sIN()
    #cell.soma.v = randvolt.repick()
    IN.append(cell)

h.load_file("TC.tem")
#h.xopen("TC.tem")
TC = []  # create TC cells
from neuron import *
from nrn import *
from itertools import chain
from neuron import h
import random
import os
import time
import sys
import numpy
from pylab import *

# Try to make the excitory cell.
h.load_file("sPY_template")
exc = h.sPY()

# Try to make the excitory cell.
h.load_file("sIN_template")
inh = h.sIN()

# Stimulate the exc cell.
stimNc = h.NetStim()
stimNc.noise = 1
stimNc.start = 150
stimNc.number = 1
stimNc.interval = 1
syn = h.ExpSyn(0.5, sec=exc.soma[0])
nc = h.NetCon(stimNc, syn)
nc.weight[0] = 5
nc.record()
"""
# Stimulate the exc cell.