Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de 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

Abierto Apto para principiantes
#954 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Empieza en pybnf/petab/conditions.py, en read_experiment_table alrededor de la línea 676, y compara después el tratamiento de los tiempos en blanco con _require_float en pybnf/petab/measurements.py:689-693. Haz que los tiempos de experimento en blanco o ausentes provoquen un PybnfError que indique el experimento, y añade pruebas que cubran el ejemplo de dosis-respuesta y la columna de tiempo ausente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
25
Forks
25
Merge medio
2 h 38 min
PR fusionados (30 d)
98

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lanl/PyBNF

Todos los issues de lanl/PyBNF

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.