NeuroML / pyNeuroML

A single package in Python unifying scripts and modules for reading, writing, simulating and analysing NeuroML2/LEMS models.
https://docs.neuroml.org/Userdocs/Software/pyNeuroML.html
GNU Lesser General Public License v3.0
36 stars 30 forks source link

pyNeuroML 0.5.19 breaks simulation with Brian2 #161

Closed jonrkarr closed 2 years ago

jonrkarr commented 2 years ago

Example

from pyneuroml import pynml
pynml.run_lems_with_jneuroml_brian2('Hodgkin-Huxley-cell-Euler/model.xml', nogui=True)

Error

pyNeuroML >>> INFO - Loading LEMS file: ../Biosimulators_test_suite/examples/neuroml-lems/Hodgkin-Huxley-cell-Euler/model.xml and running with jNeuroML_Brian2
pyNeuroML >>> INFO - Executing: (java -Xmx400M  -jar  "/home/jonrkarr/.local/lib/python3.9/site-packages/pyneuroml/lib/jNeuroML-0.11.1-jar-with-dependencies.jar"  "../Biosimulators_test_suite/examples/neuroml-lems/Hodgkin-Huxley-cell-Euler/model.xml"  -brian2) in directory: .
pyNeuroML >>> INFO - Command completed. Output: 
  jNeuroML >>   jNeuroML v0.11.1
  jNeuroML >>  (INFO) Reading from: /home/jonrkarr/Documents/Biosimulators_pyNeuroML/../Biosimulators_test_suite/examples/neuroml-lems/Hodgkin-Huxley-cell-Euler/model.xml
  jNeuroML >>  (WARNING) No attribute 'LEN' set in component: Component(id=0 type=segment) at: org.lemsml.jlems.core.flatten.ComponentFlattener.importFlattened(ComponentFlattener.java:197)
  jNeuroML >>  (WARNING) No attribute 'radius' set in component: Component(id=null type=proximal) at: 
  jNeuroML >>  (WARNING) No attribute 'xLength' set in component: Component(id=null type=proximal) at: 
  jNeuroML >>  (WARNING) No attribute 'yLength' set in component: Component(id=null type=proximal) at: 
  jNeuroML >>  (WARNING) No attribute 'zLength' set in component: Component(id=null type=proximal) at: 
  jNeuroML >>  (WARNING) No attribute 'MICRON' set in component: Component(id=null type=proximal) at: 
  jNeuroML >>  (WARNING) No attribute 'radius' set in component: Component(id=null type=distal) at: 
  jNeuroML >>  (WARNING) No attribute 'xLength' set in component: Component(id=null type=distal) at: 
  jNeuroML >>  (WARNING) No attribute 'yLength' set in component: Component(id=null type=distal) at: 
  jNeuroML >>  (WARNING) No attribute 'zLength' set in component: Component(id=null type=distal) at: 
  jNeuroML >>  (WARNING) No attribute 'MICRON' set in component: Component(id=null type=distal) at: 
  jNeuroML >>  (WARNING) No attribute 'vShift' set in component: Component(id=leak type=channelDensity) at: 
  jNeuroML >>  (INFO) Adding component type: ComponentType, name=cell_flat
  jNeuroML >>  (LOG) total repeats of last warning 2
  jNeuroML >>  (WARNING) no dimension for morph1_0_proximal_radius at: org.lemsml.jlems.core.type.DerivedParameter.resolve(DerivedParameter.java:38)
  jNeuroML >>  (LOG)  .......  last warning repeated 3 times
  jNeuroML >>  (INFO) Added cpt hhcell_flat
  jNeuroML >>  Writing to: /home/jonrkarr/Documents/Biosimulators_pyNeuroML/../Biosimulators_test_suite/examples/neuroml-lems/Hodgkin-Huxley-cell-Euler/model_brian2.py
  jNeuroML >>  
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-5-0b86754d8c73> in <module>
----> 1 pynml.run_lems_with_jneuroml_brian2('../Biosimulators_test_suite/examples/neuroml-lems/Hodgkin-Huxley-cell-Euler/model.xml', nogui=True)

~/.local/lib/python3.9/site-packages/pyneuroml/pynml.py in run_lems_with_jneuroml_brian2(lems_file_name, paths_to_include, max_memory, skip_run, nogui, load_saved_data, reload_events, plot, show_plot_already, exec_in_dir, verbose, exit_on_fail, cleanup)
   1594 
   1595         old_sys_args = [a for a in sys.argv]
-> 1596         sys.argv[1] = "-nogui"  # To supress gui for brian simulation...
   1597         logger.info(
   1598             "Importing generated Brian2 python file (changed args from {} to {})".format(

IndexError: list assignment index out of range
pgleeson commented 2 years ago

Thanks for reporting @jonrkarr. Brian2 support requires a bit of refactoring (as noted in https://github.com/NeuroML/pyNeuroML/issues/135), and Brain1 support will be removed as it's not Python3 compatible. This has been put off until after the NeuroML 2.2 release, but will be a priority early in the new year (some other issues with Brian have aleready been fixed, e.g. https://github.com/NeuroML/pyNeuroML/issues/138 and https://github.com/NeuroML/pyNeuroML/issues/136)

jonrkarr commented 2 years ago

pyNeuroML 0.5.20 and Brian2 2.5.0.3 do work.