Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from netpyne import specs, sim
# Network parameters
netParams = specs.NetParams() # object of class NetParams to store the network parameters
netParams.sizeX = 100 # x-dimension (horizontal length) size in um
netParams.sizeY = 1000 # y-dimension (vertical height or cortical depth) size in um
netParams.sizeZ = 100 # z-dimension (horizontal length) size in um
netParams.propVelocity = 100.0 # propagation velocity (um/ms)
netParams.probLengthConst = 150.0 # length constant for conn probability (um)
## Population parameters
netParams.popParams['E2'] = {'cellType': 'E', 'numCells': 50, 'yRange': [100,300], 'cellModel': 'HH'}
netParams.popParams['I2'] = {'cellType': 'I', 'numCells': 50, 'yRange': [100,300], 'cellModel': 'HH'}
netParams.popParams['E4'] = {'cellType': 'E', 'numCells': 50, 'yRange': [300,600], 'cellModel': 'HH'}
netParams.popParams['I4'] = {'cellType': 'I', 'numCells': 50, 'yRange': [300,600], 'cellModel': 'HH'}
netParams.popParams['E5'] = {'cellType': 'E', 'numCells': 50, 'ynormRange': [0.6,1.0], 'cellModel': 'HH'}
netParams.popParams['I5'] = {'cellType': 'I', 'numCells': 50, 'ynormRange': [0.6,1.0], 'cellModel': 'HH'}
def __init__(self):
self.model_interpreter = NetPyNEModelInterpreter()
self.client = None
self.netParams = specs.NetParams()
self.simConfig = specs.SimConfig()
synchronization.startSynchronization(self.__dict__)
logging.debug("Initializing the original model")
jupyter_geppetto.context = {'netpyne_geppetto': self}
"""
netParams.py
High-level specifications for M1 network model using NetPyNE
Contributors: salvadordura@gmail.com
"""
from netpyne import specs
import pickle, json
netParams = specs.NetParams() # object of class NetParams to store the network parameters
netParams.version = 49
try:
from __main__ import cfg # import SimConfig object with params from parent module
except:
from cfg import cfg
#------------------------------------------------------------------------------
#
# NETWORK PARAMETERS
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# General connectivity parameters
# execfile('hopbrodnetpyne.py')
# notebook: ~/nrniv/notebooks/nbnetpyne.dol
from netpyne import specs, sim
netParams = specs.NetParams() # object of class NetParams to store the network parameters
simConfig = specs.SimConfig() # object of class SimConfig to store the simulation configuration
# Network and connections
netParams.addPopParams('hop', {'cellType': 'PYR', 'cellModel': 'HH', 'numCells': 1})
netParams.addConnParams('hop->hop', {'preConds': {'pop': 'hop'}, 'postConds': {'pop': 'hop'}, 'weight': 0.0, 'synMech': 'inh', 'delay': 5})
netParams.addStimSourceParams('bg', {'type': 'IClamp', 'delay': 10, 'dur': int(1000), 'amp': 0.5})
# cells
netParams.addCellParams('hh_PYR',
{'conds': {'cellType': 'PYR'}, # could have complex rule here for eg PYR cells in certain loc with particular implementation
'secs': {'soma': {'geom' : {'diam': 5, 'L': 5}, 'vinit' : -70.6,
'mechs': {'hh' : {'gnabar': 0.10, 'gkbar': 0.036, 'gl': 0.003, 'el': -70}}}}})
netParams.addSynMechParams('exc', {'mod': 'Exp2Syn', 'tau2': 1.0, 'e': 0})
netParams.addSynMechParams('inh', {'mod': 'Exp2Syn', 'tau2': 1.0, 'e': -80})
netParams.addStimTargetParams('bg->hop', {'source': 'bg', 'sec':'soma', 'loc': 0.5, 'conds': {'pop':'hop'}})
def setNetParams (params):
from .. import sim
if params and isinstance(params, specs.NetParams):
paramsDict = utils.replaceKeys(params.todict(), 'popLabel', 'pop') # for backward compatibility
sim.net.params = specs.NetParams(paramsDict) # convert back to NetParams obj
elif params and isinstance(params, dict):
params = utils.replaceKeys(params, 'popLabel', 'pop') # for backward compatibility
sim.net.params = specs.NetParams(params)
else:
sim.net.params = specs.NetParams()
def deleteModel(self, modelParams):
try:
with redirect_stdout(sys.__stdout__):
self.netParams = specs.NetParams()
self.simConfig = specs.SimConfig()
self.netParams.todict()
self.netParams.todict()
if self.doIhaveInstOrSimData()['haveInstance']: sim.clearAll()
self.geppetto_model = None
return utils.getJSONReply()
except:
return utils.getJSONError("Error while exporting the NetPyNE model", sys.exc_info())
"""
params.py
netParams is a dict containing a set of network parameters using a standardized structure
simConfig is a dict containing a set of simulation configurations using a standardized structure
Contributors: salvadordura@gmail.com
"""
from netpyne import specs
netParams = specs.NetParams() # object of class NetParams to store the network parameters
simConfig = specs.SimConfig() # object of class SimConfig to store the simulation configuration
###############################################################################
#
# MPI HH TUTORIAL PARAMS
#
###############################################################################
###############################################################################
# NETWORK PARAMETERS
###############################################################################
# Population parameters
netParams.popParams['PYR'] = {'cellModel': 'HH', 'cellType': 'PYR', 'numCells': 200} # add dict with params for this pop
def importNeuroML2(fileName, simConfig, simulate=True, analyze=True):
from .. import sim
netParams = specs.NetParams()
import pprint
pp = pprint.PrettyPrinter(indent=4)
print("Importing NeuroML 2 network from: %s"%fileName)
nmlHandler = None
verbose = False
if fileName.endswith(".nml"):
import logging
logging.basicConfig(level=logging.WARNING, format="%(name)-19s %(levelname)-5s - %(message)s")
from neuroml.hdf5.NeuroMLXMLParser import NeuroMLXMLParser