Skip to content

Fix flux conversion in likelihood scan tutorial - #338

Open
tomaskontrimas wants to merge 2 commits into
masterfrom
fix336-likelihood-scan
Open

tomaskontrimas wants to merge 2 commits into
masterfrom
fix336-likelihood-scan

Conversation

@tomaskontrimas

Copy link
Copy Markdown
Collaborator

Fixes the flux conversion in the likelihood scan tutorial (doc/sphinx/tutorials/likelihood_scan.ipynb) reported in #336, plus a few related corrections.

Flux conversion (#336)

The tutorial computed the flux model scaling factor once at the best-fit spectral index $\hat\gamma$ and reused it for the whole $(\Phi_0, \gamma)$ grid. Since the factor depends on $\gamma$, every scan point with $\gamma \neq \hat\gamma$ was placed at the wrong flux normalization, and the contours were only correct at $\hat\gamma$. The factor is now calculated for each $\gamma$ of the grid.

Other fixes

  • Evaluate the LLH ratio function at the fitted parameter values instead of the hard-coded [80.09, 3.21], and show that $\mathrm{TS} = 2 \times$ llhratio_value.
  • Mark the best fit at the fitted values (using mu2flux) instead of the grid minimum, and use the unblinded TS as the best-fit TS.
  • Use the geometric mean for the centers of the log-spaced flux bins.
  • Correct the $\Delta\log\mathcal{L}$ equation, which was missing the factor of 2, and follow the $-2\Delta\log\mathcal{L}$ convention of the NGC 1068 paper (arXiv:2211.09972) in the text and the colorbar label.
  • Make the best-fit marker visible in the legend, remove leftover _flux suffixes from variable names, and fix typos.

@tomaskontrimas tomaskontrimas self-assigned this Oct 28, 2026
Copilot AI balanced review requested due to automatic review settings October 28, 2026 18:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

This branch has not been deployed

No deployments
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.

Likelihood-scan tutorial reuses the best-fit flux scaling factor across the gamma grid

2 participants