Catalogs handling#
This module contains some functions to handle catalogs.
Reading .fits
files#
The read_fits()
function reads a FITS file and returns a pandas DataFrame, with the same
columns names. It can check the cubic or cutsky formatting that we expect for a DESI file, but this
is optional.
It also applies the E-correction [1] to the magnitudes by default.
Applying some cuts#
The catalog_cuts()
function applies some cuts on the catalog, and returns a new DataFrame.
See the API section for more details.
Creating a random file#
The create_random()
function creates a random catalog from several randoms catalogs provided.
Note
This function is mainly used to avoid concatenating all the randoms catalogs in a single file,
and does not actually generates randoms. (This is done by the CorrHOD_cutsky
class.)
API#
- CorrHOD.catalogs.read_fits(file: str, apply_E_correction: bool = True, z_cubic: float = 0.2, check_cutsky_format: bool = False, check_cubic_format: bool = False, print_column_names: bool = False) DataFrame [source][source]#
Reads a fits file from the Abacus simulation and returns the data as a Pandas DataFrame.
- A DESI cutsky file must be in the format of the DESI simulations. (i.e. contain the following columns :
RA : Right ascension (in degrees)
DEC : Declination (in degrees)
Z : Redshift of the observed galaxy (in redshift space)
Z_COSMO : Redshift of the galaxy in the comoving frame (in real space)
R_MAG_ABS : Absolute magnitude
R_MAG_APP : Apparent magnitude
G_R_REST : Color (g-r) of the galaxy in the rest frame
HALO_MASS : Halo mass of the galaxy
STATUS : Status of the galaxy (if the galaxy is in the DESI footprint or not)
)
- A DESI cubic box file must be in the format of the DESI simulations. (i.e. contain the following columns :
x : x coordinate of the galaxy in the comoving frame (in real space)
y : y coordinate of the galaxy in the comoving frame (in real space)
z : z coordinate of the galaxy in the comoving frame (in real space)
vx : x-component of velocity, in km/s (not comoving)
vy : y-component of velocity, in km/s (not comoving)
vz : z-component of velocity, in km/s (not comoving)
R_MAG_ABS : Absolute magnitude
HALO_MASS : Halo mass of the galaxy
)
- Parameters:
file (str) – Path to the file.
apply_E_correction (bool, optional) – If True, corrects the evolution in the spectrum over the redshift interval on the absolute magnitude. Defaults to True.
z_cubic (float, optional) – Redshift of the cubic snapshot for E-correction. Defaults to 0.2.
check_cutsky_format (bool, optional) – If True, checks if the file is in the format of a DESI cutsky (see above). Defaults to False.
check_cubic_format (bool, optional) – If True, checks if the file is in the format of a DESI cubic box (see above). Defaults to False.
print_column_names (bool, optional) – If True, prints the names of the columns in the file. Defaults to False.
- Returns:
data – Data contained in the file.
- Return type:
Pandas DataFrame
- CorrHOD.catalogs.E_correction(z, Q0=-0.97, z0=0.1)[source][source]#
Corrects the evolution in the spectrum over the redshift interval on the absolute magnitude.
- Parameters:
z (array_like) – Redshift of the observed galaxy (in redshift space).
Q0 (float, optional) – Corrective factor.
z0 (float, optional) – Reference redshift
- Returns:
E_correction – Correction to apply on the absolute magnitude.
- Return type:
array_like
- CorrHOD.catalogs.status_mask(main=0, nz=0, Y5=0, sv3=0)[source][source]#
Returns the status value of the points to select in the catalog
- CorrHOD.catalogs.catalog_cuts(data, zmin: float = 0.1, zmax: float = 2.0, abs_mag: float = -21.5, app_mag: float = 19.5, status_mask=status_mask(nz=1, Y5=1), cap: str = 'NGC')[source][source]#
Applies a mask to the provided data to reduce it according to the parameters
- Parameters:
data (pandas.DataFrame) – Data on which the mask should be applied
zmin (float, optional) – Minimum value of redshift to keep. Defaults to 0.1
zmax (float, optional) – Maximum value of redshift to keep. Defaults to 0.1
abs_mag (float, optional) – The cut in absolute magnitude. Only the brighter galaxies (smaller magnitudes) will be kept. Only applied if the data has a comumn named ‘R_MAG_ABS’. Set to None to disable. Defaults to -21.5
app_mag (float, optional) – The cut in apparent magnitude. Only the brighter galaxies (smaller magnitudes) will be kept. Only applied if the data has a comumn named ‘R_MAG_APP’. Set to None to disable. Defaults to 19.5
status_mask (_type_, optional) – The value of the STATUS column to keep. Requires a bit value, as in https://desi.lbl.gov/trac/wiki/CosmoSimsWG/FirstGenerationMocks The status_mask() function can also be used. Defaults to status_mask(nz=1, Y5=1) (i.e. Y5 survey, with n(z) applied)
cap (str, optional) – The cap to keep. Can be ‘NGC’ or ‘SGC’. Only applied if the cap column exists. Set to None to disable. Defaults to ‘NGC’
- Returns:
_description_
- Return type:
_type_
- CorrHOD.catalogs.create_random(path: str, multiplier: int = 5) DataFrame [source][source]#
Creates a random catalog with the x1 catalogs in the provided path. The number of randoms is equal to multiplier times the number of galaxies in the data catalog.
- Parameters:
path (str) – The path to the file containing the x1 random catalogs.
multiplier (int) – The number of randoms in the random catalog is equal to multiplier times the number of galaxies in the data catalog.
- Returns:
random – The random catalog.
- Return type:
array_like
Footnotes