Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Legacy model line: two .exp files with the same file name in different directories collapse to one key and the first is silently dropped

Open
#834 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

The bug is in pybnf/config.py lines 2838-2839 and 2855 where _file_prefix strips the directory, causing collisions. Start by reading the _load_exp_data and _file_prefix methods. Check how _data_map is populated at lines 1022 and 1515. Write a test that loads two .exp files with the same basename from different directories and verify that an error is raised, matching the behavior of _load_analytical_data. Run existing tests to ensure no regression.

Written by the indexing model from the issue text.

Description

bug

_load_exp_data stores each data file at ed[m][self._file_prefix(ef)] (2855). _file_prefix keeps only the basename without extension (2838-2839). Two files in _data_map[m] (filled at 1022 and 1515) with the same basename therefore write the same key, and the last one wins with no warning. _check_actions (2871-2886) builds a set of prefixes, so it also reports nothing. The analytical-objective loader (_load_analytical_data, 1466-1472) raises a clear error on the same stem collision, so a collision is clearly meant to be an error.

Failure scenario

'model = parabola.bngl : rep1/par1.exp, rep2/par1.exp' (replicate files kept in two folders). Config loads without a message, exp_data has one 'par1' entry holding rep2's values, and the fit scores only half the data: the reported n, objective and information criteria silently omit rep1.

Reproduction (independent re-run)

Setup: rep1/par1.exp is the demo data (true v=(0.5,1,3)); rep2/par1.exp is the same data with y+2. Configs were loaded with load_config (pybnf from pybnf/init.py).

Load: both.conf gives exp_data keys=['par1'], y(t=0)=[45.0] (rep2 only), 21 data rows scored, and mapping={'parabola': {'par1'}}. No warning was raised.

Objective from PyBNF's real evaluate_multiple on both.conf, compared with the correct value (rep1-only conf plus rep2-only conf, which matches a hand numpy value of 0.5*chi2 over both files):

  • v3=4 (correct pooled optimum): PyBNF 10.5, correct 21.0.
  • v3=5: PyBNF 0.0, correct 42.0. PyBNF calls v3=5 a perfect fit when it is not the optimum.

End-to-end CLI fit (python -m pybnf -c both.conf -o, DE with 20x30 budget, seed 1): best fit v3=5.048 with obj=0.0786. The correct pooled optimum is v3=4. The console printed "AIC=83.3481 BIC=88.5611 (k=3, n=42)": n=42 is one file's 21 rows x 2 columns, where the correct n is 84. No warning appeared anywhere in the log.

Reachability

model = parabola.bngl : rep1/par1.exp, rep2/par1.exp, with fit_type = de and objfunc = chi_sq, run through python -m pybnf -c both.conf -o. It also applies to legacy mutant ... : dirA/xyz.exp, dirB/xyz.exp lines, which extend the same _data_map at config.py:1515.

Where

pybnf/config.py:2855

Found in a whole-codebase audit for silently wrong results (2026-09-23); the reproduction above was re-run independently of the original finding.

Dominant language
Python
Stars
25
Forks
25
Avg merge
2h 24m
Merged PRs (30d)
85

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/PyBNF

All issues in lanl/PyBNF

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.