A condition that sets the same target twice (perturbations: L = 2, L = 7) is accepted, and the last value silently wins

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

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

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

評価

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

調査の方向性

Start with the condition grammar in pybnf/parse.py around lines 604–635 and the condition loading in config.py. Trace how repeated perturbation targets are applied, then inspect the PEtab export path. Done means duplicate targets are rejected with the condition and target named, with coverage for both backends and the export.

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

説明

bug silent-incorrectness

A condition: line may list the same parameter more than once, for example condition: c, perturbations: L = 2, L = 7. PyBNF accepts it without a message and applies the values in order, so the experiment runs at L = 7 on both BNG2.pl and bngsim. A line like this is almost always a mistake, such as a copy-paste slip or two conditions merged by hand. Nothing says which value was meant, so PyBNF should refuse it at load and name the condition and the target. The PEtab export also writes both rows (cond_c L 2 and cond_c L 7) into conditions.tsv, and libpetab's lint accepts them, so the ambiguity passes into the exported problem too.

Example

m.bngl (A is made at rate L and decays at rate k·A, starting from 0):

begin model
begin parameters
  k 1
  L 1
end parameters
begin molecule types
  A()
end molecule types
begin seed species
  A() 0
end seed species
begin observables
  Molecules A_tot A()
end observables
begin reaction rules
  0 -> A() L
  A() -> 0 k
end reaction rules
end model

e1.exp holds 2(1 − e^(−t)) at t = 0, 0.5, 1, 2, 4, which is the model at L = 2 and k = 1.

edition = 2
job_type = de
objective = sos
model: m.bngl
condition: c, perturbations: L = 2, L = 7
experiment: e1, condition: c, data: e1.exp
uniform_var = k 0.99999 1.00001

The narrow box on k makes every evaluation use k ≈ 1:

backend objective
bngl_backend = bngsim 28.3212
bngl_backend = bionetgen 28.3212
closed form at L = 7 28.3218
closed form at L = 2 0

The closed forms are 0.5·Σ(L(1 − e^(−t)) − y)². Both backends use L = 7. Neither the console nor the log mentions the duplicate. export_job writes both rows for cond_c, and petab.v2.lint.lint_problem returns no issues.

The same line can come out of a PEtab import. On main, two PEtab condition ids that map to one PyBNF name (cond_a and a) are merged into a single condition: line with both targets (see #950). Open PR #947 refuses that merge.

Why

The condition: grammar (pybnf/parse.py around 604–635) accepts any list of perturbations, and config.py's condition loading turns each one into a mutation applied in order, with no check for a repeated target. The exporter writes one row per perturbation.

Possible fix

When the conf loads, refuse a condition that names the same target more than once, whatever the operators (L = 2, L = 7, and also L = 2, L * 3). The error should name the condition and the target. Add a test on both backends and one for the export.

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

主要言語
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 を短くまとめたダイジェスト。