Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
simConfig.recordStep = 0.1 # Step size in ms to save data (eg. V traces, LFP, etc)
simConfig.filename = 'model3' # Set file output name
simConfig.saveJson = True
simConfig.seeds['conn'] = 4321
simConfig.hParams = {'celsius': 34, 'v_init': -80}
simConfig.printPopAvgRates = [0, simConfig.duration]
simConfig.analysis['plotRaster'] = True # Plot a raster
simConfig.analysis['plotTraces'] = {'include': [0]} # Plot recorded traces for this list of cells
#simConfig.analysis['plot2Dnet'] = True # plot 2D visualization of cell positions and connections
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
Usage:
python init.py # Run simulation, optionally plot a raster
MPI usage:
mpiexec -n 4 nrniv -python -mpi init.py
Contributors: salvadordura@gmail.com
"""
import matplotlib; matplotlib.use('Agg') # to avoid graphics error in servers
from netpyne import sim
from cfg import cfg
from netParams import netParams
sim.createSimulateAnalyze(netParams, cfg)
Usage:
python init.py # Run simulation, optionally plot a raster
MPI usage:
mpiexec -n 4 nrniv -python -mpi init.py
Contributors: salvadordura@gmail.com
"""
#import matplotlib; matplotlib.use('Agg') # to avoid graphics error in servers
from netpyne import sim
from cfg import cfg
from netParams import netParams
sim.createSimulateAnalyze(netParams, cfg) #SimulateAnalyze(netParams, cfg)
# check model output
sim.checkOutput('PTcell')
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 = 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': [1]} # Plot recorded traces for this list of cells
simConfig.analysis['plot2Dnet'] = True # plot 2D visualization of cell positions and connections
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
import pylab; pylab.show() # this line is only necessary in certain systems where figures appear empty
simConfig.dt = 0.025 # Internal integration timestep to use
simConfig.verbose = False # Show detailed messages
simConfig.recordCells = [('E2',0), ('E4', 0), ('E5', 5)]
simConfig.recordTraces = {'V_soma':{'sec':'soma','loc':0.5,'var':'v'}} # Dict with traces to record
simConfig.recordStep = 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.saveMat = False # Save params, network and sim output to pickle file
#simConfig.analysis['plotRaster'] = {'orderBy': 'y', 'orderInverse': True} # Plot a raster
#simConfig.analysis['plotTraces'] = {'include': [('E2',0), ('E4', 0), ('E5', 5)]} # Plot recorded traces for this list of cells
#simConfig.analysis['plot2Dnet'] = True # plot 2D visualization of cell positions and connections
#simConfig.analysis['plotConn'] = True # plot connectivity matrix
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
from matplotlib import pyplot as plt
pops = ['E2', 'I2', 'E4', 'I4', 'E5', 'I5']
# fig 5A
sim.analysis.plotConn(includePre=pops, includePost=pops, fontSize=20)
h=plt.axes()
h.xaxis.set_label_coords(0.5, 1.10)
plt.title ('Connection strength matrix', y=1.12)
plt.savefig('paper_fig5A.png')
# fig 5B
sim.analysis.plotConn(includePre=pops, includePost=pops, fontSize=20, feature='convergence', graphType='bar')
plt.title ('Connection convergence stacked bar graph', y=1.08)
plt.tight_layout()
import HHTut # import parameters file
from netpyne import sim # import netpyne sim module
sim.createSimulateAnalyze(netParams = HHTut.netParams, simConfig = HHTut.simConfig) # create and simulate network
import pylab
pylab.show()
# Simulation configuration
simConfig = specs.SimConfig() # object of class SimConfig to store simulation configuration
simConfig.duration = 3.0*1e3 # Duration of the simulation, in ms
simConfig.dt = 0.1 # Internal integration timestep to use
simConfig.verbose = False # Show detailed messages
simConfig.recordStep = 1 # Step size in ms to save data (eg. V traces, LFP, etc)
simConfig.filename = 'net_lfp' # Set file output name
simConfig.recordLFP = [[-15, y, 1.0*netParams.sizeZ] for y in range(int(netParams.sizeY/5.0), int(netParams.sizeY), int(netParams.sizeY/5.0))]
simConfig.analysis['plotRaster'] = {'orderBy': 'y', 'orderInverse': True, 'saveFig':True, 'figSize': (9,3)} # Plot a raster
simConfig.analysis['plotLFP'] = {'includeAxon': False, 'figSize': (6,10), 'NFFT': 256, 'noverlap': 48, 'nperseg': 64, 'saveFig': True}
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
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 = 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': [1]} # Plot recorded traces for this list of cells
simConfig.analysis['plot2Dnet'] = True # plot 2D visualization of cell positions and connections
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
# import pylab; pylab.show() # this line is only necessary in certain systems where figures appear empty
# check model output
sim.checkOutput('tut4')
# 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 = 0 # Show detailed messages
simConfig.recordTraces = {'V_soma':{'sec':'soma','loc':0.5,'var':'v'}} # Dict with traces to record
simConfig.recordStep = 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'] = {'orderInverse': True, 'saveFig': 'tut_import_raster.png'} # Plot a raster
simConfig.analysis['plotTraces'] = {'include': [0]} # Plot recorded traces for this list of cells
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
# import pylab; pylab.show() # this line is only necessary in certain systems where figures appear empty
# check model output
sim.checkOutput('tut_import')
"""
init.py
Example of saving different network components to file
Contributors: salvadordura@gmail.com
"""
from netpyne import sim
from netParams import netParams
from cfg import cfg
sim.createSimulateAnalyze(netParams, cfg)
# Saving different network components to file
sim.cfg.saveJson = True
# save network params (rules)
sim.saveData(include=['netParams'], filename='out_netParams')
# save network instance
sim.saveData(include=['net'], filename='out_netInstance')
# save network params and instance together
sim.saveData(include=['netParams', 'net'], filename='out_netParams_netInstance')
# save sim config
sim.saveData(include=['simConfig'], filename='out_simConfig')