Skip to content

Issue/78/sacc#91

Open
Lhior wants to merge 8 commits into
LSSTDESC:mainfrom
Lhior:issue/78/sacc
Open

Issue/78/sacc#91
Lhior wants to merge 8 commits into
LSSTDESC:mainfrom
Lhior:issue/78/sacc

Conversation

@Lhior

@Lhior Lhior commented Feb 9, 2026

Copy link
Copy Markdown

QP/SACC interface #78

There was no direct way to move redshift distributions n(z) between qp Ensemble format (typical for RAIL pipelines) and sacc.Sacc format (used in cosmology analyses and PriorSacc). Based heavily on Jaime's nz_prior example.

Solution

Implemented sacc_tools with RailStage converters and helpers:

  • QPToSACC – Converts n(z) from qp Ensemble files (one per tomographic bin) to a single sacc.Sacc catalog with QPNZ tracers. Supports optional truth files and flexible input (list of paths or {tracer_name: file_path}).
  • SACCToQP – Converts n(z) from a sacc catalog back to qp Ensemble files on disk, one per QPNZ tracer.
  • normalize_hist() – Normalizes histogram PDFs so they integrate to 1.
  • extract_tomographic_bins_from_sacc() – Extracts a tomographic bin structure from sacc catalogs.
  • Demo notebook (sacc_qp_interface_demo.ipynb) – Round-trip workflow using gold-baseline data provided by @eacharles during the Princeton sprint week. I think bin 0 is a little buggy from previous talks with Eric but can't remember if the culprit was identified (plotting script or the data file itself)
  • Unit tests (tests/astro_tools/test_sacc_tools.py) – 26 tests for all public APIs.
  • Dependencies – Added qp-prob>=1.0 and sacc>=2.1 to pyproject.toml.

Code Quality

  • [✅] My code follows the code style of this project
  • [✅] I have written unit tests or justified all instances of #pragma: no cover; in the case of a bugfix, a new test that breaks as a result of the bug has been added
  • [✅] My code contains relevant comments and necessary documentation for future maintainers; the change is reflected in applicable demos/tutorials (with output cleared!) and added/updated docstrings use the NumPy docstring format
  • [N/A?] Any breaking changes, described above, are accompanied by backwards compatibility and deprecation warnings

@Lhior Lhior marked this pull request as ready for review February 9, 2026 19:57
@eacharles

Copy link
Copy Markdown
Collaborator

These changes look good, but could you update your branch to the main.

@eacharles

Copy link
Copy Markdown
Collaborator

Sorry. I didn't see this until now.

@eacharles eacharles self-requested a review March 5, 2026 17:42

@eacharles eacharles left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Please just rebase your branch against main before merging.

@codecov

codecov Bot commented Mar 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.87%. Comparing base (4a656d6) to head (0c40a66).

Additional details and impacted files
@@             Coverage Diff             @@
##              main      #91      +/-   ##
===========================================
- Coverage   100.00%   99.87%   -0.13%     
===========================================
  Files           15       16       +1     
  Lines         1447     1662     +215     
===========================================
+ Hits          1447     1660     +213     
- Misses           0        2       +2     

☔ View full report in Codecov by Sentry.
📢 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.

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.

2 participants