Ejemplo n.º 1
0
def run():
    # Folder that contains x86_64 folder
    NETPYNE_WORKDIR_PATH = "../../../"
    neuron.load_mechanisms(NETPYNE_WORKDIR_PATH)

    # read cfg and netParams from command line arguments if available; otherwise use default
    simConfig, netParams = sim.readCmdLineArgs(simConfigDefault="cfg.py",
                                               netParamsDefault="netParams.py")

    # Create network and run simulation
    sim.createSimulate(netParams=netParams, simConfig=simConfig)
    sim.saveData()
import time
from netpyne import sim  # import netpyne init module
from neuron import h

simConfig, netParams = sim.readCmdLineArgs('cfg.py', 'netParams.py')
sim.create(simConfig=simConfig, netParams=netParams)

seed = int(time.time() * 1e7) & 0xffffffff
rndm = sim.h.Random()
rndm.Random123(
    sim.rank, 0, 0
)  #initialize with seed as second argument to achieve different results for each run
for TCsoma in [
        x.secs.soma for x in sim.net.cells if x.tags['cellType'] == 'TC'
]:
    TCsoma.hObj.ghbar_iar = rndm.normal(17.5, 0.0008) * 1e-6
    TCsoma.pointps.kleak_0.hObj.gmax = rndm.normal(40, 0.003) * 1e-4

sim.simulate()
sim.analyze()
Ejemplo n.º 3
0
"""
init.py

Starting script to run NetPyNE-based model.

Usage:  python init.py  # Run simulation, optionally plot a raster

MPI usage:  mpiexec -n 4 nrniv -python -mpi init.py

Contributors: [email protected]
"""

from netpyne import sim

cfg, netParams = sim.readCmdLineArgs()					# read cfg and netParams from command line arguments
sim.createSimulateAnalyze(simConfig = cfg, netParams = netParams)
Ejemplo n.º 4
0
from netpyne import sim  # import netpyne init module
from neuron import h

simConfig, netParams = sim.readCmdLineArgs(
    simConfigDefault='cfg.py', netParamsDefault='netParams_SGGA_markov.py')

###############################################################################
# create, simulate, and analyse network
###############################################################################
sim.createSimulateAnalyze(netParams=netParams, simConfig=simConfig)

## Plot comparison to original
import json
import matplotlib.pyplot as plt

with open('./data/original/NaV_0.json', 'rb') as f:
    data = json.load(f)

plt.figure(figsize=(10, 6))
plt.plot(data['simData']['t'],
         data['simData']['V_soma']['cell_0'],
         label='V_soma_B_Na',
         linestyle='dotted')
plt.plot(sim.simData['t'],
         sim.simData['V_soma']['cell_0'],
         label='V_soma_Na1.3a',
         linewidth=2)
plt.xlabel('Time(ms)')
plt.ylabel('voltage (mV)')
plt.legend()
plt.savefig(simConfig.saveFolder + '/' + simConfig.simLabel)
Ejemplo n.º 5
0
"""
init.py

Usage:
    python init.py # Run simulation, optionally plot a raster

MPI usage:
    mpiexec -n 4 nrniv -python -mpi init.py

Contributors: [email protected]
"""

#import matplotlib; matplotlib.use('Agg')  # to avoid graphics error in servers
from netpyne import sim

cfg, netParams = sim.readCmdLineArgs()

sim.initialize(
    simConfig=cfg,
    netParams=netParams)  # create network object and set cfg and net params
sim.net.createPops()  # instantiate network populations
sim.net.createCells()  # instantiate network cells based on defined populations
sim.net.connectCells()  # create connections between cells based on params
sim.net.addStims()  # add network stimulation
sim.setupRecording()  # setup variables to record (spikes, V traces, etc)
# sim.runSim()                  # run parallel Neuron simulation
# sim.gatherData()              # gather spiking data and cell info from each node
sim.saveData()  # save params, cell info and sim output to file
#sim.analysis.plotData()       # plot spike raster etc

# connDict = {}
Ejemplo n.º 6
0
import matplotlib
matplotlib.use('Agg')
from netpyne import sim

# read cfg and netParams from command line arguments if available; otherwise use default
simConfig, netParams = sim.readCmdLineArgs(simConfigDefault='MSN_cfg.py',
                                           netParamsDefault='MSN_params.py')

# Create network and run simulation
sim.createSimulateAnalyze(netParams=netParams, simConfig=simConfig)
Ejemplo n.º 7
0
"""
init.py

Starting script to run NetPyNE-based model.

Usage:  python init.py  # Run simulation, optionally plot a raster

MPI usage:  mpiexec -n 4 nrniv -python -mpi init.py
"""

from netpyne import sim

cfg, netParams = sim.readCmdLineArgs(simConfigDefault='cfg.py',
                                     netParamsDefault='netParams.py')

# sim.createSimulateAnalyze(netParams, cfg)
#​
sim.initialize(
    simConfig=cfg,
    netParams=netParams)  # create network object and set cfg and net params
sim.net.createPops()  # instantiate network populations
sim.net.createCells()  # instantiate network cells based on defined populations
sim.net.connectCells()  # create connections between cells based on params
sim.net.addStims()  # add network stimulation
sim.setupRecording(
)  # setup variables to record for each cell (spikes, V traces, etc)
sim.runSim()  # run parallel Neuron simulation
sim.gatherData()  # gather spiking data and cell info from each node

# distributed saving (to avoid errors with large output data)
#sim.saveDataInNodes()
Ejemplo n.º 8
0
try:
    import batch_utils
except:
    sys.path.append(curpath)
    import batch_utils

try:
    from __main__ import cfg  # import SimConfig object with params from parent module
except:
    print("Couldn't import cfg from __main__")
    print("Attempting to import cfg from cfg.")
    try:
        from cfg import cfg  # if no simConfig in parent module, import directly from cfg module
    except:
        print("Couldn't import cfg from cfg")
        cfg, null = sim.readCmdLineArgs()

###############################################################################
#
# NETWORK PARAMETERS
#
###############################################################################

netParams = specs.NetParams(
)  # object of class NetParams to store the network parameters
netParams.defaultThreshold = -20.0

###############################################################################
# Cell parameters
###############################################################################
Ejemplo n.º 9
0
import sys

sys.path.append('/Applications/NEURON-7.6/nrn/lib/python')

from netpyne import sim

# read cfg and netParams from command line arguments if available; otherwise use default
simConfig, netParams = sim.readCmdLineArgs(
    simConfigDefault='tut8_cfg.py', netParamsDefault='tut8_netParams.py')

# Create network and run simulation
sim.createSimulateAnalyze(netParams=netParams, simConfig=simConfig)
Ejemplo n.º 10
0
A modularized framework to develop and run large-scale network simulations. 
Built solely in Python with MPI support. 

Usage:
    python init.py # Run simulation, optionally plot a raster

MPI usage:
    mpiexec -n 4 nrniv -python -mpi main.py

Contributors: [email protected]
"""

from netpyne import sim
from neuron import h,gui
cfg, netParams = sim.readCmdLineArgs(simConfigDefault= 'cfg.py', netParamsDefault= 'M1_detailed.py')
 #M1_cell originally, test change rn


sim.initialize(
    simConfig=cfg, 
    netParams=netParams)  # create network object and set cfg and net params
sim.net.createPops()                  # instantiate network populations
sim.net.createCells()                 # instantiate network cells based on defined populations
sim.net.connectCells()                # create connections between cells based on params
sim.setupRecording()              # setup variables to record for each cell (spikes, V traces, etc)
sim.runSim()                      # run parallel Neuron simulation  
sim.gatherData()                  # gather spiking data and cell info from each node
sim.saveData()                    # save params, cell info and sim output to file (pickle,mat,txt,etc)
sim.analysis.plotData()               # plot spike raster
Ejemplo n.º 11
0
A modularized framework to develop and run large-scale network simulations. 
Built solely in Python with MPI support. 

Usage:
    python init.py # Run simulation, optionally plot a raster

MPI usage:
    mpiexec -n 4 nrniv -python -mpi main.py

Contributors: [email protected]
"""

from netpyne import sim

cfg, _ = sim.readCmdLineArgs()
from M1_cell import netParams 


sim.initialize(
    simConfig=cfg, 
    netParams=netParams)  # create network object and set cfg and net params
sim.net.createPops()                  # instantiate network populations
sim.net.createCells()                 # instantiate network cells based on defined populations
sim.net.connectCells()                # create connections between cells based on params
sim.setupRecording()              # setup variables to record for each cell (spikes, V traces, etc)
sim.runSim()                      # run parallel Neuron simulation  
sim.gatherData()                  # gather spiking data and cell info from each node
sim.saveData()                    # save params, cell info and sim output to file (pickle,mat,txt,etc)
sim.analysis.plotData()               # plot spike raster
Ejemplo n.º 12
0
from netpyne import sim

cfg, netParams = sim.readCmdLineArgs(
    simConfigDefault='saving_int_cfg.py', 
    netParamsDefault='saving_netParams.py')
sim.initialize(simConfig=cfg, netParams=netParams)
sim.net.createPops()
sim.net.createCells()
sim.net.connectCells()
sim.net.addStims()
sim.setupRecording()
#sim.runSim()
##### new #####
sim.runSimIntervalSaving(1000)
##### end new #####
sim.gatherData()
sim.saveData()
sim.analysis.plotData()
Ejemplo n.º 13
0
# init.py - Starting script to run NetPyNE-based model.
# Usage:  python init.py  # Run simulation, optionally plot a raster
# MPI usage:  mpiexec -n 4 nrniv -python -mpi init.py

from netpyne import sim
cfg, netParams = sim.readCmdLineArgs(
    'cfg.py',
    'netParams.py')  # read cfg and netParams from command line arguments
sim.createSimulateAnalyze(simConfig=cfg, netParams=netParams)
Ejemplo n.º 14
0
from netpyne import sim
from Forage import *
from utility import *
import random
import statistics
import numpy
import mat4py
import os
'''
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
'''

# read cfg and netParams from command line arguments if available; otherwise use default
simConfig, netParams = sim.readCmdLineArgs(simConfigDefault='config.py',
                                           netParamsDefault='network.py')

# Create network and run simulation
sim.create(simConfig=simConfig, netParams=netParams)

# Initialisation
sim.updateInterval = cfg.epochPeriod
sim.excOutWeights = []  # Store weight changes here
sim.inhOutWeights = []  # Store inhibitory neuron weights here
#sim.excOutWeightsStats = {} # Store stats about weights here
sim.performances = []  # Store post-epoch performance here
sim.outputFrequencies = []  # Store output cell firing frequencies here

# Choose indices of weights to store as this data is too large. Choose evenly spaced indices
# including first and last of size ~sqrt(numEpochs)
weight_indices = numpy.round(
Ejemplo n.º 15
0
"""
init.py

Usage:
    python init.py # Run simulation, optionally plot a raster

MPI usage:
    mpiexec -n 4 nrniv -python -mpi init.py

Contributors: [email protected]
"""

#import matplotlib; matplotlib.use('Agg')  # to avoid graphics error in servers
from netpyne import sim

simConfig, netParams = sim.readCmdLineArgs()
#sim.createSimulateAnalyze()

sim.initialize(
    simConfig=simConfig,
    netParams=netParams)  # create network object and set cfg and net params
sim.net.createPops()  # instantiate network populations
sim.net.createCells()  # instantiate network cells based on defined populations
sim.net.connectCells()  # create connections between cells based on params
sim.net.addStims()  # add network stimulation
sim.setupRecording(
)  # setup variables to record for each cell (spikes, V traces, etc)
sim.runSim()  # run parallel Neuron simulation
sim.gatherData()  # gather spiking data and cell info from each node
sim.saveData(
)  # save params, cell info and sim output to file (pickle,mat,txt,etc)#
Ejemplo n.º 16
0
'''this is the code for the DHN model involved with mechanical pain network
created by K. Sekiguchi (25thMay20)
'''
from netpyne import sim
from neuron import h

simConfig, netParams = sim.readCmdLineArgs(
    simConfigDefault='cfg_mechanical_GA.py',
    netParamsDefault='netParams_mechanical_GA.py')

# Create network and run simulation
# sim.createSimulate(netParams = netParams, simConfig = simConfig)
sim.createSimulateAnalyze(netParams=netParams, simConfig=simConfig)