Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

v2: writing a problem reformats all math expressions, including unchanged ones

未关闭
#548 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
30/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
data

调研方向

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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PEtab-dev/libpetab-python 的其他 Issue

查看 PEtab-dev/libpetab-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。