Emit Python observables from the model's assignment rules - #35
Merged
Conversation
A consumer scoring the model against data has to recompute the derived quantities the data names: totals, lineages, volume fractions. Those are repeatedAssignment rules the C++ emitter already reads, so emitting Python from the same SBML keeps the two in step. Re-deriving them by hand is a second definition that drifts, and on the PDAC model a hand expansion of the aggregate module had already missed phi_collagen, which lives in a different module and is a nonlinear ratio. resolve() closes a requested symbol set over the rules and returns the raw species it needs, which is the output contract for anything standing in for the simulator. It raises on unknown symbols and on cycles rather than dropping them. emit() writes pure arithmetic, so the module needs no array library and runs on floats, numpy arrays or JAX tracers alike. Non-arithmetic operators are refused where the rule is first read, so the error names the rule instead of reporting 'std' and 'max' as missing symbols. On PDAC: 35 symbols close to 30 states, 13 constants and 20 rules, and every aggregate identity reproduces exactly on random states.
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.
A consumer scoring the model against data has to recompute the derived quantities the data names: totals, lineages, volume fractions. Those are
repeatedAssignmentrules the C++ emitter already reads, so emitting Python from the same SBML keeps the two in step. Re-deriving them by hand is a second definition that drifts, and on the PDAC model a hand expansion of the aggregate module had already missedphi_collagen, which lives in a different module and is a nonlinear ratio.resolve()closes a requested symbol set over the rules and returns the raw species it needs, which is the output contract for anything standing in for the simulator. Raises on unknown symbols and on cycles rather than dropping them.emit()writes pure arithmetic, so the generated module needs no array library and runs on floats, numpy arrays or JAX tracers alike. Non-arithmetic operators are refused where the rule is first read, so the error names the rule instead of reportingstdandmaxas missing symbols.emit-observablessubcommand alongsidegenerateandverify.On PDAC: 35 symbols close to 30 states, 13 constants and 20 rules, and every aggregate identity reproduces exactly on random states.