v2: writing a problem reformats all math expressions, including unchanged ones
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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時間
- マージ済み PR(30日)
- 30
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
vllm-project/vllm#64845 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dekobon/big-code-analysis#1729 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
pydantic/pydantic-ai#12091 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100