Skip to content

Commit

Permalink
Merge pull request #174 from Neurosim-lab/development
Browse files Browse the repository at this point in the history
PR from development to master - VERSION 0.6.2
  • Loading branch information
salvadord authored Oct 27, 2016
2 parents 6b54825 + eb67d46 commit 66dd113
Show file tree
Hide file tree
Showing 13 changed files with 295 additions and 118 deletions.
32 changes: 32 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# Version 0.6.2

- Added importing of cell ion parameters (eg. 'ena' or 'ek')

- Added backupCfgFile (eg. ['cfg.py', 'backupcfg/']) to simConfig to copy cfg file after run

- Added gatherOnlySimData to simConfig to gather only simulation data and not cells or pops

- Added simLabel and saveFolder to simConfig (can be used instead of filename)

- Added printRunTime to simConfig to print run time (in sec) during execution

- Added printPopAvgRates to simConfig to print population avg firing rates after run

- Automatic saving of netpyne and netParams version to file

- Moved creation of fih functions to set cell vinit from setupRecording() to preRun()

- Can now load netParams and simConfig from file without setting in sim

- Added sim.readCmdLineArgs to read simConfig and netParams filepaths from command line

- Can now access NEURON's h module via sim.h

- Fixed bug so can load netParams and simConfig without initializing sim

- Fixed bug that prevented mechanism properties with value 0.0 from being set

- Fixed bug in code to distribute cells (converted numCells from float to int)

- Fixe bug in plotTraces

# Version 0.6.1

- Added global boolean variable netpyne.__gui__ to enable/disable graphics (issue #150)
Expand Down
15 changes: 14 additions & 1 deletion doc/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ Each item of the ``cellParams`` ordered dict consists of a key and a value. The
* **mechs**: Dictionary of density/distributed mechanisms.
The key contains the name of the mechanism (e.g. ``hh`` or ``pas``)
The value contains a dictionary with the properties of the mechanism (e.g. ``{'g': 0.003, 'e': -70}``).

* **ions**: Dictionary of ions.
The key contains the name of the ion (e.g. ``na`` or ``na``)
The value contains a dictionary with the properties of the ion (e.g. ``{'e': -70}``).

* **pointps**: Dictionary of point processes (excluding synaptic mechanisms).
The key contains an arbitrary label (e.g. 'Izhi')
Expand Down Expand Up @@ -631,9 +635,16 @@ Related to the simulation and netpyne framework:
* **duration** - Duration of the simulation, in ms (default: 1000)
* **dt** - Internal integration timestep to use (default: 0.025)
* **hParams** - Dictionary with parameters of h module (default: {'celsius': 6.3, 'clamp_resist': 0.001})
* **cache_efficient** - Use CVode cache_efficient option to optimize load when running on many cores (default: False)
* **seeds** - Dictionary with random seeds for connectivity, input stimulation, and cell locations (default: {'conn': 1, 'stim': 1, 'loc': 1})
* **createNEURONObj** - Create HOC objects when instantiating network (default: True)
* **createPyStruct** - Create Python structure (simulator-independent) when instantiating network (default: True)
* **printRunTime** - Print run time at interval (in sec) specified here (eg. 0.1) (default: False)
* **printPopAvgRates** - Print population avg firing rates after run (default: False)
* **includeParamsLabel** - Include label of param rule that created that cell, conn or stim (default: True)
* **timing** - Show and record timing of each process (default: True)
* **saveTiming** - Save timing data to pickle file (default: False)
* **verbose** - Show detailed messages (default: False)
Related to recording:
Expand All @@ -646,6 +657,8 @@ Related to recording:
Related to file saving:
* **saveDataInclude** = Data structures to save to file (default: ['netParams', 'netCells', 'netPops', 'simConfig', 'simData'])
* **simLabel** = Name of simulation (used as filename if none provided) (default: '')
* **saveFolder** = Path where to save output data (default: '')
* **filename** - Name of file to save model output (default: 'model_output')
* **timestampFilename** - Add timestamp to filename to avoid overwriting (default: False)
* **savePickle** - Save data to pickle file (default: False)
Expand All @@ -654,6 +667,7 @@ Related to file saving:
* **saveTxt** - Save data to txt file (default: False)
* **saveDpk** - Save data to .dpk pickled file (default: False)
* **saveHDF5** - Save data to save to HDF5 file (default: False)
* **backupCfgFile** - Copy cfg file to folder, eg. ['cfg.py', 'backupcfg/'] (default: [])
.. _sim_config_analysis:
Expand All @@ -672,7 +686,6 @@ Related to plotting and analysis:
Availble analysis functions include ``plotRaster``, ``plotSpikeHist``, ``plotTraces``, ``plotConn`` and ``plot2Dnet``. A full description of each function and its arguments is available here: :ref:`analysis_functions`.
.. _package_functions:
Package functions
Expand Down
1 change: 0 additions & 1 deletion examples/HHTut/HHTut.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
simConfig.saveFileStep = 1000 # step size in ms to save data to disk
simConfig.savePickle = False # Whether or not to write spikes etc. to a .mat file


# Analysis and plotting
simConfig.analysis['plotRaster'] = True # Plot raster
simConfig.analysis['plotTraces'] = {'include': [2]} # Plot raster
Expand Down
2 changes: 1 addition & 1 deletion examples/RL_arm/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
simConfig.saveFileStep = 1000 # step size in ms to save data to disk
simConfig.savePickle = False # Whether or not to write spikes etc. to a .mat file
simConfig.saveJson = False # Whether or not to write spikes etc. to a .mat file
simConfig.saveMat = False # Whether or not to write spikes etc. to a .mat file
simConfig.saveMat = True # Whether or not to write spikes etc. to a .mat file
simConfig.saveTxt = False # save spikes and conn to txt file
simConfig.saveDpk = False # save to a .dpk pickled file

Expand Down
2 changes: 1 addition & 1 deletion netpyne/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

__version__ = '0.6.1'
__version__ = '0.6.2'
__gui__ = True # global option to enable/disable graphics
4 changes: 2 additions & 2 deletions netpyne/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def plotTraces (include = None, timeRange = None, overlay = False, oneFigPer = '
# Plot one fig per trace for given cell list
def plotFigPerTrace(subGids):
for itrace, trace in enumerate(tracesList):
figs.append(figure()) # Open a new figure
figs['_trace_'+str(trace)] = figure() # Open a new figure
fontsiz = 12
for igid, gid in enumerate(subGids):
if 'cell_'+str(gid) in sim.allSimData[trace]:
Expand Down Expand Up @@ -698,7 +698,7 @@ def plotConn (include = ['all'], feature = 'strength', orderBy = 'gid', figSize

print('Plotting connectivity matrix...')

cells, cellGids, netStimPops = getCellsInclude(include)
cells, cellGids, netStimPops = getCellsInclude(include)

# Create plot
fig = figure(figsize=figSize)
Expand Down
10 changes: 5 additions & 5 deletions netpyne/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def createNEURONObj (self, prop):
for iseg,seg in enumerate(sec['hSec']): # set mech params for each segment
if type(mechParamValue) in [list]:
mechParamValueFinal = mechParamValue[iseg]
if mechParamValueFinal: # avoid setting None values
if mechParamValueFinal is not None: # avoid setting None values
seg.__getattribute__(mechName).__setattr__(mechParamName,mechParamValueFinal)

# add ions
Expand Down Expand Up @@ -367,16 +367,16 @@ def addSynMech (self, synLabel, secLabel, loc):
for synParamName,synParamValue in synMechParams.iteritems(): # add params of the synaptic mechanism
if synParamName not in ['label', 'mod', 'selfNetCon', 'loc']:
setattr(synMech['hSyn'], synParamName, synParamValue)
elif synParamName == 'selfNetCon': # create self netcon required for some synapses (eg. homeostatic)
elif synParamName == 'selfNetcon': # create self netcon required for some synapses (eg. homeostatic)
secLabelNetCon = synParamValue.get('sec', 'soma')
locNetCon = synParamValue.get('loc', 0.5)
secNetCon = self.secs.get(secLabelNetCon, None)
synMech['hNetCon'] = h.NetCon(secNetCon['hSec'](locNetCon)._ref_v, synMech['hSyn'], sec=secNetCon['hSec'])
synMech['hNetcon'] = h.NetCon(secNetCon['hSec'](locNetCon)._ref_v, synMech['hSyn'], sec=secNetCon['hSec'])
for paramName,paramValue in synParamValue.iteritems():
if paramName == 'weight':
synMech['hNetCon'].weight[0] = paramValue
synMech['hNetcon'].weight[0] = paramValue
elif paramName not in ['sec', 'loc']:
setattr(synMech['hNetCon'], paramName, paramValue)
setattr(synMech['hNetcon'], paramName, paramValue)
return synMech


Expand Down
10 changes: 5 additions & 5 deletions netpyne/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def _connStrToFunc (self, preCellsTags, postCellsTags, connParam):
###############################################################################
def fullConn (self, preCellsTags, postCellsTags, connParam):
''' Generates connections between all pre and post-syn cells '''
if sim.cfg.verbose: print 'Generating set of all-to-all connections...'
if sim.cfg.verbose: print 'Generating set of all-to-all connections (rule: %s) ...' % (connParam['label'])

# get list of params that have a lambda function
paramsStrFunc = [param for param in [p+'Func' for p in self.connStringFuncParams] if param in connParam]
Expand All @@ -509,7 +509,7 @@ def fullConn (self, preCellsTags, postCellsTags, connParam):
###############################################################################
def probConn (self, preCellsTags, postCellsTags, connParam):
''' Generates connections between all pre and post-syn cells based on probability values'''
if sim.cfg.verbose: print 'Generating set of probabilistic connections...'
if sim.cfg.verbose: print 'Generating set of probabilistic connections (rule: %s) ...' % (connParam['label'])

seed(sim.id32('%d'%(sim.cfg.seeds['conn']+preCellsTags.keys()[-1]+postCellsTags.keys()[-1])))
allRands = {(preGid,postGid): random() for preGid in preCellsTags for postGid in postCellsTags} # Create an array of random numbers for checking each connection
Expand Down Expand Up @@ -539,7 +539,7 @@ def probConn (self, preCellsTags, postCellsTags, connParam):
###############################################################################
def convConn (self, preCellsTags, postCellsTags, connParam):
''' Generates connections between all pre and post-syn cells based on probability values'''
if sim.cfg.verbose: print 'Generating set of convergent connections...'
if sim.cfg.verbose: print 'Generating set of convergent connections (rule: %s) ...' % (connParam['label'])

# get list of params that have a lambda function
paramsStrFunc = [param for param in [p+'Func' for p in self.connStringFuncParams] if param in connParam]
Expand Down Expand Up @@ -568,7 +568,7 @@ def convConn (self, preCellsTags, postCellsTags, connParam):
###############################################################################
def divConn (self, preCellsTags, postCellsTags, connParam):
''' Generates connections between all pre and post-syn cells based on probability values'''
if sim.cfg.verbose: print 'Generating set of divergent connections...'
if sim.cfg.verbose: print 'Generating set of divergent connections (rule: %s) ...' % (connParam['label'])

# get list of params that have a lambda function
paramsStrFunc = [param for param in [p+'Func' for p in self.connStringFuncParams] if param in connParam]
Expand Down Expand Up @@ -596,7 +596,7 @@ def divConn (self, preCellsTags, postCellsTags, connParam):
###############################################################################
def fromListConn (self, preCellsTags, postCellsTags, connParam):
''' Generates connections between all pre and post-syn cells based list of relative cell ids'''
if sim.cfg.verbose: print 'Generating set of connections from list...'
if sim.cfg.verbose: print 'Generating set of connections from list (rule: %s) ...' % (connParam['label'])

# list of params that can have a lambda function
paramsStrFunc = [param for param in [p+'Func' for p in self.connStringFuncParams] if param in connParam]
Expand Down
2 changes: 1 addition & 1 deletion netpyne/pop.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def createCellsFixedNum (self):
maxv = self.tags[coord+'normRange'][1]
randLocs[:,icoord] = randLocs[:,icoord] * (maxv-minv) + minv

for i in xrange(int(sim.rank), sim.net.params.scale * self.tags['numCells'], sim.nhosts):
for i in xrange(int(sim.rank), int(sim.net.params.scale * self.tags['numCells']), sim.nhosts):
gid = sim.net.lastGid+i
self.cellGids.append(gid) # add gid list of cells belonging to this population - not needed?
cellTags = {k: v for (k, v) in self.tags.iteritems() if k in sim.net.params.popTagsCopiedToCells} # copy all pop tags to cell tags, except those that are pop-specific
Expand Down
1 change: 1 addition & 0 deletions netpyne/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
from cell import Cell, PointNeuron
from pop import Pop
import utils
from neuron import h

Loading

0 comments on commit 66dd113

Please sign in to comment.