suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
148 stars 138 forks source link

Loading for a point neuron with a ‘rate’ parameter is not properly implemented #607

Closed dhasegan closed 1 year ago

dhasegan commented 3 years ago

Describe the bug

@salvadord said: "[loading] should be as simple as sim.load(json_file) but it seems that loading and instantiating this particular component (a point neuron with a ‘rate’ parameter) is not properly implemented… might be due to some recent changes … can you please add an issue to github and we will check it out… if possible include code or link repo to reproduce the error, thanks"

The code is in NathanKlineInstitute github so might be private: https://github.com/NathanKlineInstitute/netpyne-STDP/pull/3

Reproducing the bug

The simplified code:

from netpyne import specs, sim
sim.initialize()
data_file = 'data/21may_NetPyNE_project_sim.json'
sim.load(data_file)
simConfig = sim.loadSimCfg(data_file, setLoaded=False)
netParams = sim.loadNetParams(data_file, setLoaded=False)
sim.createSimulateAnalyze()

Setup those mod files:intf7.mod, nsloc.mod, stdp.mod Download this file and rename to .json: 21may_NetPyNE_project_sim.json.txt

Selected Error:

~/workspace/netpyne-project/venv/lib/python3.7/site-packages/netpyne/sim/wrappers.py in create(netParams, simConfig, output)
     48     sim.initialize(netParams, simConfig)  # create network object and set cfg and net params
     49     pops = sim.net.createPops()                  # instantiate network populations
---> 50     cells = sim.net.createCells()                 # instantiate network cells based on defined populations
     51     conns = sim.net.connectCells()                # create connections between cells based on params
     52     stims = sim.net.addStims()                    # add external stimulation to cells (IClamps etc)
....

~/workspace/netpyne-project/venv/lib/python3.7/site-packages/netpyne/cell/pointCell.py in __init__(self, gid, tags, create, associateGid)
     60 
     61         if create and sim.cfg.createNEURONObj:
---> 62             self.createNEURONObj()  # create cell
     63         if associateGid: self.associateGid() # register cell for this node
     64 

~/workspace/netpyne-project/venv/lib/python3.7/site-packages/netpyne/cell/pointCell.py in createNEURONObj(self)
     83 
     84         # if rate is list with 2 items generate random value from uniform
---> 85         if 'rate' in self.params and isinstance(self.params['rate'], list) and len(self.params['rate']) == 2:
     86             rand = h.Random()
     87             rand.Random123(sim.hashStr('point_rate'), self.gid, sim.cfg.seeds['stim']) # initialize randomizer

Expected behavior

No error and successful loading

System information

vvbragin commented 1 year ago

https://github.com/suny-downstate-medical-center/netpyne/pull/778