Catalyst.jl icon indicating copy to clipboard operation
Catalyst.jl copied to clipboard

Enable and document observables

Open TorkelE opened this issue 1 year ago • 1 comments

The observable field exists for storing observables, but I don't think there are ways to populate it (except for when loading models that already have them).

I think ModelingToolkit partially supports creating and adding observables to a system, so if we can use this when creating models programmatically, we should document how.

For the DSL it is currently not possible, but adding an option like

@reaction_network begin
    @observable Xtot = X1 + X2
    (k1,k2), X1 <--> X2
end

seems like it would be a good idea.

TorkelE avatar Sep 25 '23 01:09 TorkelE

https://github.com/SciML/Catalyst.jl/blob/bc8ebf0ade4713bd09e16e805193e5f69d640bc6/src/reactionsystem.jl#L568

It is just a kwarg to ReactionSystem, so a user is free to put equations in it. I think SBMLToolkit uses it, for example.

I don't remember, however, if issues could arise should say Xtot in your example be used within an equation. ModelingToolkit uses that field to store variables that have been removed by structural_simplify, and hence won't be in the final equations.

isaacsas avatar Sep 25 '23 04:09 isaacsas

now works on master

TorkelE avatar Jun 04 '24 19:06 TorkelE