Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-228: results with multiple \ell axes #232

Merged
merged 3 commits into from
Feb 12, 2025
Merged

gh-228: results with multiple \ell axes #232

merged 3 commits into from
Feb 12, 2025

Conversation

ntessore
Copy link
Contributor

@ntessore ntessore commented Feb 6, 2025

Adds support for multiple $\ell$ axes to the Result class. This can be used to read and write, e.g., covariance matrices.

I had to add this to Result instead of the CovMatrix class since I couldn't figure out a good way to recover the correct class (Result, CovMatrix, or potentially classes for spectra or mixing matrices) from either read() or binned(). With one multi-purpose class, the problem doesn't arise.

To create a covariance matrix or other result with a second $\ell$ axis:

cov = heracles.Result(
    arr,
    ell=(ell_1, ell_2),  # optional
    axis=(-2, -1),  # optional
    lower=(lower_1, lower_2),  # optional
    upper=(upper_1, upper_2),  # optional
    weight=(weight_1, weight_2),  # optional
)

What determines the $\ell$-dimension of the result is the value of result.axis. If axis is not given explicitly, the last len(ell) axes are used (e.g. -2, -1). So either ell or axis must be given for multiple $\ell$ axes, otherwise, a single $\ell$ axis of -1 is assumed.

Closes: #228

Copy link
Contributor

@JaimeRZP JaimeRZP left a comment

Choose a reason for hiding this comment

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

LGTM except for the fact that I understand why we have this new added degree of freedom in the order of the axis, weights, etc ...

@ntessore
Copy link
Contributor Author

Thanks @JaimeRZP! merging now

@ntessore ntessore merged commit e7be93f into main Feb 12, 2025
9 checks passed
@ntessore ntessore deleted the nt/228 branch February 12, 2025 09:14
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.

Update read()/write() functions for covariance
2 participants