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

Đang mở
#964 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
25
Fork
25
Merge trung bình
4 giờ 5 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lanl/PyBNF

Tất cả issue của lanl/PyBNF

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.