v2: writing a problem reformats all math expressions, including unchanged ones
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with how sympify_petab parses expressions on load and how to_df writes them back via petab_math_str in the petab.v2 modules. The proposed fix needs a decision on storing the original string on the expression model, which is a design question for maintainers before any code. Done means an unchanged formula round-trips to its original text, while a changed expression is still printed from sympy.
由索引模型根据 Issue 内容生成。
描述
In petab.v2, math expressions (observable and noise formulas, condition target values, observable/noise parameter overrides) are stored as sympy expressions, parsed with sympify_petab on load. On writing, to_df prints them with petab_math_str; the original string is not kept. Therefore, loading and writing a problem rewrites every expression, changed or not:
| Input | Written back |
|---|---|
a - (b - c) |
a - b + c |
(100*pApB + 200*pApA)/2 |
100*pApA + 50*pApB |
2 * x / 3 |
0.6666666666666666*x |
log10(x) |
log(x)/log(10) |
The results are mathematically equivalent, but this makes diffs between original and written problems hard to read. E.g., when converting PEtab v1 problems to v2 and writing them, actual changes (like reparametrized noise formulas) are mixed with reformatting of unchanged formulas.
Possible approach: when parsing a string, also store the original string (e.g., as a pydantic private attribute), and write it in to_df if the expression is still equal to the parsed one; otherwise, print the expression. This keeps the current API.
Alternatives considered:
- Storing strings and deriving sympy expressions on demand: breaks the current API.
- Parsing with
evaluate=False: reduces, but does not prevent, reformatting, and changes the expressions returned to users.
🤖 Drafted with AI assistance.
- 主要语言
- Python
- 星标
- 18
- 派生
- 9
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 30
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PEtab-dev/libpetab-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
PEtab-dev/libpetab-python#566 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
PEtab-dev/libpetab-python#549 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
PEtab-dev/libpetab-python#525 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
PEtab-dev/libpetab-python#565 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 48/100
PEtab-dev/libpetab-python#555 ·
维护者通常 1 天内回复
查看 PEtab-dev/libpetab-python 的全部 Issue
相似的 Issue
-
enhancement help wanted
难度 2/5 1-3 小时 新手友好度 76/100
Git-Hospital/githealthcheck#61 ·
维护者通常 1 天内回复
-
changelog investigate
难度 2/5 1-3 小时 新手友好度 67/100
ramnes/notion-sdk-py#433 ·
-
Partial method descriptors raise on class access可能已有人在做 @Gambit-Checkmate 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 19 天内回复
-
docs pkg:core
难度 1/5 1 小时以内 新手友好度 84/100
pydantic/pydantic-ai#11929 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
intake/intake-esm#789 ·