ascl_id stringclasses 752
values | repo_url stringclasses 737
values | file_path stringlengths 4 194 | content large_stringlengths 1 1M | language stringclasses 29
values | license_type stringclasses 24
values | size int64 1 1M |
|---|---|---|---|---|---|---|
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_legendre_multi.py | ## Script to post-process the multi-field Legendre binned integrals computed by the C++ code, given a shot-noise rescaling parameter alpha.
## We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
import sys
# PARAMETERS
if len(sys.arg... | Python | MIT | 996 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/print_shot_noise_rescaling.py | ## Simple convenience script to print shot noise rescaling from one or many RascalC files
import sys
# PARAMETERS
if len(sys.argv) < 2:
print("Usage: python print_shot_noise_rescaling.py {RASCALC_RESULTS_1} [{RASCALC_RESULTS_2} ...]")
sys.exit(1)
from utils import adjust_path
adjust_path()
from RascalC.get_s... | Python | MIT | 437 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/combine_covs_multi.py | "This reads two sets of RascalC results and two triplets of cosmodesi/pycorr .npy files to combine two covs following NS/GCcomb procedure for 2 tracers. Covariance of N and S 2PCF is neglected."
import sys
## PARAMETERS
if len(sys.argv) not in (13, 15):
print("Usage: python combine_covs_multi.py {RASCALC_RESULTS1... | Python | MIT | 1,254 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_default_mocks_multi.py | ## Script to post-process the multi-field integrals computed by the C++ code. This computes two shot-noise rescaling parameters, alphas, from a mock derived covariance matrix.
## We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
imp... | Python | MIT | 1,039 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_default_multi.py | ## Script to post-process the multi-field integrals computed by the C++ code.
## We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
import sys
# PARAMETERS
if len(sys.argv) not in (5, 7, 8):
print("Usage: python post_process_def... | Python | MIT | 884 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_legendre_mix_jackknife.py | ## Script to post-process the single-field integrals computed by the C++ code in mixed Legendre (LEGENDRE_MIX) mode. This computes the shot-noise rescaling parameter, alpha, from a data derived covariance matrix.
## We output the data and theory jackknife covariance matrices, in addition to full theory covariance matri... | Python | MIT | 1,174 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_default.py | ## Script to post-process the single-field integrals computed by the C++ code.
## We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
import sys
# PARAMETERS
if len(sys.argv) not in (5, 6, 7):
print("Usage: python post_process_de... | Python | MIT | 774 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_legendre_mocks.py | ## Script to post-process the single-field Legendre binned integrals computed by the C++ code. This computes the shot-noise rescaling parameter, alpha, from a mock derived covariance matrix.
## We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of sampl... | Python | MIT | 985 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/convert_counts_from_pycorr.py | "This reads a cosmodesi/pycorr .npy file and generates binned pair counts text file for RascalC to use"
import sys
import numpy as np
## PARAMETERS
if len(sys.argv) not in (3, 4, 5, 6, 7, 8):
print("Usage: python convert_counts_from_pycorr.py {INPUT_NPY_FILE} {OUTPUT_PAIRCOUNTS_TEXT_FILE} [{R_STEP} [{N_MU} [{COUN... | Python | MIT | 1,246 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/compute_correction_function.py | ### Function to fit a model to the survey correction function, defined as the ratio between model and true RR pair counts for a single survey. This fits a piecewise polynomial model to the data.
## NB: Input RR counts should NOT be normalized by summed galaxy weights here.
## NB: Assume mu is in [0,1] limit here
impo... | Python | MIT | 883 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/write_binning_file_log.py | ## Utility function to create the Corrfunc radial-binning file for a given number of radial bins in a certain range of comoving radii.
import sys
if len(sys.argv) < 5:
print("Please specify input parameters in the form {N_LOG_BINS} {MIN_R} {MAX_R} {OUTPUT_FILE}.")
sys.exit(1)
from utils import adjust_path
ad... | Python | MIT | 558 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_3pcf.py | ## Script to post-process the single-field 3PCF Legendre binned integrals computed by the C++ code.
## We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
import argparse
parser = argparse.ArgumentParser(description="Script to post-p... | Python | MIT | 1,272 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/convert_xi_from_pycorr.py | "This reads cosmodesi/pycorr .npy file(s) and generates input xi text file for RascalC to use"
import sys
## PARAMETERS
if len(sys.argv) < 5:
print("Usage: python convert_xi_from_pycorr.py {INPUT_NPY_FILE1} [{INPUT_NPY_FILE2} ...] {OUTPUT_XI_DAT_FILE} {R_STEP} {N_MU}.")
sys.exit(1)
from utils import adjust_p... | Python | MIT | 598 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_jackknife_multi.py | ## Script to post-process the multi-field integrals computed by the C++ code. This computes the shot-noise rescaling parameters, alpha_i, from data derived covariance matrices.
## We output the data and theory jackknife covariance matrices, in addition to full theory covariance matrices and (quadratic-bias corrected) p... | Python | MIT | 1,185 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/compute_3pcf_correction_function.py | ### Script to fit a model (piecewise polynomial) to the 3PCF survey correction function, defined as the ratio between idealistic and true RRR pair counts for a single survey.
## NB: Input RRR counts should be normalized by the cube of the sum of random weights here. ## is this useful/necessary?
## NB: Assume mu is in ... | Python | MIT | 1,537 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/redshift_cut.py | """Convenience script to perform redshift cut on an input (Ra,Dec,z,w) FITS or txt file and save the result in a .txt file for use with further scripts. (Michael Rashkovetskyi 2022).
Output file format has (Ra,Dec,z,w) coordinates
Parameters:
INFILE = input ASCII or FITS file
OUTFILE = output .txt ... | Python | MIT | 1,915 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/take_subset_of_particles.py | """This script takes an input txt file listing the (x,y,z,w,j) coordinates of random particles and selects N random particles from this, which it writes to file."""
import sys
if len(sys.argv) != 4:
print("Usage: python take_subset_of_particles.py {INPUT_FILE} {OUTPUT_FILE} {N_PARTICLES}.")
sys.exit(1)
from ... | Python | MIT | 581 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/mu_bin_legendre_factors.py | "Simple script to produce the file of mu bin Legendre factors for the C++ code in LEGENDRE_MIX mode."
import sys
## PARAMETERS
if len(sys.argv) != 4:
print("Usage: python mu_bin_legendre_factors.py {N_MU_BINS} {MAX_L} {OUTPUT_DIR}.")
sys.exit(1)
from utils import adjust_path
adjust_path()
from RascalC.mu_bin... | Python | MIT | 520 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/convergence_check_extra.py | ## Script to perform an extra convergence check on full integrals
## More specifically, divide integral subsamples into halves and check similarity of their average results
## Should work in any case - default, jackknife, Legendre, multi-tracer - as it utilizes universal data from RascalC file
import sys
# PARAMETERS... | Python | MIT | 752 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/convert_xi_to_multipoles.py | ### Script to convert a measured 2PCF in xi(r,mu) format to Legendre multipoles, i.e. xi_ell(r).
### This computes all even multipoles up to a specified maximum ell, approximating the integral by a sum.
### The output form is a text file with the first column specifying the r-bin, the second giving xi_0(r), the third w... | Python | MIT | 740 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/collect_raw_covariance_matrices.py | ## Script to collect the raw covariance matrices from the output directory of the C++ code
import sys
# PARAMETERS
if len(sys.argv) != 2: # if too few
print("Usage: python collect_raw_covariance_matrices.py {COVARIANCE_DIR}")
sys.exit(1)
from utils import adjust_path
adjust_path()
from RascalC.raw_covariance... | Python | MIT | 438 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/post_process_jackknife.py | ## Script to post-process the single-field integrals computed by the C++ code. This computes the shot-noise rescaling parameter, alpha, from a data derived covariance matrix.
## We output the data and theory jackknife covariance matrices, in addition to full theory covariance matrices and (quadratic-bias corrected) pre... | Python | MIT | 994 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/combine_covs_legendre.py | "This reads two sets of RascalC results and two cosmodesi/pycorr .npy files to combine two covs following NS/GCcomb procedure in Legendre mode. Covariance of N and S 2PCF is neglected."
import sys
## PARAMETERS
if len(sys.argv) not in (9, 11):
print("Usage: python combine_covs_legendre.py {RASCALC_RESULTS1} {RASC... | Python | MIT | 1,116 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/combine_covs_legendre_multi.py | "This reads two sets of RascalC results and two triplets of cosmodesi/pycorr .npy files to combine two full 2-tracer covs following NS/GCcomb procedure for 2 tracers in Legendre mode. Covariance of N(GC) and S(GC) 2PCF is neglected."
import sys
## PARAMETERS
if len(sys.argv) not in (13, 15):
print("Usage: python ... | Python | MIT | 1,319 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/compute_correction_function_multi.py | ### Function to fit a model to the survey correction function, defined as the ratio between model and true RR pair counts for a two surveys. This fits a piecewise polynomial model to the data.
## NB: Input RR counts should NOT be normalized by summed galaxy weights here.
## NB: Assume mu is in [0,1] limit here
import... | Python | MIT | 1,082 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/cat_raw_covariance_matrices.py | ## Script to catenate (take a subset of subsamples or resample) raw covariance matrix files produced by collect_raw_covariance_matrices.py
## More specifically, copy part of partial results to other directory and recompute totals by averaging
## Determines single-field vs multi-field and jackknife automatically
## Do n... | Python | MIT | 1,212 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/convert_cov_legendre_multi.py | "Slightly more complicated (than convert_cov.py) convenience script that reads RascalC 2-tracer Legendre mode results and saves full cov to text file, changing the indexing from [t, r, l] to [t, l, r], in addition checking eigenvalues of bias matrix"
import sys
## PARAMETERS
if len(sys.argv) != 4:
print("Usage: p... | Python | MIT | 689 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/jackknife_weights_cross.py | ## Script to generate RR pair counts from two distinct sets of random particles. This is based on the Corrfunc code of Sinha & Garrison.
## Here we compute the cross-weight RR_{XY} between two sets of particles.
## Weights and weighted pair counts are saved in the {OUTPUT_DIR} subdirectory.
## If the periodic flag is ... | Python | MIT | 9,915 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/xi_estimator_periodic.py | ## Script to compute estimate of the correlation function(s) xi(r,mu) for an entire survey via the DD/RR-1 estimator for one/two sets of tracer particles (galaxies).
## This assumes a periodic simulation, with the random RR counts computed analytically.
## Mu (RSD angle) is measured from the Z-axis.
## If two sets of g... | Python | MIT | 6,839 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/xi_estimator_jack.py | ## Script to compute jackknife estimates of the correlation function xi^J(r,mu) via the Landay-Szelay estimator for a single set of random particles.
## If the periodic flag is set, we assume a periodic simulation and measure mu from the Z-axis.
## This must be binned in the same binning as the desired covariance matri... | Python | MIT | 13,258 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/create_jackknives.py | """ This function will assign a jackknife region to each input particle, by assigning a HEALPix pixel number to each datapoint, with a given value of NSIDE. Data is saved as a 5 column text file."""
import numpy as np
import healpy as hp
import sys
import time
from tqdm import tqdm
## PARAMETERS
if len(sys.argv)<4:
... | Python | MIT | 1,273 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/RR_counts_multi.py | ## Convenience function to create RR pair counts for two sets of random particles, based on Corrfunc.
## This just computes the global RR pair counts, not the jackknife counts.
## If the periodic flag is set, we assume a periodic simulation and measure mu from the Z-axis.
import sys
import os
import numpy as np
import... | Python | MIT | 5,691 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/RR_counts.py | ## Convenience function to create RR pair counts for a set of random particles, based on Corrfunc.
## This just computes the global RR pair counts, not the jackknife counts.
## If the periodic flag is set, we assume a periodic simulation and measure mu from the Z-axis.
import sys
import os
import numpy as np
import ma... | Python | MIT | 3,334 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/jackknife_weights.py | ## Script to generate RR pair counts from a given set of random particles. This is based on the Corrfunc code of Sinha & Garrison.
## Weights and weighted pair counts are saved in the ../weight_files/ subdirectory.
## If the periodic flag is set, we assume a periodic simulation and measure mu from the Z-axis.
import ... | Python | MIT | 5,684 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/cat_subsets_of_integrals.py | ## Script to take a subset of integrals and/or concatenate samples
## More specifically, copy part of partial results to other directory and recompute totals by averaging
## Determines single-field vs multi-field and jackknife automatically
## Do not use if subsamples have different numbers of pairs/triples/quadruplets... | Python | MIT | 16,675 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/xi_estimator_jack_cross.py | ## Script to compute jackknife estimates of the correlation function xi^J(r,mu) via the Landay-Szelay estimator for a single set of random particles.
## If the periodic flag is set, we assume a periodic simulation and measure mu from the Z-axis.
## This must be binned in the same binning as the desired covariance matri... | Python | MIT | 26,225 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/convergence_check_extra_jack.py | ## Script to perform an extra convergence check on jackknife integrals
## More specifically, divide integral subsamples into halves and check similarity of their average results
## Determines single-field vs multi-field automatically
## Now legacy, jackknife integrals convergence checking implemented in convergence_che... | Python | MIT | 4,558 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/xi_estimator_aperiodic.py | ## Script to compute estimate of the correlation functions xi(r,mu) for an entire survey via the Landay-Szalay estimator for one or two sets of random particles.
## This creates three correlation functions - for field 1 x field 1, field 1 x field 2, field 2 x field 2.
import sys
import numpy as np
import math
# PARAM... | Python | MIT | 11,811 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/fixes/correct_norm.py | ## Script to correct normalization (number of data galaxies) after a RascalC run
## Determines single-field vs multi-field and jackknife automatically, but by default does no rescaling for 2nd field
import numpy as np
import sys,os
# PARAMETERS
if len(sys.argv) not in (8, 10):
print("Usage: python correct_norm.py... | Python | MIT | 6,591 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/fixes/correct_disconnected.py | ## Script to correct jackknife disconnected term from runs of older versions of RascalC
## Determines single-field vs multi-field and jackknife automatically, but by default does no changes for 2nd field
import numpy as np
import sys,os
# PARAMETERS
if len(sys.argv) not in (8, 10):
print("Usage: python correct_di... | Python | MIT | 6,182 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/legacy/fixes/correct_legendre_norm.py | ## Script to correct correction function norm in runs of older versions of RascalC in Legendre mode
## Determines single-field vs multi-field automatically (no jackknife), but by default does no changes for 2nd field
import numpy as np
import sys,os
# PARAMETERS
if len(sys.argv) not in (8, 10):
print("Usage: pyth... | Python | MIT | 3,199 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | scripts/utils/__init__.py | import sys, os
def adjust_path():
# insert the parent directory, override the one installed in the system
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "../..")))
def get_arg_safe(index: int, type = str, default: object = None) -> object:
# get argument by index from sys.arg... | Python | MIT | 506 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | triple_counts/triple_counts.cpp | // triple_counts.cpp -- Oliver Philcox started March 2019 based on grid_multipoles.cpp of Daniel Eisenstein.
#include <sys/time.h>
#include <sys/resource.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <complex>
#include <algorithm>
#include <random>
#includ... | C++ | MIT | 29,822 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/utils.py | # Contains some utility functions widely used in other scripts
# Not intended for execution from command line
import numpy as np
import os
from typing import Iterable
suffixes_tracer_all = ("", "2") # all supported tracer suffixes
indices_corr_all = ("11", "12", "22") # all supported 2PCF indices
suffixes_corr_all = ... | Python | MIT | 1,889 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/correction_function_3pcf.py | ### Function to fit a model (piecewise polynomial) to the 3PCF survey correction function, defined as the ratio between idealistic and true RRR pair counts for a single survey.
## NB: Input RRR counts should be normalized by the cube of the sum of random weights here. ## is this useful/necessary?
## NB: Assume mu is i... | Python | MIT | 4,378 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/__init__.py | __version__ = "3.1"
from .interface import run_cov
from .post_process import post_process_auto
from .raw_covariance_matrices import cat_raw_covariance_matrices | Python | MIT | 160 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/get_shot_noise_rescaling.py | ## Simple functions to get shot noise rescaling from one or many RascalC files
import numpy as np
import numpy.typing as npt
from .utils import blank_function
from typing import Callable
def get_shot_noise_rescaling(rascalc_filename: str) -> float | npt.NDArray[np.float64]:
"Retrieve the shot noise rescaling val... | Python | MIT | 1,022 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/raw_covariance_matrices.py | ## Script to collect the raw covariance matrices from the output directory of the C++ code
import numpy as np
import numpy.typing as npt
import os
from glob import glob
from shutil import copy2, copytree
from typing import Callable, Iterable
from .utils import rmdir_if_exists_and_empty
def convert_suffix(suffix: str... | Python | MIT | 24,848 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/write_binning_file.py | from .utils import blank_function
import numpy as np
import numpy.typing as npt
from typing import Callable
def write_binning_file(out_file: str, r_edges: npt.NDArray[np.float64], print_function: Callable[[str], None] = blank_function):
"Save bin edges array into a Corrfunc (and RascalC) radial binning file forma... | Python | MIT | 1,830 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/combine_regions.py | """
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 <https://arxiv.org/abs/2404.03007>`_.
"""
from .comb.combine_covs import combine_co... | Python | MIT | 514 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/cov_utils.py | """
This module contains convenience functions that
- read RascalC results (checking eigenvalues of the inversion bias matrix. If they are much smaller than 1, it is safe to simply invert the covariance matrix. Otherwise, a correction factor is necessary.)
- convert (reorder) covariance matrices (as is often needed fo... | Python | MIT | 10,148 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/cov_comparison.py | "Compact measures for covariance matrix comparison introduced in Section 3.1 of `Rashkovetskyi et al 2023 <https://arxiv.org/abs/2306.06320>`_ and briefly explained again in Section 2.2 of `Rashkovetskyi et al 2025 <https://arxiv.org/abs/2404.03007>`_."
import numpy as np
import numpy.typing as npt
def rms_eig_inv_te... | Python | MIT | 1,573 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/combine_tracers.py | """
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 <https://arxiv.org/abs/2508.05467>`_.
Use with great care if the tracer combination pipeline involves weight rescaling and/or FKP weight updates.
"""
fro... | Python | MIT | 490 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/interface.py | """
Python wrapper of ``RascalC``, heavily interfaced with ``pycorr`` `library for 2-point correlation function estimation <https://github.com/cosmodesi/pycorr>`_.
Many of the arguments are intentionally similar to ``pycorr.TwoPointCorrelationFunction`` `high-level interface <https://py2pcf.readthedocs.io/en/latest/api... | Python | MIT | 53,702 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/correction_function.py | ### Function to fit a model to the survey correction function, defined as the ratio between model and true RR pair counts for a single survey. This fits a piecewise polynomial model to the data.
## NB: Input RR counts should NOT be normalized by summed galaxy weights here.
## NB: Assume mu is in [0,1] limit here
impo... | Python | MIT | 10,113 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/convergence_check_extra.py | """
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 pos... | Python | MIT | 4,907 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/mu_bin_legendre_factors.py | "Simple script to produce the file of mu bin Legendre factors for the C++ code in LEGENDRE_MIX mode."
from scipy.special import legendre
import numpy as np
import numpy.typing as npt
import os
def compute_mu_bin_legendre_factors(mu_edges: npt.NDArray[np.float64], max_l: int, do_inverse: bool = False) -> npt.NDArray[... | Python | MIT | 2,543 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/jackknife.py | """
Function to post-process the single-field integrals computed by the C++ code. This computes the shot-noise rescaling parameter, alpha, from a data derived covariance matrix.
We output the data and theory jackknife covariance matrices, in addition to full theory covariance matrices and (quadratic-bias corrected) pre... | Python | MIT | 7,894 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/default_mocks.py | """
Function to post-process the single-field integrals computed by the C++ code. This computes the shot-noise rescaling parameter, alpha, from a mock derived covariance matrix.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
... | Python | MIT | 3,569 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/legendre_mix_jackknife_multi.py | """
Function to post-process the multi-field integrals computed by the C++ code in mixed Legendre (LEGENDRE_MIX) mode. This computes the shot-noise rescaling parameter, alpha, from a data-derived covariance matrix.
We output the data and theory jackknife covariance matrices, in addition to full theory covariance matric... | Python | MIT | 9,152 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/legendre_mocks.py | """
Function to post-process the single-field Legendre binned integrals computed by the C++ code. This computes the shot-noise rescaling parameter, alpha, from a mock derived covariance matrix.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of sampl... | Python | MIT | 3,780 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/default_mocks_multi.py | """
Function to post-process the multi-field integrals computed by the C++ code. This computes two shot-noise rescaling parameters, alphas, from a mock derived covariance matrix.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
... | Python | MIT | 4,423 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/default_multi.py | """
Function to post-process the multi-field integrals computed by the C++ code.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
import numpy as np
import os
from .utils import cov_filter_smu, load_matrices_multi, add_cov_term... | Python | MIT | 2,513 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/utils.py | import numpy as np
import numpy.typing as npt
from warnings import warn
from ..utils import blank_function, symmetrized, transposed, format_skip_r_bins
from scipy.optimize import fmin
from scipy.linalg import sqrtm
from typing import Callable, Literal
def cov_filter_smu_1d(n: int, m: int, skip_r_bins: int | tuple[int... | Python | MIT | 17,960 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/default.py | """
Function to post-process the single-field integrals computed by the C++ code.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
import numpy as np
import os
from .utils import cov_filter_smu, load_matrices_single, check_eigv... | Python | MIT | 2,774 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/legendre.py | """
Function to post-process the single-field Legendre binned integrals computed by the C++ code.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
import numpy as np
import os
from .utils import cov_filter_legendre, load_matric... | Python | MIT | 2,856 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/legendre_multi.py | """
Function to post-process the multi-field Legendre binned integrals computed by the C++ code, given a shot-noise rescaling parameter alpha.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
import numpy as np
import os
from .... | Python | MIT | 2,638 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/__init__.py | from .auto import post_process_auto
from .default import post_process_default
from .default_multi import post_process_default_multi
from .jackknife import post_process_jackknife
from .jackknife_multi import post_process_jackknife_multi
from .legendre import post_process_legendre
from .legendre_multi import post_proces... | Python | MIT | 737 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/legendre_mocks_multi.py | """
Function to post-process the multi-field integrals computed by the C++ code. This computes two shot-noise rescaling parameters, alphas, from a mock derived covariance matrix.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
... | Python | MIT | 4,547 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/jackknife_multi.py | """
Function to post-process the multi-field integrals computed by the C++ code. This computes the shot-noise rescaling parameters, alpha_i, from data derived covariance matrices.
We output the data and theory jackknife covariance matrices, in addition to full theory covariance matrices and (quadratic-bias corrected) p... | Python | MIT | 13,058 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/legendre_mix_jackknife.py | """
Function to post-process the single-field integrals computed by the C++ code in mixed Legendre (LEGENDRE_MIX) mode. This computes the shot-noise rescaling parameter, alpha, from a data derived covariance matrix.
We output the data and theory jackknife covariance matrices, in addition to full theory covariance matri... | Python | MIT | 7,357 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process/auto.py | from typing import Iterable, Callable, Literal
import numpy as np
import numpy.typing as npt
import os
from glob import glob
from re import fullmatch
from warnings import warn
from ..utils import indices_corr_all
from ..raw_covariance_matrices import collect_raw_covariance_matrices
from ..convergence_check_extra import... | Python | MIT | 26,018 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pycorr_utils/sample_cov.py | r"These functions generate sample covariances of binned :math:`\xi(s,\mu)` from ``cosmodesi/pycorr`` ``s_mu`` `2PCF estimators <https://github.com/cosmodesi/pycorr>`_"
import pycorr
import numpy as np
import numpy.typing as npt
from .utils import reshape_pycorr
def sample_cov_from_pycorr(xi_estimators: list[list[pyc... | Python | MIT | 6,303 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pycorr_utils/counts.py | "This reads a cosmodesi/pycorr .npy file and generates binned pair counts text file for RascalC to use"
import pycorr
import numpy as np
import numpy.typing as npt
from .utils import reshape_pycorr
def get_counts_from_pycorr(xi_estimator: pycorr.twopoint_estimator.BaseTwoPointEstimator, counts_factor: float | None =... | Python | MIT | 1,702 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pycorr_utils/input_xi.py | "This reads cosmodesi/pycorr .npy file(s) and generates input xi text file for RascalC to use"
import pycorr
import numpy as np
from .utils import reshape_pycorr, write_xi_file
from typing import Callable
def get_input_xi_from_pycorr(xi_estimator: pycorr.twopoint_estimator.BaseTwoPointEstimator):
# assume alread... | Python | MIT | 2,133 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pycorr_utils/sample_cov_multipoles.py | r"These functions generate sample covariances of binned :math:`\xi_\ell(s)` from ``cosmodesi/pycorr`` ``s_mu`` `2PCF estimators <https://github.com/cosmodesi/pycorr>`_"
import pycorr
import numpy as np
from .utils import reshape_pycorr
def sample_cov_multipoles_from_pycorr(xi_estimators: list[list[pycorr.twopoint_es... | Python | MIT | 6,344 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pycorr_utils/utils.py | import pycorr
import numpy as np
from warnings import warn
from ..utils import format_skip_r_bins
from ..xi.utils import write_xi_file # for convenience of use in other scripts
def fix_bad_bins_pycorr(xi_estimator: pycorr.twopoint_estimator.BaseTwoPointEstimator) -> pycorr.twopoint_estimator.BaseTwoPointEstimator:
... | Python | MIT | 3,522 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pycorr_utils/jack.py | "This reads a cosmodesi/pycorr .npy file and generates jackknife xi, weight, paircounts, and total paircounts text files for RascalC to use"
import pycorr
import numpy as np
import numpy.typing as npt
from .utils import reshape_pycorr, fix_bad_bins_pycorr, write_xi_file
from .counts import get_counts_from_pycorr
def... | Python | MIT | 4,117 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/redshift_cut.py | """Convenience script to perform redshift cut on an input (Ra,Dec,z,w) FITS or txt file and save the result in a .txt file for use with further scripts. (Michael Rashkovetskyi 2022).
Output file format has (Ra,Dec,z,w) coordinates
Parameters:
INFILE = input ASCII or FITS file
OUTFILE = output .txt ... | Python | MIT | 1,966 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/utils.py | import numpy as np
from astropy.io import fits
from warnings import warn
def my_str_to_bool(s: str) -> bool:
# naive conversion to bool for all non-empty strings is True, and one can't give an empty string as a command line argument, so need to make it more explicit
return s not in ("0", "false")
def parse_... | Python | MIT | 1,880 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/take_subset_of_particles.py | """This script takes an input txt file listing the (x,y,z,w,j) coordinates of random particles and selects N random particles from this, which it writes to file."""
import numpy as np
import time
from tqdm import tqdm
from typing import Callable
def take_subset_of_particles(infile_name: str, outfile_name: str, N: in... | Python | MIT | 1,606 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/normalize_weights.py | """Convenience script to normalize weights in an input (x,y,z,w) or (x,y,z,w,j) txt file and save the result in another .txt file for use with further scripts. (Michael Rashkovetskyi 2023).
Parameters:
INFILE = input ASCII file
OUTFILE = output ASCII file
"""
import numpy as np
from typing import... | Python | MIT | 1,030 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/convert_to_xyz.py | """Convenience script to convert an input (Ra,Dec,w) FITS or txt file to comoving (x,y,z) coordinates saved as a .txt file for use with the main C++ code. (Oliver Philcox 2018 with modifications by Michael Rashkovetskyi 2022, using Daniel Eisenstein's 2015 WCDM Coordinate Converter).
Output file format has (x,y,z,w) co... | Python | MIT | 3,992 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/create_jackknives_pycorr.py | """ This function will assign a jackknife region to each input particle, in a way compatible with pycorr used in DESI data processing. Data is saved as a 5 column text file."""
import numpy as np
import numpy.typing as npt
import os
import pycorr
from typing import Callable
def get_subsampler_xirunpc(ref_positions: ... | Python | MIT | 2,681 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/__init__.py | from .convert_to_xyz import comoving_distance_Mpch
from .create_jackknives_pycorr import get_subsampler_xirunpc | Python | MIT | 111 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/wcdm/incomplete_beta.py | # This is an adaptation by Daniel Eisenstein of GSL code in
# beta_cont_frac_gsl(a, b, x).
# This file is distributed under the GNU Public License
import numpy as np
######### An adaptation of the GSL beta function code
def beta_cont_frac_gsl(a, b, x):
# This computes B_x(a,b) using a continued fraction appr... | Python | MIT | 3,338 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/wcdm/wcdm.py | # Python implementation of formulae in Eisenstein (2015).
#
# Written by Daniel Eisenstein, save for adaptation of GSL code in
# beta_cont_frac_gsl(a, b, x).
'''
wcdm(z,om,w): Compute the proper motion distance in (c/H_0) units.
Allows vector z, om, and/or w
Can accept any om>0.
Requires w<-1/3 if one is ... | Python | MIT | 16,007 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/pre_process/wcdm/__init__.py | from .wcdm import *
| Python | MIT | 20 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/xi/convert_to_multipoles.py | ### Script to convert a measured 2PCF in xi(r,mu) format to Legendre multipoles, i.e. xi_ell(r).
### This computes all even multipoles up to a specified maximum ell, approximating the integral by a sum.
### The output form is a text file with the first column specifying the r-bin, the second giving xi_0(r), the third w... | Python | MIT | 1,561 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/xi/smoothen.py | ### Script to smoothen a measured 2PCF in xi(r,mu) format.
### This computes all even multipoles xi_ell(r) up to a specified maximum ell, approximating the integral by a sum.
### Then r^2*xi_ell(r) are smoothened with Savitzky-Golay filter
### Finally, they are transformed back to xi(r,mu) format.
from scipy.signal im... | Python | MIT | 1,894 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/xi/utils.py | import numpy as np
import numpy.typing as npt
import os
from ..utils import my_a2s
def read_xi_file(xi_file: str):
# Interpret RascalC text format using numpy functions
if not os.path.isfile(xi_file): raise FileNotFoundError('Could not find input file %s' % xi_file)
r_vals = np.genfromtxt(xi_file, max_row... | Python | MIT | 784 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process_3pcf/__init__.py | from .default import post_process_3pcf | Python | MIT | 38 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/post_process_3pcf/default.py | """
Function to post-process the single-field 3PCF Legendre binned integrals computed by the C++ code.
We output the theoretical covariance matrices, (quadratic-bias corrected) precision matrices and the effective number of samples, N_eff.
"""
import numpy as np
import os
from tqdm import trange
from typing import Cal... | Python | MIT | 5,177 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/comb/combine_covs_legendre_multi.py | from pycorr import TwoPointCorrelationFunction
import numpy as np
import numpy.typing as npt
from ..pycorr_utils.utils import reshape_pycorr
from ..cov_utils import get_cov_header, load_cov_legendre_multi
from ..pycorr_utils.counts import get_counts_from_pycorr
from ..mu_bin_legendre_factors import compute_mu_bin_legen... | Python | MIT | 5,896 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/comb/combine_covs_legendre.py | from pycorr import TwoPointCorrelationFunction
import numpy as np
import numpy.typing as npt
from ..pycorr_utils.utils import reshape_pycorr
from ..cov_utils import get_cov_header, load_cov_legendre
from ..pycorr_utils.counts import get_counts_from_pycorr
from ..mu_bin_legendre_factors import compute_mu_bin_legendre_fa... | Python | MIT | 5,397 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/comb/convert_cov_legendre_multi_to_cat.py | from pycorr import TwoPointCorrelationFunction
import numpy as np
import numpy.typing as npt
from ..pycorr_utils.utils import reshape_pycorr
from ..cov_utils import get_cov_header, load_cov_legendre_multi
from ..pycorr_utils.counts import get_counts_from_pycorr
from ..mu_bin_legendre_factors import compute_mu_bin_legen... | Python | MIT | 6,011 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/comb/combine_covs_legendre_multi_to_cat.py | from pycorr import TwoPointCorrelationFunction
import numpy as np
import numpy.typing as npt
from ..pycorr_utils.utils import reshape_pycorr
from ..cov_utils import get_cov_header, load_cov_legendre_multi
from ..pycorr_utils.counts import get_counts_from_pycorr
from ..mu_bin_legendre_factors import compute_mu_bin_legen... | Python | MIT | 9,106 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/comb/combine_covs_multi.py | from pycorr import TwoPointCorrelationFunction
import numpy as np
import numpy.typing as npt
from ..pycorr_utils.utils import reshape_pycorr
from ..cov_utils import get_cov_header, load_cov
from ..pycorr_utils.counts import get_counts_from_pycorr
from typing import Callable
def combine_covs_multi(rascalc_results1: str... | Python | MIT | 4,839 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | RascalC/comb/combine_covs.py | from pycorr import TwoPointCorrelationFunction
import numpy as np
import numpy.typing as npt
from ..pycorr_utils.utils import reshape_pycorr
from ..cov_utils import get_cov_header, load_cov
from ..pycorr_utils.counts import get_counts_from_pycorr
from typing import Callable
def combine_covs(rascalc_results1: str, ras... | Python | MIT | 4,520 |
[ascl:1909.008] | https://github.com/oliverphilcox/RascalC | docs/redirects.txt | usage/installation legacy/installation
usage/getting-started legacy/getting-started
usage/tutorial legacy/tutorial
usage/tutorial_periodic legacy/tutorial_periodic
usage/pre-processing legacy/pre-processing
usage/jackknife-weights legacy/jackknife-weights
usage/geometry-correction legacy/geometry-correction
usage/corre... | Text | MIT | 500 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.