1515def convertLEMSSimulation (lemsFileName , compileMod = True ):
1616 """Converts a LEMS Simulation file
1717
18- Converts a LEMS Simulation file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html)
19- 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+
2022 Returns:
2123 simConfig, netParams for the model in NetPyNE
2224 """
2325 current_path = os .getcwd ()
2426 try :
25-
27+
2628 fullLemsFileName = os .path .abspath (lemsFileName )
27- tmp_path = os .path .dirname (fullLemsFileName )
29+ tmp_path = os .path .dirname (fullLemsFileName )
2830 if tmp_path :
2931 os .chdir (tmp_path )
3032 logging .info (
@@ -37,46 +39,43 @@ def convertLEMSSimulation(lemsFileName, compileMod=True):
3739 result , output_msg = pynml .run_lems_with_jneuroml_netpyne (
3840 lemsFileName , only_generate_json = True , exit_on_fail = False ,
3941 return_string = True , max_memory = "1G" )
40-
42+
4143 if result is False :
4244 raise Exception (f"Error loading lems file: { output_msg } " )
4345 else :
4446 result = pynml .run_lems_with_jneuroml_netpyne (
4547 lemsFileName , only_generate_json = True , exit_on_fail = False ,
4648 max_memory = "1G" )
47-
49+
4850 if result is False :
4951 raise Exception ("Error loading lems file" )
5052
5153 lems = pynml .read_lems_file (lemsFileName )
5254
5355 np_json_fname = fullLemsFileName .replace ('.xml' ,'_netpyne_data.json' )
54-
56+
5557 return np_json_fname
5658 finally :
5759 os .chdir (current_path )
5860
5961
60-
61-
6262def convertNeuroML2 (nml2FileName , compileMod = True ):
6363 """Loads a NeuroML 2 file into NetPyNE
6464 Loads a NeuroML 2 file into NetPyNE by creating a new LEMS Simulation
65- file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html) and using jNeuroML
66- to convert it.
65+ file (https://docs.neuroml.org/Userdocs/LEMSSimulation.html) and using
66+ jNeuroML to convert it.
6767
6868 Returns:
6969 simConfig, netParams for the model in NetPyNE
7070 """
7171 current_path = os .getcwd ()
7272 try :
7373 fullNmlFileName = os .path .abspath (nml2FileName )
74- work_path = os .path .dirname (fullNmlFileName )
74+ work_path = os .path .dirname (fullNmlFileName )
7575 if not os .path .exists (work_path ):
7676 os .makedirs (work_path )
7777 os .chdir (work_path )
7878 sys .path .append (work_path )
79-
8079
8180 logging .info (
8281 "Importing NeuroML 2 network from: %s"
0 commit comments