Skip to content

Commit 5187dc8

Browse files
author
facu.r
committed
formatting
1 parent 2dd8233 commit 5187dc8

1 file changed

Lines changed: 2 additions & 52 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import traceback
1515

1616

17-
from netpyne import specs, sim, analysis, utils
17+
from netpyne import specs, sim, analysis, utils
1818
from netpyne.metadata import metadata, api
1919
from netpyne_model_interpreter import NetPyNEModelInterpreter
2020
from pygeppetto.model.model_serializer import GeppettoModelSerializer
@@ -289,57 +289,7 @@ def deleteParam(self, paramToDel):
289289

290290
def validateFunction(self, functionString):
291291
return utils.ValidateFunction(functionString, netParams.__dict__)
292-
293-
def generateScript(self, metadata):
294-
def convert2bool(string):
295-
return string.replace('true', 'True').replace('false', 'False')
296-
297-
def header(title, spacer='-'):
298-
return '\n# ' + title.upper() + ' ' + spacer*(77-len(title)) + '\n'
299-
300-
try :
301-
params = ['popParams' , 'cellParams', 'synMechParams']
302-
params += ['connParams', 'stimSourceParams', 'stimTargetParams']
303-
304-
fname = metadata['scriptName'] if metadata['scriptName'][-3:]=='.py' else metadata['scriptName']+'.py'
305-
306-
with open(fname, 'w') as script:
307-
script.write('from netpyne import specs, sim\n')
308-
script.write(header('documentation'))
309-
script.write("''' Script generated with NetPyNE-UI. Please visit:\n")
310-
script.write(" - https://www.netpyne.org\n - https://github.com/MetaCell/NetPyNE-UI\n'''\n")
311-
script.write(header('script', spacer='='))
312-
script.write('netParams = specs.NetParams()\n')
313-
script.write('simConfig = specs.SimConfig()\n')
314-
script.write(header('single value attributes'))
315-
for attr, value in netParams.__dict__.items():
316-
if attr not in params:
317-
if value!=getattr(specs.NetParams(), attr):
318-
script.write('netParams.' + attr + ' = ')
319-
script.write(convert2bool(json.dumps(value, indent=4))+'\n')
320-
321-
script.write(header('network attributes'))
322-
for param in params:
323-
for key, value in getattr(netParams, param).items():
324-
script.write("netParams." + param + "['" + key + "'] = ")
325-
script.write(convert2bool(json.dumps(value, indent=4))+'\n')
326-
327-
script.write(header('network configuration'))
328-
for attr, value in simConfig.__dict__.items():
329-
if value!=getattr(specs.SimConfig(), attr):
330-
script.write('netParams.' + attr + ' = ')
331-
script.write(convert2bool(json.dumps(value, indent=4))+'\n')
332-
333-
script.write(header('create simulate analyze network'))
334-
script.write('sim.createSimulateAnalyze(netParams=netParams, simConfig=simConfig)\n')
335-
336-
script.write(header('end script', spacer='='))
337-
338-
return self.getJSONReply()
339-
340-
except:
341-
return self.getJSONError("Error while importing the NetPyNE model", traceback.format_exc())
342-
292+
343293
class LoopTimer(threading.Thread):
344294
"""
345295
a Timer that calls f every interval

0 commit comments

Comments
 (0)