Skip to content

Sort concatenated data tables by energy#251

Merged
zblz merged 1 commit intomainfrom
fix/247-data-table-sort-order
Feb 13, 2026
Merged

Sort concatenated data tables by energy#251
zblz merged 1 commit intomainfrom
fix/247-data-table-sort-order

Conversation

@zblz
Copy link
Copy Markdown
Owner

@zblz zblz commented Feb 13, 2026

Summary

  • When multiple data tables are passed to validate_data_table in non-monotonic energy order (e.g. [vhe_table, xray_table]), the concatenated table had unsorted energies
  • This caused model curves to zigzag in plots and broke scipy.interpolate.interp1d in residual computation
  • Fitting was unaffected (per-point likelihoods are order-independent)
  • Fix: sort the concatenated table by energy after merging. The group column preserves per-table identity for plot styling

Test plan

  • Added test_reversed_table_order — verifies energies are sorted regardless of input order and that both orderings produce the same result
  • Full test suite passes (tox -e py313 -- tests/)

Closes #247

When multiple data tables are passed in non-monotonic energy order
(e.g. VHE before X-ray), the concatenated table had unsorted energies.
This caused model curves to zigzag in plots and broke interpolation.

Sort by energy after concatenation so plotting and interpolation work
correctly regardless of input table order. The group column preserves
per-table identity for styling.

Closes #247
@zblz zblz enabled auto-merge February 13, 2026 09:09
@zblz zblz merged commit ba20a64 into main Feb 13, 2026
12 of 13 checks passed
@zblz zblz deleted the fix/247-data-table-sort-order branch February 13, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data table order

1 participant