Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

The PEtab importer reads a blank time in the experiments table as 0 instead of refusing the problem, so a pre-equilibration whose -inf was left blank is dropped from a dose-response

Đang mở Phù hợp với người mới
#954 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/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

Hướng nghiên cứu

Bắt đầu trong pybnf/petab/conditions.py tại read_experiment_table, khoảng dòng 676, sau đó so sánh cách xử lý thời gian trống với _require_float trong pybnf/petab/measurements.py:689-693. Làm cho thời gian thí nghiệm để trống hoặc bị thiếu phát sinh một PybnfError có nêu tên thí nghiệm, và thêm các test bao quát ví dụ dose-response cùng cột thời gian bị thiếu.

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 PEtab v2 experiments table must give every period a start time. libpetab refuses a blank one ("time value must be finite or -inf but got nan"). PyBNF's importer instead reads a blank time as 0 and carries on. The worst case on main is a dose-response in which each dose is preceded by an equilibration period whose -inf was left blank. The equilibration is dropped without a message, every dose starts from the seed species instead of the equilibrated state, and the imported job scores 13.0 at the parameter value that generated the data, where the correct score is 0. In other shapes the blank either produces an error that names times the user never wrote ("times [0.0, 0.0]") or lets an invalid problem import. The importer should refuse a blank time and name the experiment, as the measurements reader already does for a blank measurement time.

Example

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

begin model
begin parameters
  kp  4
  k   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() kp
  A() -> 0 k
end reaction rules
end model

PEtab v2 tables (problem.yaml lists these five tables and m.bngl with language: bngl). The three cells marked <blank> are empty in the file:

# parameters.tsv
parameterId  estimate  lowerBound  upperBound  nominalValue
k            true      0.1         10          1
# observables.tsv
observableId  observableFormula  noiseFormula  noiseDistribution
obs_A         A_tot              1             normal
# conditions.tsv
conditionId  targetId  targetValue
cond_pre     kp        8
cond_dr_1    kp        1
cond_dr_2    kp        2
cond_dr_3    kp        4
# experiments.tsv
experimentId  time     conditionId
dr_1          <blank>  cond_pre
dr_1          0        cond_dr_1
dr_2          <blank>  cond_pre
dr_2          0        cond_dr_2
dr_3          <blank>  cond_pre
dr_3          0        cond_dr_3
# measurements.tsv   (steady state under kp = 8, then 1 time unit at the dose, k = 1)
observableId  experimentId  time  measurement
obs_A         dr_1          1     3.575156
obs_A         dr_2          1     4.207277
obs_A         dr_3          1     5.471518

The readings are A(1) = d + (8 − d)e^(−1) for doses d = 1, 2, 4. That is what the problem means when the blanks are -inf.

  • libpetab 0.9.0: Problem.from_yaml raises ValidationError ... time value must be finite or -inf but got nan. With the time column removed altogether, ExperimentTable.from_tsv raises KeyError: 'time'.
  • PyBNF: import_job('petab/problem.yaml', 'imported') succeeds and writes experiment: dr, method: ode, t_end: 1, data: dr.exp, with no preequilibrate:. At k = 1 it simulates A = 0.632, 1.264, 2.528 against the readings 3.575, 4.207, 5.472, and the objective is 12.99. The same tables with -inf written in the blank cells import as experiment: dr, preequilibrate: pre, method: ode, t_end: 1 and score 7e-14.

Other shapes:

experiments.tsv rows for e1 libpetab PyBNF on main
<blank> cond_pre, 0 cond_on (a time course) refuses refuses, but the error names "times [0.0, 0.0]", which the user never wrote
<blank> cond_on (a single period) refuses imports as a time course that starts at 0
no time column at all refuses (KeyError) every period is read as starting at 0

Why

read_experiment_table (pybnf/petab/conditions.py:676) writes float(time) if time and time.strip() else 0.0, so an empty or missing time becomes 0. The measurement-table reader refuses a blank time (_require_float, pybnf/petab/measurements.py:689-693). In the example, the blank equilibration period is read as starting at 0, so the pre-equilibrated dose-response reconstruction does not recognise it (it looks for a -inf period, measurements.py:530). The plain dose-response reconstruction then takes each experiment's last row as its only condition (measurements.py:408, the defect in #904), and the equilibration period is lost.

Possible fix

In read_experiment_table, raise a PybnfError that names the experiment when the time cell is blank or the column is missing, as _require_float does for measurements. Add a test for the dose-response example above and for the missing column.

Open PR #947 (the fix for #904) makes the dose-response example fail to import, with "Experiment 'dr_1' applies 2 conditions at the same time (0)". That error is loud, but it names a time of 0 that the user never wrote. PR #940 does not change the example. Neither PR changes read_experiment_table.

Related: #904.

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

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

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.