pybird.io_pb module

pybird.io_pb.get_dict_from_hdf5(group, none_flag=nan)[source]

Recursively read data from an HDF5 group into a Python dictionary.

Parameters:
  • group (h5py.Group) – HDF5 group to read from.

  • none_flag (float, optional) – Value used to represent None in the HDF5 file. Defaults to float(“nan”).

Returns:

Dictionary containing all datasets and subgroups from the HDF5 group.

Return type:

dict

pybird.io_pb.save_dict_to_hdf5(group, data, none_flag=nan)[source]

Recursively save a Python dictionary to an HDF5 group.

Parameters:
  • group (h5py.Group) – HDF5 group to write to.

  • data (dict) – Dictionary to save to HDF5.

  • none_flag (float, optional) – Value to use when saving None values. Defaults to float(“nan”).

class pybird.io_pb.ReadWrite[source]

Bases: object

A class for reading, writing, and formatting cosmological data files.

This class handles I/O operations for cosmological power spectra and correlation functions, including reading HDF5 files, formatting data for analysis, and writing results to various output formats.

None
Type:

all data is passed through method parameters

read()[source]

Read data from HDF5 file and format for analysis.

check()[source]

Validate data against configuration parameters.

config()[source]

Prepare configuration dictionary for correlator.

format()[source]

Format raw data for analysis.

write()[source]

Write results to output files.

write_common()[source]

Write common cosmological parameters to output.

write_pk()[source]

Write power spectrum data to output.

write_cf()[source]

Write correlation function data to output.

write_bao_rec()[source]

Write BAO reconstruction data to output.

set_header()[source]

Create header for output files.

get_wedge_rotation_matrix()[source]

Get matrix for multipole to wedge conversion.

read(c, verbose=True)[source]
check(c, d, verbose=True)[source]
config(c, fd_sky)[source]
format(c, data, verbose=True)[source]
write(c, fd_sky, out=None)[source]
write_common(d_sky, zmin, zmax, zeff, Omega_m_fid, H_fid, D_fid)[source]
write_pk(d_sky, mult_pk, kk, pk, cov_pk, nsims_cov_pk=0, survey_mask_arr_p=None, survey_mask_mat_kp=None, binsize=None)[source]
write_cf(d_sky, mult_cf, ss, cf, cov_cf, nsims_cov_cf=0, binsize=None)[source]
write_bao_rec(d_sky, bao_rec_rd_fid, bao_rec_H_fid, bao_rec_D_fid, alpha_par, alpha_per, cov_alpha, cov_cross_pk=None, cov_cross_cf=None)[source]
set_header(out)[source]
get_wedge_rotation_matrix(wedge_type='PA-w1-w2')[source]