sys-bio / tellurium

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

Folllwing script taken from the docs doesn't work #509

Open hsauro opened 3 years ago

hsauro commented 3 years ago

The following sedml example script from the readthedocs Usage Examples/SED-ML/1d Parameter Scan crashes:

File "C:\Users\hsauro\AppData\Local\Temp\te-generated-sedml.py", line 65, in model1['J0_v0'] = valuevector_for_J0_v0

NameError: name 'valuevector_for_J0_v0' is not defined

import tellurium as te

antimony_str = ''' // Created by libAntimony v2.9 model *parameterScan1D()

// Compartments and Species: compartment compartment; species S1 in compartment, S2 in compartment, $X0 in compartment, $X1 in compartment; species $X2 in compartment;

// Reactions: J0: $X0 => S1; J0_v0; J1: S1 => $X1; J1_k3S1; J2: S1 => S2; (J2_k1S1 - J2_k_1S2)(1 + J2_cS2^J2_q); J3: S2 => $X2; J3_k2S2;

// Species initializations: S1 = 0; S2 = 1; X0 = 1; X1 = 0; X2 = 0;

// Compartment initializations: compartment_ = 1;

// Variable initializations: J0_v0 = 8; J1_k3 = 0; J2_k1 = 1; J2_k_1 = 0; J2_c = 1; J2_q = 3; J3_k2 = 5;

// Other declarations: const compartment_, J0_v0, J1_k3, J2_k1, J2_k_1, J2_c, J2_q, J3_k2; end '''

phrasedml_str = ''' model1 = model "parameterScan1D" timecourse1 = simulate uniform(0, 20, 1000) task0 = run timecourse1 on model1 task1 = repeat task0 for J0_v0 in [8, 4, 0.4], reset=true plot task1.time vs task1.S1, task1.S2 '''

create the inline OMEX string

inline_omex = '\n'.join([antimony_str, phrasedml_str])

execute the inline OMEX

te.executeInlineOmex(inline_omex)