Repository navigation
Conversation
Add RealSpaceMixin.save_2pcf_sacc, which serialises the TreeCorr output of
calculate_2pcf_version into the sacc_io layout: the source_{i} n(z) tracers
and one xi+/xi- block per tomographic bin pair.
Serialising lives on the class because it needs the version's n(z) and its
tomographic bin map; run_2pcf.py only decides where the file goes, from the
sacc_path param under Snakemake and from --sacc on the CLI.
Insertion order is load-bearing: add_xi writes one pair as [xi+; xi-], so the
data vector is pair-major and the covariance is tied to it by position alone.
The bin pairs are sorted once and that list drives every subsequent loop.
Catalog bin ids are mapped to 0-based SACC indices from the ids actually
present, rather than by subtracting 1, so a catalog that starts elsewhere or
skips a bin still lands on the right source_{i} tracer. A mismatch between the
n(z) column count and the measured bin count raises: the columns are never
summed or truncated to make up the difference.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
LisaGoh
marked this pull request as draft
August 5, 2026 08:33
LisaGoh
marked this pull request as ready for review
August 6, 2026 09:37
LisaGoh
marked this pull request as draft
August 6, 2026 09:38
LisaGoh
changed the base branch from
feature/sp_validation-extend-to-tomography
to
develop
August 6, 2026 10:25
LisaGoh
changed the base branch from
develop
to
feature/sp_validation-extend-to-tomography
August 6, 2026 10:25
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
…e/305-adapt-tomographic-2pcf-script-to-sacc_io-format
LisaGoh
marked this pull request as ready for review
October 9, 2026 10:13
LisaGoh
changed the base branch from
feature/sp_validation-extend-to-tomography
to
develop
October 20, 2026 09:57
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #305. Part of #376.
Writes tomographic ξ± as one SACC part, and puts the OneCovariance ξ± covariance (#256) into SACC in the right order.
developalready wrote the non-tomographic ξ± as a sealed part (xi_to_sacc, #251/#253). This extends that same writer to tomographic bin pairs rather than adding a second one, as agreed in #375/#376. Thepure_eb, test and plotting fixes from the first version of this PR are dropped (superseded ondevelop), and so is the earliersave_2pcf_sacc, which targeted the oldsacc_ioAPI.OneCovariance order ≠ SACC order
OneCovariance writes the real-space matrix type-major: all ξ+ (bin pairs
i ≤ j,iouter, then θ), then all ξ−. A ξ± part is pair-major: each pair's ξ+ then ξ−. The two agree only for a single bin, so a tomographic.datattached as-is (whatassemble_saccdid) would silently misalign the covariance. The matrix is now reordered to the part's points before it's attached.What changes
cosmo_val/sacc_writers.pyxi_pairs_to_sacc: one ξ± part over any set of bin pairs, pair-major, with an optional dense covariance or diagonal.xi_to_saccis now its single-pair form.onecov_xi_covariance(part, cov): OneCovariance's matrix permuted to the part's insertion order; refuses a matrix whose size doesn't match.sacc_io.read_onecov_matrix: reads the.dat(np.savetxtwith a#header) and checks it's square and symmetric.cosmo_val/real_space.py,calculate_2pcf_version(compute_tomography=True):source_itracer per bin;(0,0), (0,1), …, (n-1,n-1), which is OneCovariance's order;treecorr.estimate_multi_cov, so the correlations between pairs are kept; shot noise gives the diagonal;cv.xi_tomo_parts[ver, grid];xi_correlationviews of the sealed part, not raw TreeCorr objects, with the same attributes.cosmo_val/core.pysacc_nz(version, tomography=True): binitakes columni + 1ofredshift_path.blinding.shearalready works per tracer pair. Tomographic pseudo-Cℓ are still refused.run_2pcf.py --tomo; thexirule output is…_npatch={npatch}{tomo_suffix}.sacc(also removes a duplicatednpatchparam).xi_onecov→…{tomo_suffix}_onecov.sacc: the ξ± part with the OneCovariance matrix of its binning (NG on the reporting grid, G on the integration grid) as its covariance, reordered, keeping the part's blind. Script:workflow/scripts/xi_onecov_sacc.py(also runs from the command line).assemble_sacc.pyreorders--xi-covthe same way.Requirements
iis thei-th smallest catalogue bin ID, and must be columni + 1of the n(z) file. OneCovariance reads the same file, so its bins line up as long as columns are in ascending bin-ID order.Tested
read_onecov_matrix;sacc_nz(tomography=True);smokescreen).test_cosmo_val,test_sacc_writers,test_sacc_io,test_assemble_saccand the regression tests pass, apart from three failures that are already on the base commit (pure-E/B synthetic run, pure-E/B mapping, τ centring).…_tomo.sacc,…_tomo_onecov.saccand…_onecov.sacc; thecosmo_valpaper DAG is unchanged.xi_onecov_sacc.pyon a synthetic two-bin part with a type-major.datrecovers the expected pair-major covariance (to text precision) and keeps the blind stamp.Not yet checked
Out of scope
🤖 Generated with Claude Code