Skip to content

Commit

Permalink
Merge pull request #211 from Neurosim-lab/development
Browse files Browse the repository at this point in the history
PR from development to master - VERSION 0.6.9
  • Loading branch information
salvadord authored Apr 12, 2017
2 parents 7728c30 + 43d83f1 commit 3fb77d1
Show file tree
Hide file tree
Showing 17 changed files with 1,007 additions and 269 deletions.
40 changes: 40 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Version 0.6.9

- Improved support for NeuroML export

- Added option to skip batch job based on custom existing job filename (eg. 'skipCustom': '.run')

- Added option to specify netParams .py file for batch

- Modified hpc_torque batch to accept nodes and ppn

- New option to import cell with sections not inside an object

- plotShape now shows real diameters in interviews by default

- Added option to set threshold when loading weightNorm

- Added support for conditions on recordTraces

- Fixed bug plotting NetStims (created as stims) in raster, spikeHist and ratePSD

- Fixed bug in plotConn bar graphs

- Fixed bug: missing hRandom for NetStim populations

- Fixed bug: use Random123() instead of netstim.noiseFromRandom for NetStim stims

- Fixed bug: VectStim spike generation now reproducible for different durations

- Fixed bug in batch grouped params

- Fixed bug: getCellsList() only checked for tuples but when load from json converted to list

- Fixed bug so cell treshold is set by default to sim.net.defaultThreshold

- Fixed bug plotting overlayed spikeHist over raster plot

- Fixed bug in plotShape when includeAxon=False



# Version 0.6.8

- Keep track of last host after distributing cells of each pop (improves load balance) (issues #41 #196)
Expand Down
12 changes: 10 additions & 2 deletions examples/HHTut/HHTut.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@
###############################################################################

# Population parameters
netParams.popParams['PYR'] = {'cellModel': 'HH', 'cellType': 'PYR', 'numCells': 100} # add dict with params for this pop
netParams.popParams['PYR'] = {'cellModel': 'HH', 'cellType': 'PYR', 'numCells': 100, 'yRange': [300, 500], 'color': 'red'} # add dict with params for this pop
netParams.popParams['PYR'] = {'cellModel': 'NetStim', 'cellType': 'PYR2', 'numCells': 100} # add dict with params for this pop


# Cell parameters
## PYR cell properties
cellRule = {'conds': {'cellModel': 'HH', 'cellType': 'PYR'}, 'secs': {}} # cell rule dict
cellRule = {'conds': {'cellModel': 'HH', 'cellType': 'PYT'}, '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 mechanism
cellRule['secs']['soma']['vinit'] = -71
netParams.cellParams['PYR'] = cellRule # add dict to list of cell params

cellRule = {'conds': {'color': 'red'}, '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 mechanism
Expand Down
67 changes: 63 additions & 4 deletions examples/NeuroMLImport/poissonFiringSyn.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ NEURON {
RANGE syn0_g : exposure

RANGE syn0_i : exposure

: Based on netstim.mod
THREADSAFE : only true if every instance has its own distinct Random
POINTER donotuse
}

UNITS {
Expand Down Expand Up @@ -70,7 +72,7 @@ ASSIGNED {
rate_tsince (ms/ms)
rate_syn0_A (/ms)
rate_syn0_B (/ms)

donotuse
}

STATE {
Expand Down Expand Up @@ -164,10 +166,67 @@ PROCEDURE rates() {
}


: Returns a float between 0 and max
: Returns a float between 0 and max; implementation of random() as used in LEMS
FUNCTION random_float(max) {

random_float = scop_random()*max
: This is not ideal, getting an exponential dist random number and then turning back to uniform
: However this is the easiest what to ensure mod files with random methods fit into NEURON's
: internal framework for managing internal number generation.
random_float = exp(-1*erand())*max

}

:****************************************************
: Methods copied from netstim.mod in NEURON source


PROCEDURE seed(x) {
set_seed(x)
}

VERBATIM
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
ENDVERBATIM


FUNCTION erand() {
VERBATIM
if (_p_donotuse) {
/*
:Supports separate independent but reproducible streams for
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.negexp(1)
*/
_lerand = nrn_random_pick(_p_donotuse);
}else{
/* only can be used in main thread */
if (_nt != nrn_threads) {
hoc_execerror("multithread random in NetStim"," only via hoc Random");
}
ENDVERBATIM
: the old standby. Cannot use if reproducible parallel sim
: independent of nhost or which host this instance is on
: is desired, since each instance on this cpu draws from
: the same stream
erand = exprand(1)
VERBATIM
}
ENDVERBATIM
}

PROCEDURE noiseFromRandom() {
VERBATIM
{
void** pv = (void**)(&_p_donotuse);
if (ifarg(1)) {
*pv = nrn_random_arg(1);
}else{
*pv = (void*)0;
}
}
ENDVERBATIM
}

: End of methods copied from netstim.mod in NEURON source:****************************************************

91 changes: 53 additions & 38 deletions examples/sandbox/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,27 @@
simConfig = specs.SimConfig() # dictionary to store sets of simulation configurations


###############################################################################
# SIMULATION PARAMETERS
###############################################################################

# Simulation parameters
simConfig.duration = 1.0*1e3 # Duration of the simulation, in ms
simConfig.dt = 0.1 # Internal integration timestep to use
simConfig.createNEURONObj = 1 # create HOC objects when instantiating network
simConfig.createPyStruct = 1 # create Python structure (simulator-independent) when instantiating network
simConfig.verbose = 0 #False # show detailed messages

# Recording
simConfig.recordCells = [('PYR1',5), 8]
simConfig.recordTraces = {'Vsoma':{'sec':'soma','loc':0.5,'var':'v'}}

# # Analysis and plotting
#simConfig.analysis['plotRaster'] = {'figSize': (20,8)} #True
#simConfig.analysis['plot2Dnet'] = True



###############################################################################
# NETWORK PARAMETERS
###############################################################################
Expand All @@ -38,9 +59,10 @@


# Population parameters
netParams.popParams['PYR1'] = {'cellModel': 'HH', 'cellType': 'PYR', 'gridSpacing': 10, 'xRange': [30,60]} # pop of HH cells
netParams.popParams['PYR2'] = {'cellModel': 'HH', 'cellType': 'PYR', 'gridSpacing': 5, 'yRange': [20,40]} # pop of HH cells
#netParams.popParams['artifVec'] = {'cellModel': 'VecStim', 'numCells': 10000, 'interval': 100, 'noise': 0.5, 'start': 50} # pop of NetStims
netParams.popParams['PYR1'] = {'cellModel': 'HH', 'cellType': 'PYR', 'numCells': 100} # 'gridSpacing': 10, 'xRange': [30,60]} # pop of HH cells
netParams.popParams['PYR2'] = {'cellModel': 'HH', 'cellType': 'PYR', 'numCells': 100} # 'gridSpacing': 5, 'yRange': [20,40]} # pop of HH cells
#netParams.popParams['artifVec'] = {'cellModel': 'VecStim', 'numCells': 1, 'interval': 100, 'noise': 0.5, 'start': 50,
# 'pulses':[{'start': 1000, 'end': 1400, 'rate': 100, 'noise': 0.5}]} # pop of NetStims
# netParams.popParams['artif1'] = {'cellModel': 'VecStim', 'numCells': 100, 'rate': [0,5], 'noise': 1.0, 'start': 50}#,
# 'pulses': [{'start': 200, 'end': 300, 'rate': 50, 'noise':0.2}, {'start': 500, 'end': 800, 'rate': 30, 'noise':0.5}]} # pop of NetStims

Expand All @@ -49,8 +71,8 @@


# Stimulation parameters
# netParams.stimSourceParams['background'] = {'type': 'NetStim', 'interval': 100, 'number': 1e5, 'start': 500, 'noise': 0.5} # stim using NetStims after 500ms
# netParams.stimTargetParams['bkg->PYR1'] = {'source': 'background', 'conds': {'popLabel': 'PYR1'}, 'sec':'soma', 'loc': 0.5, 'weight': 0.5, 'delay': 1}
netParams.stimSourceParams['background'] = {'type': 'NetStim', 'interval': 20, 'number': 1e5, 'start': 500, 'noise': 0.5} # stim using NetStims after 500ms
netParams.stimTargetParams['bkg->PYR1'] = {'source': 'background', 'conds': {'popLabel': 'PYR1'}, 'sec':'soma', 'loc': 0.5, 'weight': 0.5, 'delay': 1}


# Cell parameters
Expand All @@ -63,53 +85,46 @@


# Connections
netParams.connParams['artif1->PYR1'] = {
'preConds': {'popLabel': 'artif1'}, 'postConds': {'popLabel': 'PYR1'},
'convergence': 4,
'weight': 0.005,
'synMech': 'AMPA',
'delay': 'uniform(1,5)',
'synsPerConn': 1}

netParams.connParams['PYR2->PYR1'] = {
'preConds': {'popLabel': 'PYR2'}, 'postConds': {'popLabel': 'PYR1'},
# netParams.connParams['artif1->PYR1'] = {
# 'preConds': {'popLabel': 'artif1'}, 'postConds': {'popLabel': 'PYR1'},
# 'convergence': 4,
# 'weight': 0.005,
# 'synMech': 'AMPA',
# 'delay': 'uniform(1,5)',
# 'synsPerConn': 1}

netParams.connParams['PYR1->PYR2_1'] = {
'preConds': {'popLabel': 'PYR1'}, 'postConds': {'popLabel': 'PYR2'},
'probability': 0.1,
'weight': 0.2,
'delay': 'uniform(1,5)',
'synsPerConn': 1}

netParams.addConnParams('artif1->PYR2',
{'preConds': {'popLabel': 'artif1'}, 'postConds': {'popLabel': 'PYR2'},
'divergence': 3,
'weight': 0.05,
'delay': 3,
'synsPerConn': 1})


###############################################################################
# SIMULATION PARAMETERS
###############################################################################

# Simulation parameters
simConfig.duration = 0.1*1e3 # Duration of the simulation, in ms
simConfig.dt = 0.1 # Internal integration timestep to use
simConfig.createNEURONObj = 1 # create HOC objects when instantiating network
simConfig.createPyStruct = 1 # create Python structure (simulator-independent) when instantiating network
simConfig.verbose = 0 #False # show detailed messages
netParams.connParams['PYR1->PYR2_2'] = {
'preConds': {'popLabel': 'PYR1'}, 'postConds': {'popLabel': 'PYR2'},
'probability': 0.1,
'weight': 0.4,
'delay': 'uniform(1,5)',
'synsPerConn': 1}

# Recording
simConfig.recordTraces = {'Vsoma':{'sec':'soma','loc':0.5,'var':'v'}}
# netParams.addConnParams('artif1->PYR2',
# {'preConds': {'popLabel': 'artif1'}, 'postConds': {'popLabel': 'PYR2'},
# 'divergence': 3,
# 'weight': 0.05,
# 'delay': 3,
# 'synsPerConn': 1})

# # Analysis and plotting
simConfig.analysis['plotRaster'] = True
simConfig.analysis['plot2Dnet'] = True


###############################################################################
# RUN SIM
###############################################################################
simConfig.analysis['plotRaster'] = {'saveFig': True, 'showFig':True, 'labels': 'overlay', 'popRates': True,
'orderInverse': True, 'figSize': (12,10), 'lw': 0.6, 'marker': '|'}

sim.createSimulateAnalyze()


#sim.create()
#sim.gatherData()

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.8'
__version__ = '0.6.9'
__gui__ = True # global option to enable/disable graphics
Loading

0 comments on commit 3fb77d1

Please sign in to comment.