How to use the netpyne.specs.SimConfig function in netpyne

To help you get started, we’ve selected a few netpyne examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Neurosim-lab / netpyne / examples / evolutionary / cfg.py View on Github external
from netpyne import specs

cfg = specs.SimConfig()

cfg.networkType = 'simple' # 'complex'

# --------------------------------------------------------
# Simple network
# --------------------------------------------------------
if cfg.networkType == 'simple':
	# Simulation options
	cfg.dt = 0.025
	cfg.duration = 2*1e3

	cfg.verbose = False
	cfg.saveJson = True
	cfg.filename = 'simple_net'
	cfg.saveDataInclude = ['simData']
	cfg.recordStep = 0.1
github Neurosim-lab / netpyne / examples / HHTut / HHTut.py View on Github external
"""
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 
github Neurosim-lab / netpyne / examples / HybridTut / HybridTut.py View on Github external
"""
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_HH'] = {'cellModel': 'HH', 'cellType': 'PYR', 'numCells': 50} # add dict with params for this pop 
netParams.popParams['PYR_Izhi'] = {'cellModel': 'Izhi', 'cellType': 'PYR', 'numCells': 50} # add dict with params for this pop 
github Neurosim-lab / netpyne / doc / source / code / tut6.py View on Github external
## Stimulation parameters
netParams.stimSourceParams['Input_1'] = {'type': 'IClamp', 'delay': 300, 'dur': 100, 'amp': 'uniform(0.4,0.5)'}
netParams.stimSourceParams['Input_2'] = {'type': 'VClamp', 'dur': [0,50,200], 'amp': [-60,-30,40], 'gain': 1e5, 'rstim': 1, 'tau1': 0.1, 'tau2': 0}
netParams.stimSourceParams['Input_3'] = {'type': 'AlphaSynapse', 'onset': 'uniform(300,600)', 'tau': 5, 'gmax': 'post_ynorm', 'e': 0}
netParams.stimSourceParams['Input_4'] = {'type': 'NetStim', 'interval': 'uniform(20,100)', 'start': 600, 'noise': 0.1}

netParams.stimTargetParams['Input_1->S'] = {'source': 'Input_1', 'sec':'soma', 'loc': 0.8, 'conds': {'popLabel':'S', 'cellList': range(15)}}
netParams.stimTargetParams['Input_2->S'] = {'source': 'Input_2', 'sec':'soma', 'loc': 0.5, 'conds': {'popLabel':'S', 'ynorm': [0,0.5]}}
netParams.stimTargetParams['Input_3->M1'] = {'source': 'Input_3', 'sec':'soma', 'loc': 0.2, 'conds': {'popLabel':'M', 'cellList': [2,4,5,8,10,15,19]}}
netParams.stimTargetParams['Input_4->PYR'] = {'source': 'Input_4', 'sec':'soma', 'loc': 0.5, 'weight': '0.1+gauss(0.2,0.05)','delay': 1,
                              'conds': {'cellType':'PYR', 'ynorm': [0.6,1.0]}}


# Simulation options
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.verbose = False           # Show detailed messages 
simConfig.recordTraces = {'V_soma':{'sec':'soma','loc':0.5,'var':'v'}}  # Dict with traces to record
simConfig.recordStep = 0.1          # Step size in ms to save data (eg. V traces, LFP, etc)
simConfig.filename = 'model_output'  # Set file output name
simConfig.savePickle = False        # Save params, network and sim output to pickle file

simConfig.analysis['plotRaster'] = True           # Plot a raster
simConfig.analysis['plotTraces'] = {'include': [('S',0), ('M',0)]}           # Plot recorded traces for this list of cells


# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
github Neurosim-lab / netpyne / examples / saving / cfg.py View on Github external
"""
cfg.py 

Example of saving different network components to file

cfg is an object containing a set of simulation configurations using a standardized structure

Contributors: salvadordura@gmail.com
"""

from netpyne import specs

cfg = specs.SimConfig()   # object of class SimConfig to store the simulation configuration

# -----------------------------------------------------------------------------
# SIMULATION PARAMETERS
# -----------------------------------------------------------------------------

# Simulation parameters
cfg.duration = 1*1e3 # Duration of the simulation, in ms
cfg.dt = 0.025 # Internal integration timestep to use
cfg.seeds = {'conn': 1, 'stim': 1, 'loc': 1} # Seeds for randomizers (connectivity, input stimulation and cell locations)
cfg.createNEURONObj = 1  # create HOC objects when instantiating network
cfg.createPyStruct = 1  # create Python structure (simulator-independent) when instantiating network
cfg.verbose = False  # show detailed messages 
cfg.saveCellSecs = False  # avoid saving detailed info about each cell's morphology and mechanisms

# Recording 
cfg.recordTraces = {'Vsoma':{'sec':'soma','loc':0.5,'var':'v'}}
github Neurosim-lab / netpyne / examples / saveLoadV1 / params.py View on Github external
'sec': 'basal',                                            # target all basal and somatic sections
    'density': 'uniform'}                                                 # distribute syns randomly 


## Stimulation parameters
netParams.stimSourceParams['Input1'] = {'type': 'NetStim', 'interval': 'uniform(10,50)', 'noise': 0.5}    # Input NetStim params 

netParams.stimTargetParams['Input1->all'] = {'source': 'Input1', 'conds': {'ynorm': [0,1]},       # Input source -> all cells
  'weight': 0.05,  'delay': 2, 'sec': 'all', 'synMech': 'AMPA', 'synsPerConn': 5}   # connection params


###############################################################################
# SIMULATION CONFIGURATION
###############################################################################

simConfig = specs.SimConfig()                       # object of class SimConfig to store simulation configuration

simConfig.verbose = 0                               # Show detailed messages 
simConfig.hParams['v_init'] = -90                   # Set v_init=-90
simConfig.createNEURONObj = 0                       # create HOC objects when instantiating network
simConfig.createPyStruct = True                     # create Python structure (simulator-independent) when instantiating network

# Saving
simConfig.filename = 'V1'                        # Set file output name
simConfig.saveDataInclude = ['netParams', 'net']    # data structures to save
simConfig.saveJson = True                           # Save params, network and sim output to pickle file
github Neurosim-lab / netpyne / netpyne / sim / setup.py View on Github external
def setSimCfg (cfg):
    from .. import sim

    if cfg and isinstance(cfg, specs.SimConfig):
        sim.cfg = cfg  # set
    elif cfg and isinstance(cfg, dict):
        sim.cfg = specs.SimConfig(cfg) # fill in with dict
    else:
        sim.cfg = specs.SimConfig()  # create new object

    if sim.cfg.simLabel and sim.cfg.saveFolder:
        sim.cfg.filename = sim.cfg.saveFolder+'/'+sim.cfg.simLabel

    if sim.cfg.duration > 0:
        sim.cfg.duration = float(sim.cfg.duration)
github MetaCell / NetPyNE-UI / netpyne_ui / netpyne_geppetto.py View on Github external
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())
github MetaCell / NetPyNE-UI / netpyne_ui / netpyne_geppetto.py View on Github external
sim.loadAll(args['jsonModelFolder'])
                    self.netParams = sim.net.params
                    self.simConfig = sim.cfg
                    remove(self.netParams.todict())
                    remove(self.simConfig.todict())
                else:
                    if args['loadNet']:
                        wake_up_geppetto = True
                        if self.doIhaveInstOrSimData()['haveInstance']: sim.clearAll()
                        sim.initialize()
                        sim.loadNet(args['jsonModelFolder'])

                    if args['loadSimData']: # TODO (https://github.com/Neurosim-lab/netpyne/issues/360)
                        wake_up_geppetto = True
                        if not self.doIhaveInstOrSimData()['haveInstance']: 
                            sim.create(specs.NetParams(), specs.SimConfig())
                            sim.net.defineCellShapes()
                            sim.gatherData(gatherLFP=False)
                        sim.loadSimData(args['jsonModelFolder'])
                        
                    if args['loadSimCfg']:
                        sim.loadSimCfg(args['jsonModelFolder'])
                        self.simConfig = sim.cfg
                        remove(self.simConfig.todict())
                        
                    if args['loadNetParams']:
                        if self.doIhaveInstOrSimData()['haveInstance']: sim.clearAll()
                        sim.loadNetParams(args['jsonModelFolder'])
                        self.netParams = sim.net.params
                        remove(self.netParams.todict())
                    
                if wake_up_geppetto: