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

Aperta
#963 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
25
Fork
25
Merge medio
4h 5m
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lanl/PyBNF

Tutte le issue di lanl/PyBNF

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.