Stimulating network using spike trains

Moderator: tom_morse

Post Reply
bll5z6
Posts: 12
Joined: Thu May 26, 2016 10:27 am

Stimulating network using spike trains

Post by bll5z6 » Wed Jun 07, 2017 11:49 am

Hello all,

I am using NetPyNe to convert some old hoc code to the standardized Python form which NetPyNe facilitates (great project!). I have a 500 cell model of the rodent central nucleus of the amygdala (Ce) which receives input from other nuclei in the amygdala. We model these inputs separately and then feed them into the Ce model as spike trains saved in text files.

My question is how does one provide these spike times as stimuli into the network? Your help is appreciated and thank you for developing this important project, I'll be spreading the word!

Ben

salvadord
Posts: 57
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord » Thu Jun 08, 2017 1:11 pm

Hi Ben,

Thanks for your kind comments and feedback. To provide a list of predefined spike times as stimuli to the network you can create a population of VecStim and provide the list of spk times directly, e.g.:

Code: Select all

netParams.popParams['bkg'] = {'cellModel': 'VecStim', 'numCells': 1, 'spkTimes': [1,10,20,30,40,50]} 
I just updated the documentation to provide more details and explain the different options available: http://neurosimlab.org/netpyne/referenc ... parameters

Your project sounds very interesting, please let us know if you have any more questions/comments!

Salva

bll5z6
Posts: 12
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 » Thu Jun 08, 2017 5:30 pm

Salva,

Thanks for the quick reply. I created the artificial cell but cannot seem to get the spikes to show up:

Code: Select all

from netpyne import specs, sim

netParams = specs.NetParams()

#Create artificial cell with spike times
netParams.popParams['bkg'] = {'cellModel' : 'VecStim', 'numCells': 5, 'spkTimes': [100, 200, 300, 400, 500]}

#Create cell type
netParams.popParams['S'] = {'cellType': 'PYR', 'numCells': 20, 'cellModel': 'HH'}

#Define cell characteristics
cellRule = {'conds': {'cellType': 'PYR'},  'secs': {}} 	# cell rule dict
cellRule['secs']['soma'] = {'geom': {}, 'mechs': {}}  											# soma params dict
cellRule['secs']['soma']['geom'] = {'diam': 18.8, 'L': 18.8, 'Ra': 123.0}  									# soma geometry
cellRule['secs']['soma']['mechs']['hh'] = {'gnabar': 0.12, 'gkbar': 0.036, 'gl': 0.003, 'el': -70}  		# soma hh mechanisms
cellRule['secs']['dend'] = {'geom': {}, 'topol': {}, 'mechs': {}}  								# dend params dict
cellRule['secs']['dend']['geom'] = {'diam': 5.0, 'L': 150.0, 'Ra': 150.0, 'cm': 1}							# dend geometry
cellRule['secs']['dend']['topol'] = {'parentSec': 'soma', 'parentX': 1.0, 'childX': 0}						# dend topology 
cellRule['secs']['dend']['mechs']['pas'] = {'g': 0.0000357, 'e': -70} 										# dend mechanisms
netParams.cellParams['PYRrule'] = cellRule
	
#Import synaptic mechanism
netParams.synMechParams['exc'] = {'mod': 'Exp2Syn', 'tau1': 0.1, 'tau2': 5.0, 'e': 0}

#Connect artificial cell to regular cells with 100% probability
netParams.connParams['bkg->S'] = {'preConds': {'popLabel': 'bkg'}, 
	'postConds': {'popLabel': 'S'},
	'probability': 1, 			# probability of connection
	'weight': 2, 			# synaptic weight 
	'delay': 5,					# transmission delay (ms) 
	'sec': 'adend',				# section to connect to
	'loc': 0.5,					# location of synapse
	'synMech': 'exc'}   		# target synaptic mechanism
	
#Simulate
simConfig = specs.SimConfig()		# object of class SimConfig to store simulation configuration

simConfig.duration = 1*1e3 			# Duration of the simulation, in ms
simConfig.dt = 0.025 				# Internal integration timestep to use
simConfig.recordStep = 0.25 			# Step size in ms to save data (eg. V traces, LFP, etc)

simConfig.analysis['plotRaster'] = True			# Plot a raster
simConfig.analysis['plot2Dnet']  = True          # plot 2D visualization of cell positions and connections

# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)    
   
import pylab; pylab.show()  # this line is only necessary in certain systems where figures appear empty
No spikes seem to get generated. Thank you in advance for your help!

Ben

salvadord
Posts: 57
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord » Fri Jun 09, 2017 9:58 pm

Sorry Ben, didn't realize that feature was in the development branch. I will release a new netpyne version (0.7.0) today, so you just have to upgrade to that one and it should work.

bll5z6
Posts: 12
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 » Mon Jun 12, 2017 10:50 am

No problem. So we updated to the new Netpyne version (0.7.0) and still the above code generates the message "No spikes available to plot raster". We looked through the source code a bit and it seems like it should work but we haven't had any luck. We will keep digging but any thoughts you have in the meantime are appreciated!

Ben

salvadord
Posts: 57
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord » Mon Jun 12, 2017 11:39 am

Works for me using your code, so please check that you are not accidentally using an older version (happens often). You can check the version via sys.version() and can check where the files are located using import netpyne; print netpyne.__file__

In theory, to upgrade you should just need to do pip install netpyne -U or git pull (from the repo, if you cloned via github). However, in some cases, and not sure exactly why, the system may keep using an older version. So you can first do pip uninstall netpyne and/or try to locate the files manually and remove them, and then install from scratch.

If you have the correct version but still doesn't work, let me know and we'll figure it out.

Hope this helps.

bll5z6
Posts: 12
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 » Mon Jun 12, 2017 1:55 pm

Thanks so much for the help. We tried on Windows, Ubuntu, and Mac to no avail. The cells get created and connected but still "No spikes available to plot raster".

salvadord
Posts: 57
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord » Mon Jun 12, 2017 2:03 pm

Aah I know what it can be! You need to have the vecevent.mod file which contains the VecStim mechanism compiled in the folder where you are running the sim. Sorry, in the next version I will modify netpyne so it gives a warning if the mod mechanism is not available.

bll5z6
Posts: 12
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 » Mon Jun 12, 2017 2:26 pm

That was it! Thank you so much for your help!

Post Reply