Stimulating network using spike trains

A Python package that facilitates development and use of models of biological neural networks

Moderator: tom_morse

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

Stimulating network using spike trains

Post by bll5z6 »

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: 86
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord »

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: 29
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 »

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: 86
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord »

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: 29
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 »

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: 86
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord »

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: 29
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 »

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: 86
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord »

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: 29
Joined: Thu May 26, 2016 10:27 am

Re: Stimulating network using spike trains

Post by bll5z6 »

That was it! Thank you so much for your help!
asb
Posts: 20
Joined: Mon Apr 25, 2016 5:25 am

Re: Stimulating network using spike trains

Post by asb »

Hi Salvador,

I have just started using netpyne and have a question about network stimulation. Apologies if this is obvious or tackled elsewhere.

To get started I want to create a network of I&F neurons which all receive independent random (poisson) external stimuli. I'm trying to find the most efficient way to achieve this in netpyne. I don't think 'stimSourceParams' works with point processes (I receive the error: addstim not supported). Therefore, for a population of N neurons the 3 options I can think of are:

1) Create N netstim objects and specify 1-to-1 connections to each neuron

2) Create 1 netstim object, connect to all N neurons, with random synaptic delays (although this may introduce input correlations)

3) Implement the I&F neuron within a compartment and use 'stimSourceParams'. However, I'm unsure if it's possible to create independent stimuli using this approach.

Do have any recommendations for the best (efficient) approach for large population simulations?

Thanks in advance
salvadord
Posts: 86
Joined: Tue Aug 18, 2015 3:49 pm

Re: Stimulating network using spike trains

Post by salvadord »

Hi, sorry for the delay. We plan to add support so you can add stims to point processes. In the meantime, you are quite right that those are the main possible approaches:

1) This is the one we've used in the past; you can see an example here: https://github.com/ceciliaromaro/PD_in_ ... ms.py#L159

2) Agree that it might result in correlations.

3) This should work ok too, and stimSourceParams / stimTargetParams will create independent stimuli (NetStims) for each target cell. You can see an example of implementing the Izhikevich I&F within a compartment here: http://www.netpyne.org/advanced.html#import-izhi07b

If you already solved the issue, please let us know what approach you followed. Thanks
Salva

ps. I usually monitor the Google groups forum more closely: www.netpyne.org/forum
asb
Posts: 20
Joined: Mon Apr 25, 2016 5:25 am

Re: Stimulating network using spike trains

Post by asb »

Hi Salvador, thanks for your reply. I ended up using option 3 with single compartment models which works perfectly. It also seems more efficient than option 1.

Thanks for letting me know about the google group - I'll post here in future.
Post Reply