Follow-up to the PEtab fixes: three valid jobs are refused, by checks added in PRs #940 and #943 and by numbered BNGL action lines that PyBNF does not recognise

オープン
#963 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend, testing

調査の方向性

Start by reproducing the three cases described for PEtab export and numbered BNGL actions, comparing behavior on main and the referenced PR branches. Inspect export_job and the BNGLModel action scanner in pybnf/pset.py. Done means valid near-equal doses, molecule components named time, and numbered actions are handled without refusing or silently dropping valid work, with regression tests for each case.

索引モデルが issue の本文から書いたものです。

説明

bug high priority

Three checks refuse jobs that PyBNF should handle. None of them gives a wrong result without a message; each stops a job that is valid. Two of the checks were added by the PEtab fixes in open PRs #940 and #943, so they reach users once those PRs merge. The third is older: PyBNF does not recognise BNG's numbered action lines. On main that makes every simulation fail, and PR #944's export refuses the same file. Each is described below with the fix.

1. PR #943: two doses one float step apart are refused as "near-duplicates"

A parameter-scan experiment with two replicate files, where one file writes the dose as 0.3 and the other as 0.30000000000000004 (the same number after a floating-point sum), is refused by the PEtab export:

edition = 2
model: m.bngl
experiment: dr, data: ulp1.exp, ulp2.exp
uniform_var = kd 0.1 10
uniform_var = kb 0.1 10

ulp1.exp is # L A_tot B_tot / 0.3 0.15 0.1 / 1 0.5 0.45, and ulp2.exp is # L A_tot B_tot / 0.30000000000000004 0.16 0.1.

On #943's branch, export_job raises: "Experiment 'dr' has two distinct doses L = 0.3 (in 'ulp1.exp') and L = 0.30000000000000004 (in 'ulp2.exp') that differ by less than the fitter's dose-matching tolerance (relative 1e-05) …". main exports the job, with both rows under dr_0 at L = 0.3.

The refusal exists because the fitter matches a data row to a simulated dose within a relative 1e-5 (np.isclose, rtol = 1e-5). Between two doses that close but distinct, the fitter and a PEtab tool can pair a measurement with different simulations. For doses one or a few floating-point steps apart, however, both simulations are the same to machine precision, so exporting them as one dose is exact.

Fix: treat doses equal to within a few units in the last place as one dose, and refuse only above that, up to the fitter's tolerance.

2. PR #940: a molecule component named time is taken to mean the model reads the clock

PR #940 refuses to export a fixed-duration equilibration (equil_t_end:) for a model that reads the simulation time. Its detector also fires on a molecule type with a component named time:

begin molecule types
  A()
  T(time~0~1)
end molecule types
...
begin reaction rules
  0 -> A() kp
  A() -> 0 k*flag
  T(time~0) -> T(time~1) kf
end reaction rules

with experiment: relax, preequilibrate: pre, condition: meas, equil_t_end: 0.1, data: relax.exp.

On #940's branch, export_job raises "… on model 'm.bngl', which reads the simulation time (the 'time' symbol (time() or a time-indexed tfun)) …". The model never reads time: time is a component name here.

Fix: match time() as a function call, a time-indexed tfun, or the name used in an expression, and never inside a species or molecule-type pattern.

3. Numbered action lines (1 generate_network(...)) are not recognised

BNG2.pl accepts a line index in front of an action, and runs this file without complaint:

begin actions
1 generate_network({overwrite=>1})
2 simulate({method=>"ode",t_end=>5,n_steps=>5})
end actions

PyBNF's action scanner matches generate_network only at the start of the line, so it treats 1 generate_network(...) as an ordinary action. The effect differs by branch:

  • On main, an edition-2 fit of this model (experiment: tc, data: tc.exp, a first-order decay) keeps that line in every evaluation's model. There it runs against the .net file PyBNF has already generated, and BNG2.pl aborts every simulation with "Nothing to do: no reaction rules defined". The fit ends "Fitting complete" with objective inf, and the reason is only in each simulation's log.
  • On PR #944's branch, the export refuses the model, calling both lines actions "that the fit runs before its experiments but the PEtab export would drop".
  • On main, the export drops both lines, including the generate_network.

Fix: strip a leading line index when scanning actions (BNGLModel in pybnf/pset.py), so a numbered generate_network is recognised as one and a numbered simulate as a simulation action. The planned edition-2 rule that refuses hand-written state-changing actions at load should use the same scanner.

Found while fixing the PEtab issues #892–#908 (2026-09-25). Items 1 and 2 were reproduced on the PR branches, and item 3 on main at cd2be675 and on #944's branch.

主要言語
Python
スター
25
フォーク
25
平均マージ
4時間 5分
マージ済み PR(30日)
10

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lanl/PyBNF のほかの issue

lanl/PyBNF の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。