PySCeS / pysces

The official PySCeS project source code repository.
https://pysces.github.io
Other
34 stars 10 forks source link

Forcing function symbols #17

Closed exe0cdc closed 7 years ago

exe0cdc commented 8 years ago

It seems that whenever a symbol that does not appear elsewhere in a specific model is defined using a forcing function, it is not added to the parameters list of the instantiated model. This is contrary to the behaviour for conventionally defined symbols. So in the following case:

Y = 1
!F X = 2

For a model "mod", mod.parameters will only contain X if it is in a rate equation (if it is a substrate/product it will appear in mod.species), while Y will appear in the parameter list.

Is this the intended behaviour? A workaround for this issue is to add X=0 to the model file before using X in the forcing function, but I'm not sure if this could have unintended side effects.

bgoli commented 8 years ago

Hi, your workaround is the proper way to do it.

Forcing functions are assignments that use/assign to model variables/parameters so if you want to use stuff in a forcing function it should be declared as such, somewhere in the model.

For one thing it is slightly more complicated to parse and extract the parameters in an arbitrary expression, compared to a kinetic equation (where the reagents/variables are specified).

So, in short, consider forcing functions to be rules you apply to existing model (global) elements. Make sense?