Add petab-compatible sympy string-printer#364
Merged
dweindl merged 1 commit intoPEtab-dev:developfrom Mar 27, 2025
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #364 +/- ##
===========================================
- Coverage 74.57% 74.57% -0.01%
===========================================
Files 57 58 +1
Lines 6080 6119 +39
Branches 1058 1062 +4
===========================================
+ Hits 4534 4563 +29
- Misses 1141 1149 +8
- Partials 405 407 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5edcd58 to
522e06e
Compare
522e06e to
cec9253
Compare
Merged
1139547 to
c15876e
Compare
dilpath
approved these changes
Mar 27, 2025
Comment on lines
31
to
37
| # non-real symbols are changed to real | ||
| # TODO: should we raise an error instead? | ||
| assert sympify_petab(sp.Symbol("x", real=False)).is_real |
Member
There was a problem hiding this comment.
Probably raise an error, or does it occur in standard use?
Member
Author
There was a problem hiding this comment.
It happens if you pass sympify("x"). Not sure what standard use will be 😅
I think, just stating that the real-assumption is applied to all inputs is sufficient.
Member
There was a problem hiding this comment.
Ah, fine for me on the level of symbols. I was thinking of expressions, which I guess is irrelevant here, so nevermind.
1583431 to
e800abb
Compare
Add a sympy Printer to stringify sympy expressions in a petab-compatible way.
For example, we need to avoid `str(sympy.sympify("x^2"))` -> `'x**2'`.
Closes PEtab-dev#362.
e800abb to
51c96ad
Compare
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.
Add a sympy Printer to stringify sympy expressions in a petab-compatible way. For example, we need to avoid
str(sympy.sympify("x^2"))->'x**2'.Closes #362.