Skip to content

Commit d0005e9

Browse files
authored
Merge pull request #93 from MetaCell/refactor-importCellTemplate
add simplify cell to test mod compilation and cell template import
2 parents 7ce2ade + 0dcbcba commit d0005e9

2 files changed

Lines changed: 1649 additions & 11 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,26 @@ def importModel(self, modelParameters):
227227
finally:
228228
os.chdir(owd)
229229

230-
def importCellTemplate(self, modelParameters, modFolder, compileMod):
230+
def importCellTemplate(self, modelParameters):
231231
try:
232-
# Get Current dir
233-
owd = os.getcwd()
232+
with redirect_stdout(sys.__stdout__):
233+
rule = modelParameters["label"]
234+
# Get Current dir
235+
owd = os.getcwd()
234236

235-
self.compileModMechFiles(compileMod, modFolder)
237+
conds = {} if rule not in self.netParams.cellParams else self.netParams.cellParams[rule]['conds']
236238

237-
# import cell template
238-
self.netParams.importCellParams(**modelParameters)
239-
240-
# convert fron netpyne.specs.dict to dict
241-
rule = modelParameters["label"]
242-
self.netParams.cellParams[rule] = self.netParams.cellParams[rule].todict()
239+
self.compileModMechFiles(modelParameters["compileMod"], modelParameters["modFolder"])
243240

244-
return utils.getJSONReply()
241+
del modelParameters["modFolder"]
242+
del modelParameters["compileMod"]
243+
# import cell template
244+
self.netParams.importCellParams(**modelParameters, conds=conds)
245+
246+
# convert fron netpyne.specs.dict to dict
247+
self.netParams.cellParams[rule] = self.netParams.cellParams[rule].todict()
248+
249+
return utils.getJSONReply()
245250
except:
246251
return utils.getJSONError("Error while importing the NetPyNE cell template", sys.exc_info())
247252
finally:

0 commit comments

Comments
 (0)