Skip to content

Add reduced-chi2, KL, and whitened-signal density diagnostic plots#103

Merged
hombit merged 1 commit into
mainfrom
add-diagnostic-plots
Jul 20, 2026
Merged

Add reduced-chi2, KL, and whitened-signal density diagnostic plots#103
hombit merged 1 commit into
mainfrom
add-diagnostic-plots

Conversation

@hombit

@hombit hombit commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds per-band diagnostic plots that compare a survey's reported vs. model-corrected photometric uncertainties, in the same style as the existing whitened-signal plots.

  • Reduced χ²plot_chi2_distributions / make_chi2_distribution_plot: per-band lg(reduced χ²) distribution of full light curves, before and after correction, against a calibrated reference (the χ²_{N-1}/(N-1) mixture over the empirical light-curve-length distribution).
  • KL statisticplot_kl_distributions / make_kl_distribution_plot: per-band lg(KL) of the per-light-curve KLWhitenLc statistic ½(μ² + σ² − ln σ² − 1), against a Monte-Carlo calibrated reference.
  • Density heatmapsplot_whiten_density / plot_addmagerr_density: P(z | mag) and P(Δm | mag) per band (2D companions to the whitened-signal histograms).
  • Driversscripts/plot_reduced_chi2.py, scripts/plot_kl.py: load a trained model, reconstruct its input columns, and render the figures.

Notes

  • The reduced χ² is computed with the O(n) inverse-variance-weighted formula, which is identically Σ_j z_j²/(N−1); no whitening matrix is built.
  • Uncertainties are corrected by the model's error-scaling factor only (no signal correction).
  • Colors/layout follow plot_whiten_distributions (uncorrected = filled, corrected = line; colorblind-safe tableau-colorblind10).
  • Verified end-to-end on DP1 forced and difference-image photometry (test split) on all six bands.

- plot_chi2_distributions / make_chi2_distribution_plot: per-band
  lg(reduced chi2) distributions of full light curves, before and after
  the model uncertainty correction, against the calibrated
  degrees-of-freedom mixture over the light-curve length distribution.
- plot_kl_distributions / make_kl_distribution_plot: per-band lg(KL)
  distributions of the per-light-curve KLWhitenLc statistic against a
  Monte-Carlo calibrated reference.
- plot_whiten_density / plot_addmagerr_density: per-band heatmaps of the
  whitened signal and added magnitude error vs object magnitude.
- scripts/plot_reduced_chi2.py and scripts/plot_kl.py: CLI drivers that
  apply a trained model and render the figures.
@hombit
hombit enabled auto-merge July 20, 2026 14:14
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 7.94521% with 336 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.22%. Comparing base (4a2e847) to head (008ec4d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/uncle_val/pipelines/plotting.py 7.94% 336 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #103      +/-   ##
==========================================
- Coverage   63.18%   53.22%   -9.96%     
==========================================
  Files          32       32              
  Lines        1654     2018     +364     
==========================================
+ Hits         1045     1074      +29     
- Misses        609      944     +335     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hombit
hombit merged commit 2ab881c into main Jul 20, 2026
6 of 8 checks passed
@hombit
hombit deleted the add-diagnostic-plots branch July 20, 2026 14:20
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.

1 participant