sys-bio / tellurium

Python Environment for Modeling and Simulating Biological Systems
http://tellurium.analogmachine.org/
Apache License 2.0
109 stars 36 forks source link

Separate the namespace of data generators from that of tellurium's internal variables #452

Open jonrkarr opened 4 years ago

jonrkarr commented 4 years ago

Data generator's with id k clash with telluirum's internal variables. For example, this data generator

<dataGenerator id="k" name="k">
      <math xmlns="http://www.w3.org/1998/Math/MathML">
        <ci> k </ci>
      </math>
      <listOfVariables>
        <variable id="k" name="k" target="/sbml:sbml/sbml:model/sbml:listOfParameters/sbml:parameter[@id=&apos;k&apos;]" taskReference="BIOMD0000000764_sim"/>
      </listOfVariables>
    </dataGenerator>
<dataSet id="k" label="k" dataReference="k"/>

generates this error

Traceback (most recent call last):
  File "/usr/local/bin/tellurium", line 11, in <module>
    load_entry_point('Biosimulations-tellurium', 'console_scripts', 'tellurium')()
  File "/home/jonrkarr/Documents/Biosimulations_tellurium/Biosimulations_tellurium/__main__.py", line 51, in main
    app.run()
  File "/usr/local/lib/python3.7/site-packages/cement/core/foundation.py", line 916, in run
    return_val = self.controller._dispatch()
  File "/usr/local/lib/python3.7/site-packages/cement/ext/ext_argparse.py", line 808, in _dispatch
    return func()
  File "/home/jonrkarr/Documents/Biosimulations_tellurium/Biosimulations_tellurium/__main__.py", line 36, in _default
    exec_combine_archive(args.archive, args.out_dir)
  File "/home/jonrkarr/Documents/Biosimulations_tellurium/Biosimulations_tellurium/core.py", line 72, in exec_combine_archive
    factory.executePython()
  File "/usr/local/lib/python3.7/site-packages/tellurium/sedml/tesedml.py", line 505, in executePython
    exec(compile(code, filename, 'exec'), symbols)
  File "/tmp/te-generated-sedml.py", line 160, in <module>
    __df__k = pandas.DataFrame(np.column_stack([time[:,k], U[:,k], I[:,k], V[:,k], C[:,k], C0[:,k], d1[:,k], alph[:,k], y[:,k], p[:,k], d0[:,k], V0[:,k], b[:,k], bet[:,k], a[:,k], f[:,k], k[:,k]]), 
TypeError: 'int' object is not subscriptable
jonrkarr commented 4 years ago

The above example come from BIOMD0000000764