catalog
This module contains functions to read, validate and make necessary changes to DESI quasar catalogs. Can be imported without a need for MPI.
- _accepted_extnames = {'METADATA', 'QSO_CAT', 'ZCATALOG'}
Accepted extensions for quasar catalog.
- Type:
- _required_columns = [{'TARGETID'}, {'Z'}, {'RA', 'TARGET_RA'}, {'DEC', 'TARGET_DEC'}]
Required columns for all cases.
- _required_data_columns = [{'SURVEY'}, {'COADD_LASTNIGHT', 'LASTNIGHT', 'LAST_NIGHT'}]
Required columns for real data analysis.
- _required_tile_columns = [{'TILEID'}, {'PETAL_LOC'}]
Required columns for tile data analysis.
- _optional_columns = ['HPXPIXEL', 'PROGRAM', 'VMIN_CIV_450', 'VMAX_CIV_450', 'VMIN_CIV_2000', 'VMAX_CIV_2000']
Optional columns.
- read_quasar_catalog(filename, is_mock=False, is_tile=False, keep_surveys=None, zmin=0, zmax=100.0)[source]
Returns a quasar catalog object (ndarray).
It is sorted in the following order: 1. HPXPIXEL or TILEID 2. SURVEY or PETAL_LOC (if applicable), 3. TARGETID. BAL info included if available. It is required for BAL masking. If ‘HPXPIXEL’ column is not present, n_side is assumed 16 for mocks, 64 for data.
- Parameters:
filename (str) – Filename to catalog.
is_mock (bool, default: False) – If the catalog is for mocks.
is_tile (bool, default: False) – If the catalog is for tiles. Duplicate TARGETIDs are allowed as long as they are in different TILEIDs.
keep_surveys (None or list(str), default: None) – List of surveys to subselect. None keeps all.
zmin (float, default: 0) – Minimum quasar redshift
zmax (float, default: 100) – Maximum quasar redshift
- Returns:
catalog – Sorted catalog.
- Return type:
- mpi_read_quasar_catalog(filename, comm=None, mpi_rank=0, is_mock=False, is_tile=False, keep_surveys=None, zmin=0, zmax=100)[source]
Returns the same quasar catalog object on all MPI ranks.
It is sorted in the following order: HPXPIXEL, SURVEY (if applicable), TARGETID. BAL info included if available. It is required for BAL masking.
Can be used without MPI by passing
comm=Noneandmpi_rank=0.- Parameters:
filename (str) – Filename to catalog.
comm (MPI comm object or None, default: None) – MPI comm object for bcast
mpi_rank (int, default: 0) – Rank of the MPI process
is_mock (bool, default: False) – If the catalog is for mocks.
is_tile (bool, default: False) – If the catalog is for tiles. Duplicate TARGETIDs are allowed.
keep_surveys (None or list(str), default: None) – List of surveys to subselect. None keeps all.
zmin (float, default: 0) – Minimum quasar redshift
zmax (float, default: 100) – Maximum quasar redshift
- Returns:
catalog – Sorted catalog on all MPI ranks.
- Return type:
- Raises:
QsonicException – If error occurs while reading the catalog.
- mpi_get_local_queue(filename, comm=None, mpi_rank=0, mpi_size=1, is_mock=False, is_tile=False, keep_surveys=None, zmin=0, zmax=100.0)[source]
Reads catalog on master and scatter a list of catalogs to every mpi_rank. If in tile format, sort key is ‘TILEID’.
- Parameters:
filename (str) – Filename to catalog.
comm (MPI comm object or None, default: None) – MPI comm object for scatter
mpi_rank (int) – Rank of the MPI process
mpi_size (int) – Size of MPI processes
is_mock (bool, default: False) – If the catalog is for mocks.
is_tile (bool, default: False) – If the catalog is for tiles. Split key will be ‘TILEID’. Duplicate TARGETIDs are allowed.
keep_surveys (None or list(str), default: None) – List of surveys to subselect. None keeps all.
zmin (float, default: 0) – Minimum quasar redshift
zmax (float, default: 100) – Maximum quasar redshift
- Returns:
local_queue – List of sorted catalogs.
- Return type:
list(
ndarray)
- _validate_adjust_column_names(catalog, is_mock, is_tile)[source]
Validate catalog for required columns in _required_columns. ‘SURVEY’ is also required for data. ‘TARGET_{RA, DEC}’ is transformed to ‘RA’ and ‘DEC’ in return.
- Parameters:
- Returns:
catalog – Catalog. No checks are performed.
- Return type:
- _add_healpix(catalog, n_side, keep_columns)[source]
Add ‘HPXPIXEL’ column to catalog if not present.
- _prime_catalog(catalog, n_side, keep_surveys, zmin, zmax, is_tile)[source]
Returns quasar catalog object. It is sorted in the following order: sort_key (HPXPIXEL), SURVEY (if applicable), TARGETID
- Parameters:
- Returns:
catalog – Sorted catalog. BAL info included if available (req. for BAL masking)
- Return type: