@@ -98,17 +98,15 @@ def compileModMechFiles(self, compileMod, modFolder):
9898 subprocess .call (["nrnivmodl" ])
9999
100100 # Load mechanism if mod path is passed
101- return neuron .load_mechanisms (str (modFolder ))
102-
103-
101+ if modFolder :
102+ neuron .load_mechanisms (str (modFolder ))
104103
105104 def importModel (self , modelParameters ):
106105 try :
107106 # Get Current dir
108107 owd = os .getcwd ()
109108
110- if not self .compileModMechFiles (modelParameters ['compileMod' ], modelParameters ['modFolder' ]):
111- return self .getJSONError ("Error loading mechanisms" , "We coundn't find libnrnmech.so.\n (*) Is '%s' the right path?\n (*) Are the mod files compiled?\n (*) Try importing with compile-mod option selected." % (modelParameters ['modFolder' ]))
109+ self .compileModMechFiles (modelParameters ['compileMod' ], modelParameters ['modFolder' ])
112110
113111 import netpyne_geppetto
114112
@@ -121,7 +119,15 @@ def importModel(self, modelParameters):
121119 netParamsModuleName = importlib .import_module (str (modelParameters ["netParamsModuleName" ]))
122120 # Import Model attributes
123121 netpyne_geppetto .netParams = getattr (netParamsModuleName , str (modelParameters ["netParamsVariable" ]))
124-
122+
123+ # netpyne.specs.Dict class MUST NOT be allowed for cellParams in the GUI
124+ # if anybody know how to convert in a better way, go ahead...
125+ # take a look at 145-149 and 175 to see different opcions
126+ with open ('_.txt' , 'w' ) as file :
127+ file .write (json .dumps (netpyne_geppetto .netParams .cellParams ))
128+ with open ('_.txt' , 'r' ) as file :
129+ netpyne_geppetto .netParams .cellParams = json .load (file )
130+
125131 # SimConfig
126132 simConfigPath = str (modelParameters ["simConfigPath" ])
127133 sys .path .append (simConfigPath )
@@ -139,7 +145,7 @@ def importModel(self, modelParameters):
139145 netpyne_geppetto .netParams = specs .NetParams (jsonData ['net' ]['params' ])
140146 netpyne_geppetto .simConfig = specs .SimConfig (jsonData ['simConfig' ])
141147 # in cellParams.conds --> cellModel, cellType and pop get value {} if this is type specs.Dict
142- # so, by converting from specs.Dict to python regular dict solves the problem. I tried to solve it from the GUI but I coudn 't
148+ # so, by converting from specs.Dict to python regular dict solves the problem. I tried to solve it In the GUI but I couldn 't
143149 netpyne_geppetto .netParams .cellParams = jsonData ['net' ]['params' ]['cellParams' ]
144150 else :
145151 return self .getJSONError ("Assertion error while importing the NetPyNE model" , "The json file does not contain the following keys: [params, simConfig]" )
@@ -156,12 +162,11 @@ def importCellTemplate(self, modelParameters, modFolder, compileMod):
156162 try :
157163 # Get Current dir
158164 owd = os .getcwd ()
159-
160- if not self .compileModMechFiles (compileMod , modFolder ):
161- return self .getJSONError ("Error loading mechanisms" , "We coundn't find libnrnmech.so.\n (*) Is '%s' the right path?\n (*) Are the mod files compiled?\n (*) Try importing with compile-mod option selected." % (modFolder ))
162-
165+
163166 from netpyne_geppetto import netParams
164167
168+ self .compileModMechFiles (compileMod , modFolder )
169+
165170 # import cell template
166171 netParams .importCellParams (** modelParameters )
167172
0 commit comments