Advanced functions
This list is not complete, but aims to provide references for the more used/useful extended features.
Covariance comparison functions
Compact measures for covariance matrix comparison introduced in Section 3.1 of Rashkovetskyi et al 2023 and briefly explained again in Section 2.2 of Rashkovetskyi et al 2025.
- RascalC.cov_comparison.rms_eig_inv_test_covs(C1: ndarray[tuple[Any, ...], dtype[float64]], C2: ndarray[tuple[Any, ...], dtype[float64]]) float[source]
Compute the R_inv comparison measure (see Equation 3.4 of Rashkovetskyi et al 2023 or Equation 2.17 of Rashkovetskyi et al 2025) between two covariance matrices; the first is inverted.
- RascalC.cov_comparison.KL_div_covs(C1: ndarray[tuple[Any, ...], dtype[float64]], C2: ndarray[tuple[Any, ...], dtype[float64]]) float[source]
Compute the Kullback-Leibler divergence between two covariance matrices; the first is inverted.
- RascalC.cov_comparison.chi2_red_covs(C1: ndarray[tuple[Any, ...], dtype[float64]], C2: ndarray[tuple[Any, ...], dtype[float64]]) float[source]
Compute the reduced chi-squared comparison measure (see Equation 3.4 of Rashkovetskyi et al 2023 or Equation 2.18 of Rashkovetskyi et al 2025) between two covariance matrices; the first is inverted.
Extra convergence check functions
Extra convergence check is performed in the main wrapper function (RascalC.run_cov()) and also performed by default in the automatic post-processing function (RascalC.post_process_auto()), but the following functions may be useful to run additionally.
Functions to perform extra convergence check on full (and jackknife) RascalC integrals. More specifically, divide integral subsamples into halves and check similarity of their average results. These methods work in any mode — e.g. jackknife, Legendre, multi-tracer — as they utilize universal data from a RascalC post-processed npz file.
- RascalC.convergence_check_extra.cmp_cov(cov_first: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.float64]], cov_second: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.float64]], print_function: ~typing.Callable[[str], None] = <function blank_function>) dict[str, float][source]
Compute the selected comparison measures between two covariance matrices and return as a dictionary. This method is decribed in Section 3.2 of Rashkovetskyi et al 2023. Optionally, use
print_functionto report the results.
- RascalC.convergence_check_extra.convergence_check_extra_splittings(c_samples: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.float64]], n_samples: int | None = None, print_function: ~typing.Callable[[str], None] = <function blank_function>) dict[str, dict[str, float]][source]
Perform two different splittings in halves using the covariance matrix samples
c_samples, compute the comparison measures between the two average covariance matrices and return as a dictionary. This method is decribed in Section 3.2 of Rashkovetskyi et al 2023. Optionally, use onlyn_samplesfirst samples. Further optionally, useprint_functionto report the results.
- RascalC.convergence_check_extra.convergence_check_extra(rascalc_results: dict[str], n_samples: int | None = None, print_function: ~typing.Callable[[str], None] = <function blank_function>) dict[str, dict[str, dict[str, float]]][source]
Perform two different splittings in halves using the RascalC results file/dictionary, compute the comparison measures between the two average covariance matrices and return as a dictionary. Do this for full and jackknife covariance matrices (if the latter are present). This method is decribed in Section 3.2 of Rashkovetskyi et al 2023. Optionally, use only
n_samplesfirst samples. Further optionally, useprint_functionto report the results.
- RascalC.convergence_check_extra.convergence_check_extra_file(rascalc_results_filename: str, n_samples: int | None = None, print_function: ~typing.Callable[[str], None] = <function blank_function>) dict[str, dict[str, dict[str, float]]][source]
Perform two different splittings in halves using the RascalC results filename, compute the comparison measures between the two average covariance matrices and return as a dictionary. Do this for full and jackknife covariance matrices (if the latter are present). This method is decribed in Section 3.2 of Rashkovetskyi et al 2023. Optionally, use only
n_samplesfirst samples. Further optionally, useprint_functionto report the results.
Sample catenation function
- RascalC.cat_raw_covariance_matrices(n: int, mstr: str, input_roots: list[str], ns_samples: list[None | int | ~typing.Iterable[int] | ~typing.Iterable[bool]], output_root: str, collapse_factor: int = 1, check_finished: bool = True, two_tracers: bool | None = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) dict[str][source]
Catenate the raw covariance matrices from one or more input directories, assuming they are from similar runs: the same number of input random points,
N2,N3,N4andloops_per_sample.Parameters
- ninteger
The number of radial bins.
- mstrstring
The next part of the output configuration label:
m{number of angular bins}in s_mu mode andl{max_multipole}in Legendre modes.- input_rootslist of strings
Input directories to catenate from.
- ns_sampleslist of the same length as
input_roots Each element allows to select subsamples flexibly from the corresponding input directory:
if None, returns all samples;
if a positive integer, returns as many samples from the beginning;
if a sequence of integers, returns subsamples with indices from this sequence;
sequence of boolean values is interpreted as a boolean mask for subsamples.
- output_rootstring
The output directory, in which the NumPy file with the resulting raw covariance matrix arrays is created.
- collapse_factorpositive integer
(Optional) allows to reduce the number of subsamples by averaging over a given number of adjacent subsamples. Default value is 1, meaning no reduction.
- check_finishedboolean
(Optional) whether to check if the runs are finished before collecting raw covariance matrices (if that is needed). Default is True.
- two_tracersboolean | None
(Optional) whether the runs are for two tracers (for an additional check for finished runs). If None (default), the code will try to guess by looking for the presence of the xi_22.dat file.
- print_functionCallable
(Optional) custom function to use for printing. Default is
print.
Returns
- catenation_resultsdict[str, npt.NDArray[np.float64]]
Catenated raw covariance matrices as a dictionary with string keys and Numpy array values. All this information is also saved in a
Raw_Covariance_Matrices*.npzfile in theoutput_root.
Covariance combination functions for two independent regions
These functions follow a particular procedure for combination of DESI NGC and SGC 2-point correlation function measurements into GCcomb (previously N and S into NS). For more information, see Appendix B of Rashkovetskyi et al 2025.
- RascalC.combine_regions.combine_covs(rascalc_results1: str | ~pathlib.Path, rascalc_results2: str | ~pathlib.Path, allcounts_file1: str | ~pathlib.Path, allcounts_file2: str | ~pathlib.Path, output_cov_file: str | ~pathlib.Path, n_mu_bins: int | None = None, r_step: float = 1, skip_r_bins: int | tuple[int, int] = 0, output_cov_file1: str | ~pathlib.Path | None = None, output_cov_file2: str | ~pathlib.Path | None = None, allcounts_format: ~typing.Literal[None, 'pycorr', 'lsstypes'] = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) ndarray[tuple[Any, ...], dtype[float64]][source]
Produce s,mu mode single-tracer covariance matrix for the region/footprint that is a combination of two regions/footprints neglecting the correlations between the clustering statistics in the different regions. For additional details, see Appendix B.1 of Rashkovetskyi et al 2025.
Parameters
- rascalc_results1, rascalc_results2string or Path object
Filenames for the RascalC (post-processing) results for the two regions in NumPy format.
- allcounts_file1, allcounts_file2list of strings or Path objects
Filenames for the
pycorr(https://github.com/cosmodesi/pycorr).npyorlsstypes(https://github.com/adematti/lsstypes).h5/.hdf5/.txtfiles with the correlation functions and pair counts for the two regions. Each list must contain three filenames: first for the auto-correlation of the first tracer, second for the cross-correlation of the two tracers, and the third for the auto-correlation of the second tracer. The order of regions must be the same as in RascalC results.- output_cov_filestring or Path object
Filename for the output text file, in which the covariance matrix will be saved.
- n_mu_binsinteger
The number of angular (mu) bins, must match the RascalC results.
- r_stepfloat
The width of the radial (separation) bins, must match the RascalC results.
- skip_r_binsinteger or tuple of two integers
(Optional) removal of some radial bins from the loaded
pycorrcounts after adjusting the radial (separation) bin width to match the covariance settings. First (or the only) number sets the number of radial/separation bins to skip from the beginning. Second number (if provided) sets the number of radial/separation bins to skip from the end. By default, no bins are skipped. E.g. if thepycorrcounts are in 1 Mpc/h bins from 0 to 200 Mpc/h and the RascalC covariances are computed only between 20 and 200 Mpc/h in 4 Mpc/h wide bins,skip_r_binsshould be5or(5, 0).- output_cov_file1, output_cov_file2string or Path object or None
(Optional) if provided, the text covariance matrices for the corresponding region will be saved in this file.
- allcounts_formatNone, “pycorr” or “lsstypes”
(Optional) the format of the allcounts files, either “pycorr” for files with pycorr TwoPointCorrelationFunction objects or “lsstypes” for files with lsstypes Count2Correlation objects. Default is None for auto-determination based on file extensions.
- print_functionCallable[[str], None]
(Optional) custom function to use for printing. Needs to take string arguments and not return anything. Default is
print.
Returns
- combined_covnpt.NDArray[np.float64]
The resulting covariance matrix for the combined region.
- RascalC.combine_regions.combine_covs_legendre(rascalc_results1: str | ~pathlib.Path, rascalc_results2: str | ~pathlib.Path, allcounts_file1: str | ~pathlib.Path, allcounts_file2: str | ~pathlib.Path, output_cov_file: str | ~pathlib.Path, max_l: int, r_step: float = 1, skip_r_bins: int | tuple[int, int] = 0, output_cov_file1: str | ~pathlib.Path | None = None, output_cov_file2: str | ~pathlib.Path | None = None, allcounts_format: ~typing.Literal[None, 'pycorr', 'lsstypes'] = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) ndarray[tuple[Any, ...], dtype[float64]][source]
Produce Legendre mode single-tracer covariance matrix for the region/footprint that is a combination of two regions/footprints neglecting the correlations between the clustering statistics in the different regions. For additional details, see Appendix B.2 of Rashkovetskyi et al 2025.
Parameters
- rascalc_results1, rascalc_results2string or Path object
Filenames for the RascalC (post-processing) results for the two regions in NumPy format.
- allcounts_file1, allcounts_file2list of strings or Path objects
Filenames for the
pycorr(https://github.com/cosmodesi/pycorr).npyorlsstypes(https://github.com/adematti/lsstypes).h5/.hdf5/.txtfiles with the correlation functions and pair counts for the two regions. If you use a non-standard extension, you can specify the format with theallcounts_formatargument. The order of regions must be the same as in RascalC results.- output_cov_filestring or Path object
Filename for the output text file, in which the covariance matrix will be saved.
- max_linteger
The highest (even) multipole index, must match the RascalC results.
- r_stepfloat
The width of the radial (separation) bins, must match the RascalC results.
- skip_r_binsinteger or tuple of two integers
(Optional) removal of some radial bins from the loaded
pycorrcounts after adjusting the radial (separation) bin width to match the covariance settings. First (or the only) number sets the number of radial/separation bins to skip from the beginning. Second number (if provided) sets the number of radial/separation bins to skip from the end. By default, no bins are skipped. E.g. if thepycorrcounts are in 1 Mpc/h bins from 0 to 200 Mpc/h and the RascalC covariances are computed only between 20 and 200 Mpc/h in 4 Mpc/h wide bins,skip_r_binsshould be5or(5, 0).- output_cov_file1, output_cov_file2string or Path object or None
(Optional) if provided, the text covariance matrices for the corresponding region will be saved in this file.
- allcounts_formatNone, “pycorr” or “lsstypes”
(Optional) the format of the allcounts files, either “pycorr” for files with pycorr TwoPointCorrelationFunction objects or “lsstypes” for files with lsstypes Count2Correlation objects. Default is None for auto-determination based on file extensions.
- print_functionCallable[[str], None]
(Optional) custom function to use for printing. Needs to take string arguments and not return anything. Default is
print.
Returns
- combined_covnpt.NDArray[np.float64]
The resulting covariance matrix for the combined region.
- RascalC.combine_regions.combine_covs_multi(rascalc_results1: str | ~pathlib.Path, rascalc_results2: str | ~pathlib.Path, allcounts_files1: list[str | ~pathlib.Path], allcounts_files2: list[str | ~pathlib.Path], output_cov_file: str | ~pathlib.Path, n_mu_bins: int | None = None, r_step: float = 1, skip_r_bins: int | tuple[int, int] = 0, output_cov_file1: str | ~pathlib.Path | None = None, output_cov_file2: str | ~pathlib.Path | None = None, allcounts_format: ~typing.Literal[None, 'pycorr', 'lsstypes'] = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) ndarray[tuple[Any, ...], dtype[float64]][source]
Produce s,mu mode two-tracer covariance matrix for the region/footprint that is a combination of two regions/footprints neglecting the correlations between the clustering statistics in the different regions. For additional details, see Appendix B.1 of Rashkovetskyi et al 2025.
Parameters
- rascalc_results1, rascalc_results2string or Path object
Filenames for the RascalC (post-processing) results for the two regions in NumPy format.
- allcounts_files1, allcounts_files2list of strings or Path objects
Filenames for the
pycorr(https://github.com/cosmodesi/pycorr).npyorlsstypes(https://github.com/adematti/lsstypes).h5/.hdf5/.txtfiles with the correlation functions and pair counts for the two regions. Each list must contain three filenames: first for the auto-correlation of the first tracer, second for the cross-correlation of the two tracers, and the third for the auto-correlation of the second tracer. The order of regions must be the same as in RascalC results.- output_cov_filestring or Path object
Filename for the output text file, in which the covariance matrix will be saved.
- n_mu_binsinteger
The number of angular (mu) bins, must match the RascalC results.
- r_stepfloat
The width of the radial (separation) bins, must match the RascalC results.
- skip_r_binsinteger or tuple of two integers
(Optional) removal of some radial bins from the loaded
pycorrcounts after adjusting the radial (separation) bin width to match the covariance settings. First (or the only) number sets the number of radial/separation bins to skip from the beginning. Second number (if provided) sets the number of radial/separation bins to skip from the end. By default, no bins are skipped. E.g. if thepycorrcounts are in 1 Mpc/h bins from 0 to 200 Mpc/h and the RascalC covariances are computed only between 20 and 200 Mpc/h in 4 Mpc/h wide bins,skip_r_binsshould be5or(5, 0).- output_cov_file1, output_cov_file2string or Path object or None
(Optional) if provided, the text covariance matrices for the corresponding region will be saved in this file.
- allcounts_formatNone, “pycorr” or “lsstypes”
(Optional) the format of the allcounts files, either “pycorr” for files with pycorr TwoPointCorrelationFunction objects or “lsstypes” for files with lsstypes Count2Correlation objects. Default is None for auto-determination based on file extensions.
- print_functionCallable[[str], None]
(Optional) custom function to use for printing. Needs to take string arguments and not return anything. Default is
print.
Returns
- combined_covnpt.NDArray[np.float64]
The resulting covariance matrix for the combined region.
- RascalC.combine_regions.combine_covs_legendre_multi(rascalc_results1: str | ~pathlib.Path, rascalc_results2: str | ~pathlib.Path, allcounts_files1: list[str | ~pathlib.Path], allcounts_files2: list[str | ~pathlib.Path], output_cov_file: str | ~pathlib.Path, max_l: int, r_step: float = 1, skip_r_bins: int | tuple[int, int] = 0, output_cov_file1: str | ~pathlib.Path | None = None, output_cov_file2: str | ~pathlib.Path | None = None, allcounts_format: ~typing.Literal[None, 'pycorr', 'lsstypes'] = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) ndarray[tuple[Any, ...], dtype[float64]][source]
Produce Legendre mode two-tracer covariance matrix for the region/footprint that is a combination of two regions/footprints neglecting the correlations between the clustering statistics in the different regions. For additional details, see Appendix B.2 of Rashkovetskyi et al 2025.
Parameters
- rascalc_results1, rascalc_results2string or Path object
Filenames for the RascalC (post-processing) results for the two regions in NumPy format.
- allcounts_files1, allcounts_files2list of strings or Path objects
Filenames for the
pycorr(https://github.com/cosmodesi/pycorr).npyorlsstypes(https://github.com/adematti/lsstypes).h5/.hdf5/.txtfiles with the correlation functions and pair counts for the two regions. Each list must contain three filenames: first for the auto-correlation of the first tracer, second for the cross-correlation of the two tracers, and the third for the auto-correlation of the second tracer. The order of regions must be the same as in RascalC results.- output_cov_filestring or Path object
Filename for the output text file, in which the covariance matrix will be saved.
- max_linteger
The highest (even) multipole index, must match the RascalC results.
- r_stepfloat
The width of the radial (separation) bins, must match the RascalC results.
- skip_r_binsinteger or tuple of two integers
(Optional) removal of some radial bins from the loaded
pycorrcounts after adjusting the radial (separation) bin width to match the covariance settings. First (or the only) number sets the number of radial/separation bins to skip from the beginning. Second number (if provided) sets the number of radial/separation bins to skip from the end. By default, no bins are skipped. E.g. if thepycorrcounts are in 1 Mpc/h bins from 0 to 200 Mpc/h and the RascalC covariances are computed only between 20 and 200 Mpc/h in 4 Mpc/h wide bins,skip_r_binsshould be5or(5, 0).- output_cov_file1, output_cov_file2string or Path object or None
(Optional) if provided, the text covariance matrices for the corresponding region will be saved in this file.
- allcounts_formatNone, “pycorr” or “lsstypes”
(Optional) the format of the allcounts files, either “pycorr” for files with pycorr TwoPointCorrelationFunction objects or “lsstypes” for files with lsstypes Count2Correlation objects. Default is None for auto-determination based on file extensions.
- print_functionCallable[[str], None]
(Optional) custom function to use for printing. Needs to take string arguments and not return anything. Default is
print.
Returns
- combined_covnpt.NDArray[np.float64]
The resulting covariance matrix for the combined region.
Sample covariance utility functions
Radial and angular bins (s_mu binning mode)
These functions generate sample covariances of binned \(\xi(s,\mu)\) from s_mu 2PCF estimators from cosmodesi/pycorr or adematti/lsstypes
- RascalC.sample_cov.get_corr(xi_estimator: BaseTwoPointEstimator | Count2Correlation) ndarray[source]
get s,mu binned correlation function array from either pycorr estimator or lsstypes Count2Correlation
- RascalC.sample_cov.sample_cov(xi_estimators: list[list[BaseTwoPointEstimator | Count2Correlation]]) ndarray[tuple[Any, ...], dtype[float64]][source]
Produce a sample covariance of binned \(\xi(s,\mu)\) from
s_mu2PCF estimators from cosmodesi/pycorr or adematti/lsstypes. Multiple tracers are supported.Parameters
- xi_estimatorslist of lists of
pycorr.twopoint_estimator.BaseTwoPointEstimators orlsstypes.Count2Correlations The first element must be the list of first tracer auto-correlation function estimators. The (optional) second element should be the list of cross-correlation function estimators between the 1st and the 2nd tracer. (Ordering of mock realizations must be the same, or the cross-covariance blocks will be wrong.) The (optional) third element should be the list of second tracer auto-correlation function estimators. This ordering can be extended (or altered) but it must be consistent.
- xi_estimatorslist of lists of
- RascalC.sample_cov.sample_cov_to_file(xi_estimators: list[list[BaseTwoPointEstimator | Count2Correlation]], outfile_name: str) None[source]
Produce a sample covariance of binned \(\xi(s,\mu)\) from
s_mu2PCF estimators from cosmodesi/pycorr or adematti/lsstypes and write the matrix to a text file. Multiple tracers are supported.Parameters are analogous to
sample_cov()except- outfile_namestring (filename)
The name for the output text file.
Legendre multipoles (legendre binning modes)
These functions generate sample covariances of binned \(\xi_\ell(s)\) from s_mu 2PCF estimators from cosmodesi/pycorr or adematti/lsstypes
- RascalC.sample_cov_multipoles.get_poles(xi_estimator: BaseTwoPointEstimator | Count2Correlation, ells: list[int]) ndarray[source]
get binned correlation function multipolesarray from either pycorr estimator or lsstypes Count2Correlation
- RascalC.sample_cov_multipoles.sample_cov_multipoles(xi_estimators: list[list[BaseTwoPointEstimator | Count2Correlation]], max_l: int) ndarray[tuple[Any, ...], dtype[float64]][source]
Produce a sample covariance of binned \(\xi_\ell(s)\) from
s_mu2PCF estimators from cosmodesi/pycorr or adematti/lsstypes. Considers only even multipoles. Multiple tracers are supported.Parameters
- xi_estimatorslist of lists of
pycorr.twopoint_estimator.BaseTwoPointEstimators orlsstypes.Count2Correlations The first element must be the list of first tracer auto-correlation function estimators. The (optional) second element should be the list of cross-correlation function estimators between the 1st and the 2nd tracer. (Ordering of mock realizations must be the same, or the cross-covariance blocks will be wrong.) The (optional) third element should be the list of second tracer auto-correlation function estimators. This ordering can be extended (or altered) but it must be consistent.
- max_linteger
Max (even) Legendre multipole index.
- xi_estimatorslist of lists of
- RascalC.sample_cov_multipoles.sample_cov_multipoles_to_file(xi_estimators: list[list[BaseTwoPointEstimator | Count2Correlation]], outfile_name: str, max_l: int) None[source]
Produce a sample covariance of binned \(\xi_\ell(s)\) from
s_mu2PCF estimators from cosmodesi/pycorr or adematti/lsstypes and write the matrix to a text file. Considers only even multipoles. Multiple tracers are supported.Parameters are analogous to
sample_cov_multipoles()except- outfile_namestring (filename)
The name for the output text file.
Covariances for combined/concatenated tracers from two-tracer covariances
Functions to produce a combined/concatenated tracer covariances from two-tracer, as an alternative to the single-tracer approach used for e.g. Valcin et al 2025. Use with great care if the tracer combination pipeline involves weight rescaling and/or FKP weight updates.
- RascalC.combine_tracers.convert_cov_legendre_multi_to_cat(rascalc_results: str | ~pathlib.Path, allcounts_files: list[str | ~pathlib.Path], output_cov_file: str | ~pathlib.Path, max_l: int, r_step: float = 1, skip_r_bins: int | tuple[int, int] = 0, bias1: float = 1, bias2: float = 1, allcounts_format: ~typing.Literal[None, 'pycorr', 'lsstypes'] = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) ndarray[tuple[Any, ...], dtype[float64]][source]
Given a two-tracer Legendre mode RascalC result (or a text covariance), produce a single-tracer covariance matrix for the combined/concatenated tracer (obtained by concatenating the catalogs of the two tracers, with weight in each optionally multiplied by the corresponding tracer’s bias). The correlations between the two tracers in each region are included. For additional details, see Valcin et al 2025 and Appendix B.2 of Rashkovetskyi et al 2025.
Parameters
- rascalc_resultsstring or Path object
Filename for the RascalC two-tracer post-processing results in NumPy format, or the text file with the covariance matrix converted from such a NumPy file.
- allcounts_fileslist of strings or Path objects
Filenames for the
pycorr(https://github.com/cosmodesi/pycorr).npyorlsstypes(https://github.com/adematti/lsstypes).h5/.hdf5/.txtfiles with the correlation functions and pair counts. The list must contain three filenames: first for the auto-correlation of the first tracer, second for the cross-correlation of the two tracers, and the third for the auto-correlation of the second tracer.- output_cov_filestring or Path object
Filename for the output text file, in which the covariance matrix will be saved.
- max_linteger
The highest (even) multipole index, must match the RascalC results.
- r_stepfloat
The width of the radial (separation) bins, must match the RascalC results.
- skip_r_binsinteger or tuple of two integers
(Optional) removal of some radial bins from the loaded
pycorrcounts after adjusting the radial (separation) bin width to match the covariance settings. First (or the only) number sets the number of radial/separation bins to skip from the beginning. Second number (if provided) sets the number of radial/separation bins to skip from the end. By default, no bins are skipped. E.g. if thepycorrcounts are in 1 Mpc/h bins from 0 to 200 Mpc/h and the RascalC covariances are computed only between 20 and 200 Mpc/h in 4 Mpc/h wide bins,skip_r_binsshould be5or(5, 0).- bias1, bias2float
(Optional) the bias values to upweight the first and the second tracer respectively. Default is 1 for both tracers (i.e., no upweighting).
- allcounts_formatNone, “pycorr” or “lsstypes”
(Optional) the format of the allcounts files, either “pycorr” for files with pycorr TwoPointCorrelationFunction objects or “lsstypes” for files with lsstypes Count2Correlation objects. Default is None for auto-determination based on file extensions.
- print_functionCallable[[str], None]
(Optional) custom function to use for printing. Needs to take string arguments and not return anything. Default is
print.
Returns
- combined_covnpt.NDArray[np.float64]
The resulting covariance matrix for the combined/concatenated tracer.
- RascalC.combine_tracers.combine_covs_legendre_multi_to_cat(rascalc_results1: str | ~pathlib.Path, rascalc_results2: str | ~pathlib.Path, allcounts_files1: list[str | ~pathlib.Path], allcounts_files2: list[str | ~pathlib.Path], output_cov_file: str | ~pathlib.Path, max_l: int, r_step: float = 1, skip_r_bins: int | tuple[int, int] = 0, bias1: float = 1, bias2: float = 1, output_cov_file1: str | ~pathlib.Path | None = None, output_cov_file2: str | ~pathlib.Path | None = None, allcounts_format: ~typing.Literal[None, 'pycorr', 'lsstypes'] = None, print_function: ~typing.Callable[[str], None] = <built-in function print>) ndarray[tuple[Any, ...], dtype[float64]][source]
Given two-tracer Legendre mode RascalC results for two regions, produce a single-tracer covariance matrix for the combined/concatenated tracer (obtained by concatenating the catalogs of the two tracers, with weight in each optionally multiplied by the corresponding tracer’s bias) for the region/footprint that is a combination of two regions/footprints. The correlations between the clustering statistics in the different regions are neglected, but the correlations between the two tracers in each region are included. More specifically, first the multi-tracer covariances for each region are converted to single-tracer covariances for the combined/concatenated tracer in each region, and then these single-tracer covariances are combined to produce the final covariance for the combined/concatenated tracer for the combined region. For additional details, see Valcin et al 2025 and Appendix B.2 of Rashkovetskyi et al 2025.
Parameters
- rascalc_results1, rascalc_results2string or Path object
Filenames for the RascalC (post-processing) results for the two regions in NumPy format.
- allcounts_files1, allcounts_files2list of strings or Path objects
Filenames for the
pycorr(https://github.com/cosmodesi/pycorr).npyorlsstypes(https://github.com/adematti/lsstypes).h5/.hdf5/.txtfiles with the correlation functions and pair counts for the two regions. Each list must contain three filenames: first for the auto-correlation of the first tracer, second for the cross-correlation of the two tracers, and the third for the auto-correlation of the second tracer. The order of regions must be the same as in RascalC results.- output_cov_filestring or Path object
Filename for the output text file, in which the covariance matrix will be saved.
- max_linteger
The highest (even) multipole index, must match the RascalC results.
- r_stepfloat
The width of the radial (separation) bins, must match the RascalC results.
- skip_r_binsinteger or tuple of two integers
(Optional) removal of some radial bins from the loaded
pycorrcounts after adjusting the radial (separation) bin width to match the covariance settings. First (or the only) number sets the number of radial/separation bins to skip from the beginning. Second number (if provided) sets the number of radial/separation bins to skip from the end. By default, no bins are skipped. E.g. if thepycorrcounts are in 1 Mpc/h bins from 0 to 200 Mpc/h and the RascalC covariances are computed only between 20 and 200 Mpc/h in 4 Mpc/h wide bins,skip_r_binsshould be5or(5, 0).- bias1, bias2float
(Optional) the bias values to upweight the first and the second tracer respectively. Default is 1 for both tracers (i.e., no upweighting).
- output_cov_file1, output_cov_file2string or Path object or None
(Optional) if provided, the text covariance matrices for the corresponding region for the combined/concatenated tracer will be saved in this file.
- allcounts_formatNone, “pycorr” or “lsstypes”
(Optional) the format of the allcounts files, either “pycorr” for files with pycorr TwoPointCorrelationFunction objects or “lsstypes” for files with lsstypes Count2Correlation objects. Default is None for auto-determination based on file extensions.
- print_functionCallable[[str], None]
(Optional) custom function to use for printing. Needs to take string arguments and not return anything. Default is
print.
Returns
- combined_covnpt.NDArray[np.float64]
The resulting covariance matrix for the combined/concatenated tracer in the combined region.