Skip to content

Commit a3a71b4

Browse files
authored
Merge pull request #787 from MetaCell/feature/depandabot_20231030
Feature/depandabot 20231030
2 parents 42773ed + b701053 commit a3a71b4

6 files changed

Lines changed: 101 additions & 5732 deletions

File tree

netpyne_ui/helpers/neuroml.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import sys
33
import logging
44
from netpyne.specs import simConfig
5+
from packaging import version
56

7+
import pyneuroml
68
from pyneuroml import pynml
79
from pyneuroml.lems import generate_lems_file_for_neuroml
810
from pyneuroml.pynml import read_neuroml2_file
@@ -13,57 +15,67 @@
1315
def convertLEMSSimulation(lemsFileName, compileMod=True):
1416
"""Converts a LEMS Simulation file
1517
16-
Converts a LEMS Simulation file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html)
17-
pointing to a NeuroML 2 file into the equivalent in NetPyNE
18+
Converts a LEMS Simulation file
19+
(https://docs.neuroml.org/Userdocs/LEMSSimulation.html) pointing to a
20+
NeuroML 2 file into the equivalent in NetPyNE
21+
1822
Returns:
1923
simConfig, netParams for the model in NetPyNE
2024
"""
2125
current_path = os.getcwd()
2226
try:
23-
27+
2428
fullLemsFileName = os.path.abspath(lemsFileName)
25-
tmp_path = os.path.dirname(fullLemsFileName)
29+
tmp_path = os.path.dirname(fullLemsFileName)
2630
if tmp_path:
2731
os.chdir(tmp_path)
2832
logging.info(
2933
"Importing LEMSSimulation with NeuroML 2 network from: %s"
3034
% fullLemsFileName
3135
)
3236

33-
result = pynml.run_lems_with_jneuroml_netpyne(
34-
lemsFileName, only_generate_json=True, exit_on_fail=False)
35-
36-
if result == False:
37-
raise Exception("Error loading lems file")
37+
# feature to return output added in 1.0.9
38+
if version.parse(pyneuroml.__version__) >= version.parse("1.0.9"):
39+
result, output_msg = pynml.run_lems_with_jneuroml_netpyne(
40+
lemsFileName, only_generate_json=True, exit_on_fail=False,
41+
return_string=True, max_memory="1G")
42+
43+
if result is False:
44+
raise Exception(f"Error loading lems file: {output_msg}")
45+
else:
46+
result = pynml.run_lems_with_jneuroml_netpyne(
47+
lemsFileName, only_generate_json=True, exit_on_fail=False,
48+
max_memory="1G")
49+
50+
if result is False:
51+
raise Exception("Error loading lems file")
52+
3853
lems = pynml.read_lems_file(lemsFileName)
3954

4055
np_json_fname = fullLemsFileName.replace('.xml','_netpyne_data.json')
41-
56+
4257
return np_json_fname
4358
finally:
4459
os.chdir(current_path)
4560

4661

47-
48-
4962
def convertNeuroML2(nml2FileName, compileMod=True):
5063
"""Loads a NeuroML 2 file into NetPyNE
5164
Loads a NeuroML 2 file into NetPyNE by creating a new LEMS Simulation
52-
file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html) and using jNeuroML
53-
to convert it.
65+
file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html) and using
66+
jNeuroML to convert it.
5467
5568
Returns:
5669
simConfig, netParams for the model in NetPyNE
5770
"""
5871
current_path = os.getcwd()
5972
try:
6073
fullNmlFileName = os.path.abspath(nml2FileName)
61-
work_path = os.path.dirname(fullNmlFileName)
74+
work_path = os.path.dirname(fullNmlFileName)
6275
if not os.path.exists(work_path):
6376
os.makedirs(work_path)
6477
os.chdir(work_path)
6578
sys.path.append(work_path)
66-
6779

6880
logging.info(
6981
"Importing NeuroML 2 network from: %s"

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jupyter-core==4.9.1
2929
jupyter-server==1.11.2
3030
jupyterhub==1.5.0
3131
jupyterlab==3.2.4
32-
neuromllite==0.5.1
32+
neuromllite==0.5.4
3333
jupyterthemes==0.20.0
3434
kiwisolver==1.2.0
3535
lesscpy==0.14.0
36-
libNeuroML==0.4.0
36+
libNeuroML==0.5.1
3737
lfpykit==0.5.1
3838
lxml==4.5.1
3939
Mako==1.1.0
@@ -65,7 +65,7 @@ pycparser==2.20
6565
pyecore==0.11.7
6666
pygeppetto==0.8.1
6767
PyLEMS==0.5.9
68-
pyNeuroML==0.7.1
68+
pyNeuroML==1.0.10
6969
sentry_sdk==1.5.2
7070
dacite==1.6.0
7171
h5py==3.7.0

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
'jupyter-geppetto>=1.0.0',
4444
'NEURON>=8.2.2',
4545
'netpyne>=1.0.4.1',
46-
'neuromllite==0.5.1',
47-
'pyNeuroML>=0.7.1',
46+
'neuromllite==0.5.4',
47+
'pyNeuroML>=1.0.10',
4848
'sentry_sdk>=1.5.2',
4949
'dacite>=1.6.0',
5050
'h5py>=3.7.0',

tests/frontend/e2e/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)