Data Type Classes
TXPipe stage input and output files are all represented by a class which defines their type and various other pieces of information.
Generic data types, such as HDF and Text file types, are inherited from ceci. TXPipe defines more specific types, like ShearCatalog.
The available types are described below.
This file contains TXPipe-specific file types, subclassing the more generic types in ceci.
- class txpipe.data_types.BinnedCatalog(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
HDFFile- required_datasets = []
- class txpipe.data_types.CSVFile(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
DataFile- suffix = 'csv'
- class txpipe.data_types.ClusteringNoiseMaps(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
MapsFile
- class txpipe.data_types.FiducialCosmology(path, mode, extra_provenance=None, validate=True, load_mode='full')[source]
Bases:
YamlFile
- class txpipe.data_types.LensingNoiseMaps(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
MapsFile- required_datasets = []
- class txpipe.data_types.MapsFile(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
HDFFile- plot_healpix(map_name, view='cart', rot180=False, nside=None, reduction='mean', key=None, weight_map=None, **kwargs)[source]
Plots healpix map using healpy tools
The map is read as a HealSparse map, optionally degraded to a target nside, converted to a Healpix array, and plotted with healpy
- Parameters:
map_name (str) – Name of the map to read and plot.
view ({"cart", "moll"}, optional) – Healpy view type: Cartesian (“cart”) or Mollweide (“moll”).
rot180 (bool, optional) – If True, rotate the map by 180 degrees in longitude before plotting.
nside (int, optional) – Target Healpix nside for visualization. Defaults to the sparse nside of the input map.
reduction (str, optional) – Reduction operation used when generating the Healpix map from the HealSparse representation (e.g. “mean”, “sum”).
key (str, optional) – Optional key used if healsparse map is a recarray
**kwargs – Additional keyword arguments passed directly to the underlying healpy plotting function (e.g.
min,max,cmap).
- read_map(map_name)[source]
Read map and return as a healsparse map
- Parameters:
map_name (str) – The name of this map
- read_map_healpix(map_name, nside=None, reduction='mean', key=None, nest=True)[source]
Read map and return as a healpix array
- Parameters:
map_name (str) – The name of this map
nside (int (healsparse argument)) – Output nside resolution parameter (should be a multiple of 2). If not specified the output resolution will be equal to the parent’s sparsemap nside_sparse
reduction (str (healsparse argument)) – If a change in resolution is requested, this controls the method to reduce the map computing the “mean”, “median”, “std”, “max”, “min”, “sum” or “prod” (product) of the neighboring pixels to compute the “degraded” map.
key (str (healsparse argument)) – If the parent HealSparseMap contains recarrays, key selects the field that will be transformed into a HEALPix map.
nest (bool, optional (healsparse argument)) – Output healpix map should be in nest format?
- read_mask(mask_name=None, thresh=0.0, degrade_nside=None, returnbool=False)[source]
Read the mask and return as a healsparse map
- Parameters:
map_name (str or None (optional)) – The name of this mask, if None wil load the default “mask”
thresh (float (optional)) – minimum fractional coverage of a pixel (at native nside)
degrade_nside (int) – if required, degrade the mask to this nside
returnbool (bool) – if True, will return a binary map where any pixel with mask > 0 is True if mask was already boolean, return unchanged
- read_mask_healpix(mask_name=None, thresh=0.0, degrade_nside=None)[source]
Read the mask and return as a healpix array
- Parameters:
map_name (str or None (optional)) – The name of this mask, if None wil load the default “mask”
thresh (float (optional)) – minimum fractional coverage of a pixel (at native nside)
degrade_nside (int or None (optional)) – degrade the mask to this nside before converting to healpix array
- required_datasets = []
- write_map(map_name, hsp_map, metadata)[source]
Save an output healsparse map to an HDF5 subgroup in healsparse format
- Parameters:
map_name (str) – The name of this map, used as the name of a subgroup in the group where the data is stored.
pixel (array) – Array of indices of observed pixels
value (array) – Array of values of observed pixels
metadata (mapping) – Dict or other mapping of metadata to store along with the map
- write_map_pixval(map_name, pixel, value, metadata, nside_coverage=32)[source]
Save an array of pixel indices and values to an HDF5 subgroup in healsparse format
The metadata is also saved.
- Parameters:
map_name (str) – The name of this map, used as the name of a subgroup in the group where the data is stored.
pixel (array) – Array of indices of observed pixels
value (array) – Array of values of observed pixels
metadata (mapping) – Dict or other mapping of metadata to store along with the map
nside_coverage (int) – nside of the healsparse coverage map
- class txpipe.data_types.PhotometryCatalog(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
HDFFile
- class txpipe.data_types.PhotozPDFFile(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
HDFFile- required_datasets = []
- class txpipe.data_types.QPMultiFile(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
HDFFileThis type represents and HDF file collecting multiple qp objects together.
We currently use it when multiple realizations of the same n(z) are being generated in the summarize stage.
- class txpipe.data_types.QPNOfZFile(*args, **kwargs)[source]
Bases:
QPBaseFileThe final ensemble row represents the 2D (non-tomographic) n(z).
In a few places TXPipe assumes that the pdf type is one of the grid types, and will raise an error otherwise; in particular the stacking stage.
- class txpipe.data_types.QPPDFFile(*args, **kwargs)[source]
Bases:
QPBaseFile
- class txpipe.data_types.RandomsCatalog(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
HDFFile- required_datasets = ['randoms/ra', 'randoms/dec']
- class txpipe.data_types.SACCFile(path, mode, extra_provenance=None, validate=True, **kwargs)[source]
Bases:
DataFile- classmethod open(path, mode, **kwargs)[source]
Open a data file. The base implementation of this function just opens and returns a standard python file object.
Subclasses can override to either open files using different openers (like fitsio.FITS), or, for more specific data types, return an instance of the class itself to use as an intermediary for the file.
- read_provenance()[source]
Concrete subclasses for which it is possible should override this method and read the provenance information from the file.
Other classes will return this dictionary of UNKNOWNs
- suffix = 'sacc'
- class txpipe.data_types.ShearCatalog(*args, **kwargs)[source]
Bases:
HDFFileA generic shear catalog
- property catalog_type