clevar.footprint.footprint module

class clevar.footprint.footprint.Footprint(nside=None, tags=None, nest=False, **kwargs)[source]

Bases: clevar.catalog.TagData

Functions for footprint management

Variables
  • ~Footprint.nside (int) – Heapix NSIDE

  • ~Footprint.nest (bool) – If ordering is nested

  • ~Footprint.data (clevar.ClData) – Data with columns: pixel, detfrac, zmax

  • ~Footprint.pixel_dict (dict) – Dictionary to point to pixel in data

  • ~Footprint.size (int) – Number of objects in the catalog

  • ~Footprint.tags (LoweCaseDict) – Tag for main quantities used in matching and plots (ex: pixel, detfrac, zmax)

get_coverfrac(cl_ra, cl_dec, cl_z, aperture_radius, aperture_radius_unit, cosmo=None, wtfunc=<function Footprint.<lambda>>)[source]

Get cover fraction with a given window.

\[CF(R) = \frac{\sum_{r_i<R}w(r_i)df(r_i)}{\sum_{r_i<R}w(r_i)}\]

where the index i represents pixels of the footprint, \(r_i\) is the distance between the cluster center and the pixel center, \(R\) is the aperture radius to be considered and \(w\) is the window function.

Parameters
  • cl_ra (float) – Cluster RA in deg

  • cl_dec (float) – Cluster DEC in deg

  • cl_z (float) – Cluster redshift

  • aperture_radius (float) – Radius of aperture

  • aperture_radius_unit (str) – Unit of aperture radius

  • cosmo (clevar.Cosmology object) – Cosmology object for when aperture has physical units.

  • wtfunc (function) – Window function, must take (pixels, SkyCoord) as input. Default is flat window.

Returns

Cover fraction

Return type

float

get_coverfrac_nfw2D(cl_ra, cl_dec, cl_z, cl_radius, cl_radius_unit, aperture_radius, aperture_radius_unit, cosmo)[source]

Cover fraction with NFW 2D flatcore window.

\[CF(R) = \frac{\sum_{r_i<R}w_{NFW}(r_i)df(r_i)}{\sum_{r_i<R}w_{NFW}(r_i)}\]

where the index i represents pixels of the footprint, \(r_i\) is the distance between the cluster center and the pixel center, \(R\) is the aperture radius to be considered and \(w_{nfw}\) is the NFW 2D flatcore window function.

Parameters
  • cl_ra (float) – Cluster RA in deg

  • cl_dec (float) – Cluster DEC in deg

  • cl_z (float) – Cluster redshift

  • cl_radius (float) – Cluster radius

  • cl_radius_unit (str) – Unit of cluster radius

  • aperture_radius (float) – Radius of aperture

  • aperture_radius_unit (str) – Unit of aperture radius

  • cosmo (clevar.Cosmology object) – Cosmology object.

Return type

float

Notes

The NFW 2D function was taken from section 3.1 of arXiv:1104.2089 and was validated with Rs = 0.15 Mpc/h (0.214 Mpc) and Rcore = 0.1 Mpc/h (0.142 Mpc).

get_map(data, bad_val=0)[source]

Transforms a internal quantity into a map

Parameters
  • data (str) – Name of internal data to be used.

  • bad_val (float, None) – Values for pixels outside footprint.

Returns

Healpix map with the given values, other pixels are zero

Return type

Map

get_values_in_pixels(data, pixels, bad_val, transform=<function Footprint.<lambda>>)[source]

Transforms a internal quantity into a map

Parameters
  • values (array) – Values in each pixel.

  • data (str) – Name of internal data to be used.

  • pixels (list) – List of pixels

  • bad_val (float, None) – Values for pixels outside footprint.

  • transform (function) – Function to be applied to data for value in pixel. Default is f(data)=data.

Returns

Healpix map with the given values, other pixels are zero

Return type

Map

property nest
property nside
property pixel_dict
plot(data, bad_val=- 1.6375e+30, auto_lim=False, ra_lim=None, dec_lim=None, cluster=None, cluster_kwargs=None, cosmo=None, fig=None, figsize=None, **kwargs)[source]

Plot footprint. It can also overlay clusters with their radial sizes.

Parameters
  • data (str) – Name of internal data to be used.

  • bad_val (float) – Values for pixels outside footprint.

  • auto_lim (bool) – Set automatic limits for ra/dec.

  • ra_lim (list) – RA limits in degrees.

  • dec_lim (list) – DEC limits in degrees.

  • cluster (clevar.ClCatalog) – Clusters to be overlayed on footprint.

  • cluster_kwargs (dict, None) – Keyword arguments to plot clusters. If cluster radius used, arguments for plt.Circle function, if not arguments for plt.scatter.

  • cosmo (clevar.Cosmology object) – Cosmology object for when cluster radius has physical units.

  • fig (matplotlib.figure.Figure, None) – Matplotlib figure object. If not provided a new one is created.

  • figsize (tuple) – Width, height in inches (float, float). Default value from hp.cartview.

  • **kwargs

    Extra arguments for hp.cartview:

    • xsize (int) : The size of the image. Default: 800

    • title (str) : The title of the plot. Default: None

    • min (float) : The minimum range value

    • max (float) : The maximum range value

    • remove_dip (bool) : If True, remove the dipole+monopole

    • remove_mono (bool) : If True, remove the monopole

    • gal_cut (float, scalar) : Symmetric galactic cut for the dipole/monopole fit. Removes points in latitude range [-gal_cut, +gal_cut]

    • format (str) : The format of the scale label. Default: ‘%g’

    • cbar (bool) : Display the colorbar. Default: True

    • notext (bool) : If True, no text is printed around the map

    • norm ({‘hist’, ‘log’, None}) : Color normalization, hist= histogram equalized color mapping, log= logarithmic color mapping, default: None (linear color mapping)

    • cmap (a color map) : The colormap to use (see matplotlib.cm)

    • badcolor (str) : Color to use to plot bad values

    • bgcolor (str) : Color to use for background

    • margins (None or sequence) : Either None, or a sequence (left,bottom,right,top) giving the margins on left,bottom,right and top of the axes. Values are relative to figure (0-1). Default: None

Returns

fig – Figure of the plot. The main can be accessed at fig.axes[0], and the colorbar at fig.axes[1].

Return type

matplotlib.pyplot.figure

classmethod read(filename, nside, tags, nest=False, full=False)[source]

Loads fits file and converst to FootprintZmax object

Parameters
  • filename (str) – Name of input file

  • nside (int) – Healpix nside

  • pixel_name (str) – Name of pixel column

  • detfrac_name (str, None) – Name of detection fraction colum. If None value 1 is assigned.

  • zmax_name – Name of maximum redshit colum. If None value 99 is assigned.

  • tags (LoweCaseDict, None) – Tags for table (required if full=False).

  • full (bool) – Reads all columns of the catalog

zmax_masks_from_footprint(ra, dec, z)[source]

Create a zmax mask for a catalog based on a footprint

Parameters
  • ra (numpy array) – Ra array in degrees

  • dec (numpy array) – Dec array in degrees

  • z (numpy array) – Redshift array

Returns

Arrays of booleans of objects in footprint

Return type

ndarray