Skip to content

Commit

Permalink
Merge pull request #787 from MetaCell/feature/depandabot_20231030
Browse files Browse the repository at this point in the history
Feature/depandabot 20231030
  • Loading branch information
ddelpiano authored Feb 5, 2024
2 parents 42773ed + b701053 commit a3a71b4
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 5,732 deletions.
44 changes: 28 additions & 16 deletions netpyne_ui/helpers/neuroml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import sys
import logging
from netpyne.specs import simConfig
from packaging import version

import pyneuroml
from pyneuroml import pynml
from pyneuroml.lems import generate_lems_file_for_neuroml
from pyneuroml.pynml import read_neuroml2_file
Expand All @@ -13,57 +15,67 @@
def convertLEMSSimulation(lemsFileName, compileMod=True):
"""Converts a LEMS Simulation file
Converts a LEMS Simulation file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html)
pointing to a NeuroML 2 file into the equivalent in NetPyNE
Converts a LEMS Simulation file
(https://docs.neuroml.org/Userdocs/LEMSSimulation.html) pointing to a
NeuroML 2 file into the equivalent in NetPyNE
Returns:
simConfig, netParams for the model in NetPyNE
"""
current_path = os.getcwd()
try:

fullLemsFileName = os.path.abspath(lemsFileName)
tmp_path = os.path.dirname(fullLemsFileName)
tmp_path = os.path.dirname(fullLemsFileName)
if tmp_path:
os.chdir(tmp_path)
logging.info(
"Importing LEMSSimulation with NeuroML 2 network from: %s"
% fullLemsFileName
)

result = pynml.run_lems_with_jneuroml_netpyne(
lemsFileName, only_generate_json=True, exit_on_fail=False)

if result == False:
raise Exception("Error loading lems file")
# feature to return output added in 1.0.9
if version.parse(pyneuroml.__version__) >= version.parse("1.0.9"):
result, output_msg = pynml.run_lems_with_jneuroml_netpyne(
lemsFileName, only_generate_json=True, exit_on_fail=False,
return_string=True, max_memory="1G")

if result is False:
raise Exception(f"Error loading lems file: {output_msg}")
else:
result = pynml.run_lems_with_jneuroml_netpyne(
lemsFileName, only_generate_json=True, exit_on_fail=False,
max_memory="1G")

if result is False:
raise Exception("Error loading lems file")

lems = pynml.read_lems_file(lemsFileName)

np_json_fname = fullLemsFileName.replace('.xml','_netpyne_data.json')

return np_json_fname
finally:
os.chdir(current_path)




def convertNeuroML2(nml2FileName, compileMod=True):
"""Loads a NeuroML 2 file into NetPyNE
Loads a NeuroML 2 file into NetPyNE by creating a new LEMS Simulation
file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html) and using jNeuroML
to convert it.
file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html) and using
jNeuroML to convert it.
Returns:
simConfig, netParams for the model in NetPyNE
"""
current_path = os.getcwd()
try:
fullNmlFileName = os.path.abspath(nml2FileName)
work_path = os.path.dirname(fullNmlFileName)
work_path = os.path.dirname(fullNmlFileName)
if not os.path.exists(work_path):
os.makedirs(work_path)
os.chdir(work_path)
sys.path.append(work_path)


logging.info(
"Importing NeuroML 2 network from: %s"
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jupyter-core==4.9.1
jupyter-server==1.11.2
jupyterhub==1.5.0
jupyterlab==3.2.4
neuromllite==0.5.1
neuromllite==0.5.4
jupyterthemes==0.20.0
kiwisolver==1.2.0
lesscpy==0.14.0
libNeuroML==0.4.0
libNeuroML==0.5.1
lfpykit==0.5.1
lxml==4.5.1
Mako==1.1.0
Expand Down Expand Up @@ -65,7 +65,7 @@ pycparser==2.20
pyecore==0.11.7
pygeppetto==0.8.1
PyLEMS==0.5.9
pyNeuroML==0.7.1
pyNeuroML==1.0.10
sentry_sdk==1.5.2
dacite==1.6.0
h5py==3.7.0
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
'jupyter-geppetto>=1.0.0',
'NEURON>=8.2.2',
'netpyne>=1.0.4.1',
'neuromllite==0.5.1',
'pyNeuroML>=0.7.1',
'neuromllite==0.5.4',
'pyNeuroML>=1.0.10',
'sentry_sdk>=1.5.2',
'dacite>=1.6.0',
'h5py>=3.7.0',
Expand Down
2 changes: 1 addition & 1 deletion tests/frontend/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a3a71b4

Please sign in to comment.