Skip to content

Replace covariance stages with two unified TJPCov v0.5 wrappers - #479

Draft
joezuntz with Copilot wants to merge 3 commits into
masterfrom
copilot/remove-covariance-classes
Draft

Replace covariance stages with two unified TJPCov v0.5 wrappers#479
joezuntz with Copilot wants to merge 3 commits into
masterfrom
copilot/remove-covariance-classes

Conversation

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Five covariance classes with duplicated, hand-rolled Gaussian/NaMaster logic are replaced by two thin wrapper stages that delegate entirely to TJPCov v0.5's CovarianceCalculator. The covariance type and all options move into the pipeline config.

Removed

  • TXFourierGaussianCovariance, TXRealGaussianCovariance — hand-rolled Knox formula
  • TXFourierTJPCovariance — partial TJPCov integration with TXPipe-side coupling matrix management
  • TXFourierNamasterCovariance, TXRealNamasterCovariance — direct NaMaster calls

New classes (txpipe/covariance.py)

  • TXFourierCovariance — reads cosmology, tracer metadata, and twopoint_data_fourier; builds TJPCov config; calls CovarianceCalculator; writes summary_statistics_fourier
  • TXRealCovariance — same pattern for real space

covariance_nmt.py is emptied with a note; __init__.py and all example configs updated.

Configuration

All TJPCov options are expressed in the TXPipe config. Covariance type is freely composable:

TXFourierCovariance:
    cov_type: [FourierGaussianFsky, FourierSSCHaloModel]
    galaxy_bias: [1.4, 1.5, 1.7]   # per lens bin; default 1.0
    IA: 0.5
    fsky: -1.0                      # auto-computed from tracer_metadata if negative
    outdir: ./cache

TXRealCovariance:
    cov_type: [RealGaussianFsky]

Tracer noise (sigma_e, Ngal) is populated automatically from tracer_metadata. The use_true_shear flag zeroes shape noise for noiseless simulations.

Copilot AI and others added 2 commits July 3, 2026 09:57
Co-authored-by: joezuntz <220537+joezuntz@users.noreply.github.com>
Co-authored-by: joezuntz <220537+joezuntz@users.noreply.github.com>
Copilot AI changed the title Rewrite covariance classes using TJPCov v0.5 Replace covariance stages with two unified TJPCov v0.5 wrappers Jul 3, 2026
Copilot AI requested a review from joezuntz July 3, 2026 10:00
Co-authored-by: joezuntz <220537+joezuntz@users.noreply.github.com>
@carlosggarcia

carlosggarcia commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@joezuntz Following up from the parallel. I think this is the PR you referred to. I had a quick look and I think what you wanted to do (TJPCov doing the heavy lifting) is doable with TXFourierTJPCovariance (

class TXFourierTJPCovariance(PipelineStage):
) and TXRealGaussianCovariance (
class TXRealGaussianCovariance(TXFourierGaussianCovariance):
).

If we see some of these are missing something, I'd build on these, delete all the other options (including the covariance_nmt.py file) and completely ignore copilot in this one.

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.

3 participants