scidash / neuronunit

A package for data-driven validation of neuron and ion channel models using SciUnit
http://neuronunit.scidash.org
38 stars 24 forks source link

Tracking down the source of statement: 'Mechanisms already loaded from path: ... Aborting.' in NEURON runs #133

Open russelljjarvis opened 6 years ago

russelljjarvis commented 6 years ago

The statements:

Population RS_pop contains 1 instance(s) of component: RS of type: izhikevich2007Cell
Ignoring included LEMS file: Cells.xml
Ignoring included LEMS file: Networks.xml
Ignoring included LEMS file: Simulation.xml

Should only occur once, for model bootstrapping but they should not continuously occur as it is suggestive that the xml file is being continuously re-read from disk.

'Mechanisms already loaded from path: /home/jovyan/neuronunit/unit_test/NeuroML2. Aborting. may be intrinsic to NEURON runs, but it is not something I am familiar with. Previously I thought it had something to do with automation of jNeuroML template code, it should only probably run once for a bootstrap of a NeuroML model to a NEURON model in memory, but it probably should not occur every time a model is instanced or changed.

I suspect that the print statement might be the side effect of a brief disk read, but the code would probably execute faster if we can track it down, and get rid of it.

russelljjarvis commented 6 years ago

Actually I suspect the statement needs to be there.

rgerkin commented 6 years ago

My experience with this motivated lines 384-402 of backends.py. If the program was run from the same directory as the NEURON files, then the mechanisms would already have been loaded by NEURON, and so trying to load them again with self.load_mechanisms() would cause the error you mentioned. So in the lines I mentioned, I have self.load_mechnanisms() only called if the NEURON file didn't exist yet (so NEURON probably hadn't run yet, line 385) or if the directory of the NEURON model directory and the current directory are different (so NEURON wouldn't have automatically loaded it when nrniv was called, line 400).

As for the statements you mentioned at the very top, I agree that those probably shouldn't be run more than once per model, so we'll have to look into that.

russelljjarvis commented 6 years ago

The source of the statements is actually: https://github.com/scidash/neuronunit/blob/master/neuronunit/models/backends.py#L411

 more_attributes = pynml.read_lems_file(self.model.orig_lems_file_path)

It is a pynml file read, that happens on every run, because the cell_name and current source names defy convention. It might be faster if this occurs only once and it then updates variables in the file appropriately:

LEMS_2007One_nrn.py
rgerkin commented 6 years ago

@russelljjarvis Did this go away?

russelljjarvis commented 6 years ago

No, the statement is still present, for example:

Population RS_pop contains 1 instance(s) of component: RS of type: izhikevich2007Cell
Mechanisms already loaded from path: /home/jovyan/neuronunit/neuronunit/models/NeuroML2.  Aborting.

I pulled scidash:neuronunit -b dev last night.