Skip to content

Fix plot_fit inconsistency with multi-component models#252

Open
zblz wants to merge 1 commit intomainfrom
fix/240-plot-fit-ssc-consistency
Open

Fix plot_fit inconsistency with multi-component models#252
zblz wants to merge 1 commit intomainfrom
fix/240-plot-fit-ssc-consistency

Conversation

@zblz
Copy link
Copy Markdown
Owner

@zblz zblz commented Feb 13, 2026

Summary

  • plot_fit now sets a default e_range when modelfn is available on the sampler, ensuring all model curves (ML line, confidence bands, samples) are evaluated over a dense logspace energy grid
  • Previously, the ML model line was extracted from emcee blobs evaluated only at the sparse data energy points, while confidence bands and samples were re-evaluated over a dense grid — this caused visual inconsistency, especially for multi-component models (e.g. SSC)
  • _calc_ML, _calc_CI, plot_samples, and _plot_MLmodel all now receive the same e_range, producing smooth, consistent curves
  • Updated docstrings for e_range and e_npoints parameters in plot_fit and plot_samples

Test plan

  • Added test_calc_ML_uses_dense_energy_grid — verifies that _calc_ML evaluates the model over a 100-point dense grid and matches direct model evaluation
  • Full test suite passes (tox -e py313 -- tests/)

Closes #240

@zblz zblz force-pushed the fix/240-plot-fit-ssc-consistency branch 2 times, most recently from 3adaeec to 668a703 Compare February 13, 2026 09:46
plot_fit now sets a default e_range (extending a factor of 3 beyond the
data energy limits) when modelfn is available, ensuring that _calc_ML,
_calc_CI, plot_samples, and _plot_MLmodel all re-evaluate the model over
a dense logspace grid instead of using sparse data energy points.
@zblz zblz force-pushed the fix/240-plot-fit-ssc-consistency branch from 668a703 to 8c19543 Compare February 13, 2026 09:58
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.

plot_fit from an SSC model seems not consistent with its SED plot

1 participant