Skip to content

Add support to save clustering statistics in lsstypes (and other) formats#168

Open
epaillas wants to merge 3 commits intocosmodesifrom
cosmodesi-estimators-save
Open

Add support to save clustering statistics in lsstypes (and other) formats#168
epaillas wants to merge 3 commits intocosmodesifrom
cosmodesi-estimators-save

Conversation

@epaillas
Copy link
Owner

At the moment, the clustering estimator classes produce different kinds of outputs depending on the statistics (collection of correlation/power multipoles, coefficients, etc). Sometimes the data is saved as a simple 1D array (e.g. WST), sometimes as lists of pycorr objects (e.g. density split), etc, which can be confusing.

This PR begins to implement new save functions for the estimator classes, which can be used to save data as we currently are (for retrocompatibility), but more importantly, it allows us to save all statistics in a common lsstypes format (https://github.com/adematti/lsstypes), following the new standard for the clustering measurements produced by GQC. It also allows other formats (.nc or .zarr for xarray; only working for WST for now).

Output data format is given by the file suffix:

>>> wst.save('wst_coefficients.hdf5')  # lsstypes format
>>> wst.save('wst_coefficients.nc')     # xarray NetCDF
>>> wst.save('wst_coefficients.zarr')   # xarray Zarr
>>> wst.save('wst_coefficients.npy')    # numpy format

We can then read the data as e.g.

from lsstypes import read

data = read('ds_xiqg.h5')
xi = data.get(quantiles=4)
poles = xi.project(ells=[0, 2, 4])

@epaillas
Copy link
Owner Author

Ignore the "unit test for WST" commit, which is being reviewed in a separate PR.

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