Add @poissonians DSL option for @reaction_network and @network_component#1388
Merged
isaacsas merged 8 commits intoSciML:masterfrom Feb 8, 2026
Merged
Add @poissonians DSL option for @reaction_network and @network_component#1388isaacsas merged 8 commits intoSciML:masterfrom
isaacsas merged 8 commits intoSciML:masterfrom
Conversation
Support declaring poissonians inline in the DSL via @poissonians, matching the existing @brownians pattern. Poissonian names are added to syms_declared to prevent inference as variables, and are passed to make_ReactionSystem_internal. Symbols in poissonian rates must be pre-declared or interpolated. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Member
Author
|
@TorkelE please give this a review to make sure you are happy with how this has modified / integrated into the DSL. |
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Validates poissonian rate symbols at macro expansion time against declared/inferred symbols, skipping interpolated subtrees. Throws UndeclaredSymbolicError with a descriptive message for any unrecognized symbols. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Tests that errors in non-first poissonians are caught and that multiple undeclared symbols across poissonians are all reported in one message. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Member
Author
|
OK, I think this should be good modulo needing that MTK PR + a release. |
This was referenced Feb 7, 2026
TorkelE
reviewed
Feb 8, 2026
TorkelE
approved these changes
Feb 8, 2026
Co-authored-by: Torkel Loman <[email protected]>
Co-authored-by: Torkel Loman <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requires SciML/ModelingToolkit.jl#4274 and an MTKBase release before we can test/merge.
Summary
Adds
@poissoniansas a DSL option in@reaction_networkand@network_component, allowing users to declare poissonians inline rather than constructing them externally and interpolating.Multiple poissonians and begin/end block syntax are supported:
Rate expressions can also be interpolated from external variables:
Note: Symbols appearing in poissonian rates must be pre-declared (via
@parameters,@species, etc.) or interpolated — they are not auto-inferred.Depends on: A fix in ModelingToolkitBase that makes
@poissoniansconsistently returnVector{Num}(matching@browniansbehavior). Without that fix, the macro returns a scalarNumfor a single poissonian and aTuplefor multiple.