clevar.match_metrics.recovery.catalog_funcs module¶
@file clevar/match_metrics/recovery/catalog_funcs.py
Main recovery functions using catalogs, wrapper of array_funcs functions
- clevar.match_metrics.recovery.catalog_funcs.plot(cat, col1, col2, bins1, bins2, matching_type, xlabel=None, ylabel=None, scale1='linear', **kwargs)[source]¶
Plot recovery rate as lines, with each line binned by bins1 inside a bin of bins2.
- Parameters
cat (clevar.ClCatalog) – ClCatalog with matching information
col1 (str) – Names of columns 1 and 2.
col2 (str) – Names of columns 1 and 2.
bins1 (array, int) – Bins for components 1 and 2.
bins2 (array, int) – Bins for components 1 and 2.
matching_type (str) – Type of matching to be considered. Must be in: ‘cross’, ‘cat1’, ‘cat2’, ‘multi_cat1’, ‘multi_cat2’, ‘multi_join’
mask (array) – Mask of unwanted clusters
mask_unmatched (array) – Mask of unwanted unmatched clusters (ex: out of footprint)
shape (str) – Shape of the lines. Can be steps or line.
ax (matplotlib.axes) – Ax to add plot
xlabel (str) – Label of component 1. Default is col1.
ylabel (str) – Label of recovery rate.
scale1 (str) – Scale of col 1 component
plt_kwargs (dict, None) – Additional arguments for pylab.plot. It also includes the possibility of smoothening the line with n_increase, scheme arguments. See clevar.utils.smooth_line for details.
lines_kwargs_list (list, None) – List of additional arguments for plotting each line (using pylab.plot). Must have same size as len(bins2)-1
add_legend (bool) – Add legend of bins
legend_format (function) – Function to format the values of the bins in legend
legend_kwargs (dict, None) – Additional arguments for pylab.legend
- Returns
info –
Information of data in the plots, it contains the sections:
ax: ax used in the plot.
data: Binned data used in the plot. It has the sections:
recovery: Recovery rate binned with (bin1, bin2). bins where no cluster was found have nan value.
edges1: The bin edges along the first dimension.
edges2: The bin edges along the second dimension.
counts: Counts of all clusters in bins.
matched: Counts of matched clusters in bins.
- Return type
dict
- clevar.match_metrics.recovery.catalog_funcs.plot2D(cat, col1, col2, bins1, bins2, matching_type, xlabel=None, ylabel=None, scale1='linear', scale2='linear', **kwargs)[source]¶
Plot recovery rate as in 2D bins.
- Parameters
cat (clevar.ClCatalog) – ClCatalog with matching information
col1 (str) – Names of columns 1 and 2.
col2 (str) – Names of columns 1 and 2.
bins1 (array, int) – Bins for component 1
bins2 (array, int) – Bins for component 2
matching_type (str) – Type of matching to be considered. Must be in: ‘cross’, ‘cat1’, ‘cat2’, ‘multi_cat1’, ‘multi_cat2’, ‘multi_join’
mask (array) – Mask of unwanted clusters
mask_unmatched (array) – Mask of unwanted unmatched clusters (ex: out of footprint)
ax (matplotlib.axes) – Ax to add plot
xlabel (str) – Labels of components 1 and 2. Default is col1, col2.
ylabel (str) – Labels of components 1 and 2. Default is col1, col2.
scale1 (str) – Scales of col 1, 2 components.
scale2 (str) – Scales of col 1, 2 components.
plt_kwargs (dict, None) – Additional arguments for pylab.pcolor.
add_cb (bool) – Plot colorbar
cb_kwargs (dict, None) – Colorbar arguments
add_num (int) – Add numbers in each bin
num_kwargs (dict, None) – Arguments for number plot (used in plt.text)
- Returns
info –
Information of data in the plots, it contains the sections:
ax: ax used in the plot.
cb (optional): colorbar.
data: Binned data used in the plot. It has the sections:
recovery: Recovery rate binned with (bin1, bin2). bins where no cluster was found have nan value.
edges1: The bin edges along the first dimension.
edges2: The bin edges along the second dimension.
counts: Counts of all clusters in bins.
matched: Counts of matched clusters in bins.
- Return type
dict
- clevar.match_metrics.recovery.catalog_funcs.plot_panel(cat, col1, col2, bins1, bins2, matching_type, xlabel=None, ylabel=None, scale1='linear', **kwargs)[source]¶
Plot recovery rate as lines in panels, with each line binned by bins1 and each panel is based on the data inside a bins2 bin.
- Parameters
cat (clevar.ClCatalog) – ClCatalog with matching information
col1 (str) – Names of columns 1 and 2.
col2 (str) – Names of columns 1 and 2.
bins1 (array, int) – Bins for components 1 and 2.
bins2 (array, int) – Bins for components 1 and 2.
matching_type (str) – Type of matching to be considered. Must be in: ‘cross’, ‘cat1’, ‘cat2’, ‘multi_cat1’, ‘multi_cat2’, ‘multi_join’
mask (array) – Mask of unwanted clusters
mask_unmatched (array) – Mask of unwanted unmatched clusters (ex: out of footprint)
shape (str) – Shape of the lines. Can be steps or line.
xlabel (str) – Label of component 1. Default is col1.
ylabel (str) – Label of recovery rate.
scale1 (str) – Scale of col 1 component
plt_kwargs (dict, None) – Additional arguments for pylab.plot. It also includes the possibility of smoothening the line with n_increase, scheme arguments. See clevar.utils.smooth_line for details.
panel_kwargs_list (list, None) – List of additional arguments for plotting each panel (using pylab.plot). Must have same size as len(bins2)-1
fig_kwargs (dict, None) – Additional arguments for plt.subplots
add_label (bool) – Add bin label to panel
label_format (function) – Function to format the values of the bins
- Returns
info –
Information of data in the plots, it contains the sections:
fig: matplotlib.figure.Figure object.
axes: matplotlib.axes used in the plot.
data: Binned data used in the plot. It has the sections:
recovery: Recovery rate binned with (bin1, bin2). bins where no cluster was found have nan value.
edges1: The bin edges along the first dimension.
edges2: The bin edges along the second dimension.
counts: Counts of all clusters in bins.
matched: Counts of matched clusters in bins.
- Return type
dict
- clevar.match_metrics.recovery.catalog_funcs.skyplot(cat, matching_type, nside=256, nest=True, mask=None, mask_unmatched=None, auto_lim=False, ra_lim=None, dec_lim=None, recovery_label='Recovery Rate', fig=None, figsize=None, **kwargs)[source]¶
Plot recovery rate in healpix pixels.
- Parameters
cat (clevar.ClCatalog) – ClCatalog with matching information
matching_type (str) – Type of matching to be considered. Must be in: ‘cross’, ‘cat1’, ‘cat2’, ‘multi_cat1’, ‘multi_cat2’, ‘multi_join’
nside (int) – Healpix nside
nest (bool) – If ordering is nested
mask (array) – Mask of unwanted clusters
mask_unmatched (array) – Mask of unwanted unmatched clusters (ex: out of footprint)
auto_lim (bool) – Set automatic limits for ra/dec.
ra_lim (None, list) – Min/max RA for plot.
dec_lim (None, list) – Min/max DEC for plot.
recovery_label (str) – Lable for colorbar. Default: ‘recovery rate’
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+monopoleremove_mono (bool) : If
True
, remove the monopolegal_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
info –
Information of data in the plots, it contains the sections:
fig (matplotlib.pyplot.figure): Figure of the plot. The main can be accessed at info[‘fig’].axes[0], and the colorbar at info[‘fig’].axes[1].
nc_pix: Dictionary with the number of clusters in each pixel.
nc_mt_pix: Dictionary with the number of matched clusters in each pixel.
- Return type
dict