Nine loud failures that block a valid job or give the wrong cause: RuleMonkey experiments, one-time-point data, PEtab import and export cases, error messages that hide their reason, and a crash on deeply nested formulas

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
git, python

调研方向

Split the report into the nine cases and start with the named entry points in pybnf/pset.py, pybnf/petab/import_.py, pybnf/config.py, pybnf/petab/export.py, and tools/changelog_merge.py. Run each supplied reproduction on commit cd2be675 and inspect the referenced call sites and existing tests. Done means each valid case runs or is rejected for the correct backend-specific reason, each error preserves its cause, worktrees are detected, and nested formulas no longer crash, with regression coverage.

由索引模型根据 Issue 内容生成。

描述

bug

None of these failures gives a wrong result without a message: each one stops the run or refuses the input. But each one either blocks a job that PyBNF should run or tells the user the wrong cause, so the user loses time fixing the wrong thing.

Every item below was reproduced on main at cd2be675.

Refuses valid input

1. An edition-2 experiment with method: rm (RuleMonkey) cannot run on any backend

What the user does. Writes experiment: tc, data: decay.exp, method: rm for a network-free model.

What they see. With bngl_backend = bngsim, the run stops at load with "bngl_backend = bngsim was requested for model m, but its BNGL actions are not supported by the bngsim bridge." The model has no actions block, so the user cannot tell which actions the message means. Under the default bngl_backend = auto, and under bionetgen, every simulation goes to BNG2.pl, which rejects the method ("ABORT: Simulation method 'rm' is not a valid option", in FailedSimLogs). A 50-iteration run then stops with "Your simulations are failing to run". A shorter run prints "Fitting complete" with an objective of inf. The same conf with method: nf runs.

What it should do. Run on bngsim's RuleMonkey, as method: nf runs on NFsim. Under bngl_backend = bionetgen, refuse at load and say that BNG2.pl has no RuleMonkey.

Reproduction. m.bngl: one molecule A(), seed 1000, Molecules A_tot A(), rule A() -> 0 k, k 0.5, no actions block. decay.exp: # time A_tot / 0 1000 / 1 606.5 / 2 367.9 / 3 223.1.

edition = 2
model: m.bngl
bngl_backend = bngsim
objective = sos
job_type = de
population_size = 3
max_iterations = 1
uniform_var = k 0.49 0.51
experiment: tc, data: decay.exp, method: rm

Where. For each synthesized experiment, PyBNF adds a resetConcentrations() and skips it only when the method is nf (pybnf/pset.py:1095 and :1228, where is_nf = ... == 'nf'). The bngsim bridge accepts resetConcentrations() only on the network path (pybnf/bngsim_model/classification.py:337), so the action list is classified as unsupported. bngl_backend = bngsim then refuses (pybnf/algorithms/base.py:500), and auto falls back to BNG2.pl, with a note that goes only to the log file. When both checks also accept rm and rulemonkey, the job runs on bngsim: a one-iteration fit completes.

2. An edition-2 experiment with a single measurement time is refused on every backend

What the user does. Gives an experiment data at one time point, for example # time A_tot / 5 3.9. A PEtab experiment with one measurement time, with or without a pre-equilibration period, is imported as the same kind of experiment and fails the same way.

What they see. "The time_course action with suffix "e1" has only 2 explicit output time point(s) (including t=0), but BioNetGen's sample_times requires 3 or more. Provide a data set with at least two positive time points."

What it should do. BNG2.pl does need three or more sample_times (BNGAction.pm in 2.9.3), but the default backend, bngsim, does not. With the check removed, bngsim fits the example below and scores 0.0037432 at k = 1, which matches the analytic 0.5·(4 − 2e⁻⁵ − 3.9)² = 0.0037432. The refusal should apply only under bngl_backend = bionetgen, or the BNG2.pl action could use t_end=>5, n_steps=>1 instead. For an imported PEtab problem, the advice to "provide a data set" asks the user to change data they did not write.

Reproduction. m.bngl: A() seeded at 2, rules 0 -> A() L and A() -> 0 k, L 4, k 1. one.exp: # time A_tot / 5 3.9. Conf: edition = 2, model: m.bngl, experiment: e1, data: one.exp, uniform_var = k 0.5 2, job_type = de.

Where. pybnf/pset.py:1137.

3. PEtab import: a noiseFormula expression over a fixed parameter is refused, and the error says to estimate that parameter

What the user does. Imports a PEtab problem (libpetab lint: no issues) whose noiseFormula is 2 * sd_c, where sd_c is in the parameters table with estimate = false and nominalValue = 2.

What they see. The importer writes noise_model = gaussian, sigma = formula 2 * sd_c, and the job stops at load with "Objective function chi_sq (or a per-observable noise_model) estimates the noise parameter(s) sd_c, but they are not declared as free parameters ... e.g. "uniform_var = sd_c "." Following that advice would estimate a value that the problem fixes. With the noiseFormula sd_c alone, the importer substitutes the value (sigma = fix_at 2) and the job runs.

What it should do. Substitute fixed parameters into an expression noiseFormula as well. Here σ = 4.

Where. pybnf/petab/import_.py:945-948 looks a bare id up among the fixed parameters. The expression branch at :950-957 does not.

Error names the wrong cause

4. Many errors show the user only a detail line, and the reason goes to the log file

PybnfError(log_message, user_message) replaces the console message with its second argument (pybnf/printing.py:35-46; #527 fixed one case). At these call sites the second argument is supporting detail or a remedy, so the console shows the detail line alone:

The user writes Console shows Lost (log only) Where
objective = expression using an undeclared y Error: Declared free parameters: ['x1', 'x2']. the unknown name y petab/formula.py:540 (the same check serves measurement formulas, noise formulas and PEtab export)
observable: scaled, formula: scale * A_totl (typo) Measurement model 'scaled': allowed symbols are ... the fit's free parameters ['A_tot', 'k', 'scale'], ... the name A_totl (the list also calls observable A_tot a free parameter) petab/formula.py:540 via config.py:2550
objective = expression with data = a.exp, b.exp, where b.exp lacks column y Its columns are ['t', 'z']. Every bound experiment must carry every data column ... which file, which column config.py:1343, analytical_model.py:658
a data column with the same name as a free parameter An objective expression binds a symbol to either a free parameter or a data column, ... rename the parameter or the data column. which name config.py:1321
model: parabola.xml, rtol: 1e-8 with sbml_integrator = gillespie Use sbml_integrator = cvode, or drop the tolerance fields. why config.py:861
atol: tracking or sbml_atol = tracking on a bngsim build without that feature Upgrade bngsim, or state a number (or "auto") instead. which setting config.py:880, :2775 (same form at :893); reproduced by switching bngsim's capability flag off
objective = gaussian, mean = 0 0, variance = 1 1, varience = 2 It takes field(s) ['mean', 'variance']; got unexpected ['varience']. which objective config.py:1236
PEtab import with a bare observableFormula yy that is not a model entity exception message Model namespace: ['v1', 'v2', 'v3', 'x', 'y']. the name yy petab/import_.py:737
a constraint file that uses par.x.par log: Parsing constraint variable %s - ... (a literal %s) the variable constraint.py:469

For the PEtab row, a Python traceback prints both arguments as a tuple, so the reason is visible there. It is lost wherever PyBNF prints the message itself. The constraint error is raised only while each parameter set is scored, so what the console actually shows is "Your simulations are failing to run" (see #961, the noise formula 0.5 * v3).

What it should do. Put the detail in hint=, which is appended, or into the first message, so the console gets both the reason and the detail.

Reproduction (first row). edition = 2, objective = expression, expression = (x1 - 1)^2 + (x2 - 2)^2 + y^2, uniform_var = x1 -5 5, uniform_var = x2 -5 5, job_type = de.

5. PEtab import: a start point inside the bounds but outside a uniform prior's range is reported as outside the bounds

What the user does. Imports a parameters row with lowerBound 0, upperBound 10, nominalValue 7, priorDistribution uniform, priorParameters 1;5. libpetab lint reports no issues.

What they see. "The parameters table gives 'v1' a nominalValue of 7.0, which lies outside the lowerBound/upperBound declared for it on the same row ... Correct the nominalValue or widen the bounds." But 7 lies inside [0, 10], and widening the bounds does not help.

What it should do. Say that 7 is outside the prior's range [1, 5], which PyBNF uses as the parameter's box.

Where. pybnf/petab/parameters.py:256 intersects the prior range with the bounds, and the message at :208-218 blames the bounds.

6. PEtab export: a dose-response replicate file whose dose column is not first is reported as having an unknown observable

What the user does. Fits experiment: dr, data: rep1.exp, swapcols.exp, where rep1.exp has the header # L A_tot B_tot and swapcols.exp has # B_tot L A_tot. The fitter reads both files by column name and scores all 10 points (n = 10 in the information criteria).

What they see. export_job fails with "Exp column 'L' matches no observable, function, or measurement model in model 'm.bngl' (its observables: ['A_tot', 'B_tot'] ...)". L is the dose parameter.

What it should do. Find the dose column by name, as the fitter does, or refuse with a message saying that the dose column must come first in every replicate file.

Where. pybnf/petab/export.py:1115 takes each file's own first column as the dose axis. The error comes from :1171. Open PR #943 does not change this.

7. PEtab import: a dose-response whose noise parameter changes from dose to dose fails with "almost certainly a typo"

What the user does. Imports a steady-state dose-response (conditions setting L = 1, 2, 5) with the noiseFormula noiseParameter1_obs_resp declared in noisePlaceholders. The noiseParameters column is sd_a, sd_a, sd_b. libpetab lint reports no issues.

What they see. The imported job fails at load with "The free parameter(s) sd_a, sd_b are declared in the .conf file but match no parameter id in any model file ... so this is almost certainly a typo." The importer wrote sigma = formula noiseParameter1_obs_resp but did not write the file that assigns sd_a or sd_b to each measurement. It writes that file for a time course. When sd_a is used at every dose, the same problem imports and runs.

What it should do. Write that file for a dose-response too, or refuse at import and say that a noise parameter that changes from dose to dose is not supported for a dose-response.

Where. pybnf/petab/import_.py:1240-1258 (_dose_response_experiments always writes no per-measurement file). Compare the time-course path at :1231-1234. The error comes from config.py:3930.

8. tools/changelog_merge.py says "no merge in progress" in a git worktree

What the user does. Runs python tools/changelog_merge.py in a git worktree while git merge is stopped on a CHANGELOG.md conflict.

What they see. "CHANGELOG.md not resolved: no merge in progress." The same merge in an ordinary checkout resolves.

What it should do. Find the merge. In a worktree, .git is a file and MERGE_HEAD lives under .git/worktrees/<name>/. git rev-parse --git-path MERGE_HEAD gives the right path in both cases.

Where. tools/changelog_merge.py:205-206.

Crashes

9. A deeply nested formula crashes PEtab import and export with a bare RecursionError

What the user does. (a) Converts Benchmark-Models-PEtab Chen_MSB2009 with petab1to2_preserve_scale and runs import_job on the result. (b) Runs export_job(conf, out, inline_functions=True) on a job whose fitted BNGL function is nested about 200 parentheses deep, for example f()=(x+(x+(x+...k))). Depth 150 exports.

What they see. RecursionError: maximum recursion depth exceeded, from inside petab's formula parser.

What it should do. Import Chen, or at least refuse with a PyBNF error that names the observable and says the formula is nested too deeply.

Where. (a) Chen's ERB_B1_P_tot observable is a flat sum of 180 terms divided by a scale placeholder, which petab parses. PyBNF substitutes the scale and prints the sum back as 179 nested parentheses. The round-trip check then re-parses that text and overflows the stack (pybnf/petab/formula.py:180-181 → :459). (b) pybnf/petab/formula.py:89 → :436. Open PR #946 still crashes at depth 200.

Found while fixing the PEtab issues #892–#908 (2026-09-25); reproduced on main at cd2be675.

主要语言
Python
星标
25
派生
25
平均合并
4 小时 5 分钟
30 天内合并 PR
10

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

lanl/PyBNF 的其他 Issue

查看 lanl/PyBNF 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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