shapepipe.modules.mccd_package.mccd_plot_utilities

shapepipe.modules.mccd_package.mccd_plot_utilities

MCCD PLOTS UTILITIES.

This module is used to generate a series of plots from the merged validation catalogues. It plots the Mean shape plots for the merged validation catalogue. It can also plot the rho statistics provided that the required packages are installed.

Author

Tobias Liaudat

megacam_pos(index)[source]

Handle MegaCam Positions.

Parameters

index (int) – MegaCam position index

Returns

Updated index

Return type

int

megacam_flip(xbins, ybins, ccd_nb, nb_pixel)[source]

Flip MegaCam.

Parameters
  • xbins (int) – X-axis bins

  • ybins (int) – Y-axis bins

  • ccd_nb (int) – CCD number

  • nb_pixel (int) – Number of pixels

Returns

Number of bins in the x and y axes

Return type

tuple

megacam_flip_2(xbins, ybins, ccd_nb, nb_pixel)[source]

Flip MegaCam 2.

Parameters
  • xbins (int) – X-axis bins

  • ybins (int) – Y-axis bins

  • ccd_nb (int) – CCD number

  • nb_pixel (int) – Number of pixels

Returns

Number of bins in the x and y axes

Return type

tuple

mean_shapes_plot(ccd_maps, filename, title='', colorbar_ampl=1.0, wind=None, cmap='bwr')[source]

Mean Shapes Plot.

Plot mean shapes from CCD maps.

Parameters
  • ccd_maps (numpy.ndarray) – CCD maps

  • filename (str) – File name

  • title (str, optional) – Plot title

  • colorbar_ampl (float, optional) – Colour bar amplitude; default is 1.0

  • wind (numpy.ndarray, optional) – minimum and maximum values for color map; determined from ccd_maps if None (default)

  • cmap (str, optional) – Colour map; default is bwr

plot_meanshapes(starcat_path, output_path, nb_pixel, w_log, hdu_no=2, remove_outliers=False, plot_meanshapes=True, plot_histograms=True, psf_model_type='mccd')[source]

Plot Mean Shapes.

Plot mean shapes, sizes, and histograms

Parameters
  • starcat_path (str) – Input star and PSF catalogue

  • output_path (str) – Output directory for plots

  • nb_pixel (numpy.ndarray) – Number of pixels per CCD in x- and y-direction

  • w_log (logging.Logger) – Logging instance

  • hdu_no (int, optional) – HDU number of data in input FITS file; default is 2

  • remove_outliers (bool, optional) – Perform outlier rejection if True; default is False

  • plot_meanshape (bool, optional) – Plot mean focal plane ellipticities, sizes, and residuals if True; default is True

  • plot_histograms (bool, optional) – Plot 1D histogram of ellipticities, sizes, and residuals if True; default is True

  • psf_model_type (str, optional) – PSF model type, options are mccd or psfex; defualt is mccd

neg_dash(x_in, y_in, yerr_in, plot_name='', vertical_lines=True, xlabel='', ylabel='', rho_nb='', ylim=None, semilogx=False, semilogy=False, **kwargs)[source]

Neg Dash.

This function is for making plots with vertical errorbars, where negative values are shown in absolute value as dashed lines. The resulting plot can either be saved by specifying a file name as plot_name, or be kept as a pyplot instance (for instance to combine several neg dashes).

Parameters
  • x_in (numpy.ndarray) – X-axis inputs

  • y_in (numpy.ndarray) – Y-axis inputs

  • yerr_in (numpy.ndarray) – Y-axis error inputs

  • plot_name (str, optional) – Plot name

  • vertical_lines (bool, optional) – Option to plot vertical lines; default is True

  • xlabel (str, optional) – X-axis label

  • ylabel (str, optional) – Y-axis label

  • rho_nb (str, optional) – Rho number

  • ylim (float, optional) – Y-axis limit

  • semilogx (bool) – Option to plot the x-axis in log scale; default is False

  • semilogy (bool) – Option to plot the y-axis in log scale; default is False

class new_BaseCorrelationFunctionSysTest[source]

Bases: stile.sys_tests.BaseCorrelationFunctionSysTest

Base Function for the Correlation.

Based on style package class.

make_catalogue(data, config=None, use_as_k=None, use_chip_coords=False)[source]

Make Catalogue.

Parameters
  • data (numpy.ndarray) – Input data

  • config (dict) – The config parameter to be passed to TreeCorr’s catalogue, a configuration dict which defines attributes about how to read the file. Any optional keyword arguments may be given here in the config dict if desired; invalid keys in the config dict are ignored; See the TreeCorr package documentation for more details; default is None

  • use_as_k (str, optional) – String representing the field in data that will be used to replace the convergence, kappa, that is identified with the string k; see the TreeCorr package documentation for more details

  • use_chip_coords (bool, optional) – Option to use chip coordinates; default is False

Returns

An instance of the treecorr.Catalog class; contains a data catalogue that will be correlated

Return type

treecorr.Catalog

class Rho1SysTest[source]

Bases: shapepipe.modules.mccd_package.mccd_plot_utilities.new_BaseCorrelationFunctionSysTest

Rho1 System Test.

Compute the auto-correlation of residual star shapes (star shapes - psf shapes).

short_name = 'rho1'
long_name = 'Rho1 statistics (Auto-correlation of star-PSF shapes)'
objects_list = ['star PSF']
required_quantities = [('ra', 'dec', 'g1', 'g2', 'psf_g1', 'psf_g2', 'w')]
__call__(data, data2=None, random=None, random2=None, config=None, **kwargs)[source]

Call Method.

Parameters
  • data (numpy.ndarray) – Input data

  • data2 (numpy.ndarray, optional) – Second input data

  • random (numpy.ndarray, optional) – Random data

  • random2 (numpy.ndarray, optional) – Second random data

  • config (dict, optional) – Configuration dict to be passed to TreeCorr; default is None

Returns

A numpy array of the TreeCorr outputs, handled via the Stile package through the BaseCorrelationFunctionSysTest class

Return type

numpy.ndarray

class DESRho2SysTest[source]

Bases: shapepipe.modules.mccd_package.mccd_plot_utilities.new_BaseCorrelationFunctionSysTest

DES Rho 2 System Test.

Compute the correlation of PSF shapes with residual star shapes (star shapes - psf shapes).

short_name = 'rho2des'
long_name = 'Rho2 statistics (as defined in DES shape catalogue papers)'
objects_list = ['star PSF']
required_quantities = [('ra', 'dec', 'g1', 'g2', 'psf_g1', 'psf_g2', 'w')]
__call__(data, data2=None, random=None, random2=None, config=None, **kwargs)[source]

Call Method.

Parameters
  • data (numpy.ndarray) – Input data

  • data2 (numpy.ndarray, optional) – Second input data

  • random (numpy.ndarray, optional) – Random data

  • random2 (numpy.ndarray, optional) – Second random data

  • config (dict, optional) – Configuration dict to be passed to TreeCorr; default is None

Returns

A numpy array of the TreeCorr outputs, handled via the Stile package through the BaseCorrelationFunctionSysTest class

Return type

numpy.ndarray

class DESRho3SysTest[source]

Bases: shapepipe.modules.mccd_package.mccd_plot_utilities.new_BaseCorrelationFunctionSysTest

DES Rho 3 System Test.

Compute the correlation of star shapes weighted by the residual size.

short_name = 'rho3'
long_name = 'Rho3 statistics (Auto-correlation of star shapes weighted by the residual size)'
objects_list = ['star PSF']
required_quantities = [('ra', 'dec', 'sigma', 'g1', 'g2', 'psf_sigma', 'w')]
__call__(data, data2=None, random=None, random2=None, config=None, **kwargs)[source]

Call Method.

Parameters
  • data (numpy.ndarray) – Input data

  • data2 (numpy.ndarray, optional) – Second input data

  • random (numpy.ndarray, optional) – Random data

  • random2 (numpy.ndarray, optional) – Second random data

  • config (dict, optional) – Configuration dict to be passed to TreeCorr; default is None

Returns

A numpy array of the TreeCorr outputs, handled via the Stile package through the BaseCorrelationFunctionSysTest class

Return type

numpy.ndarray

class DESRho4SysTest[source]

Bases: shapepipe.modules.mccd_package.mccd_plot_utilities.new_BaseCorrelationFunctionSysTest

DES Rho 4 System Test.

Compute the correlation of star shapes weighted by the residual size.

short_name = 'rho4'
long_name = 'Rho4 statistics (Correlation of residual star shapes weighted by residual size)'
objects_list = ['star PSF']
required_quantities = [('ra', 'dec', 'g1', 'g2', 'sigma', 'psf_g1', 'psf_g2', 'psf_sigma', 'w')]
__call__(data, data2=None, random=None, random2=None, config=None, **kwargs)[source]

Call Method.

Parameters
  • data (numpy.ndarray) – Input data

  • data2 (numpy.ndarray, optional) – Second input data

  • random (numpy.ndarray, optional) – Random data

  • random2 (numpy.ndarray, optional) – Second random data

  • config (dict, optional) – Configuration dict to be passed to TreeCorr; default is None

Returns

A numpy array of the TreeCorr outputs, handled via the Stile package through the BaseCorrelationFunctionSysTest class

Return type

numpy.ndarray

class DESRho5SysTest[source]

Bases: shapepipe.modules.mccd_package.mccd_plot_utilities.new_BaseCorrelationFunctionSysTest

DES Rho 5 System Test.

The correlation of star shapes weighted by the residual size.

short_name = 'rho5'
long_name = 'Rho5 statistics (Correlation of star and PSF shapes weighted by residual size)'
objects_list = ['star PSF']
required_quantities = [('ra', 'dec', 'sigma', 'g1', 'g2', 'psf_sigma', 'w')]
__call__(data, data2=None, random=None, random2=None, config=None, **kwargs)[source]

Call Method.

Parameters
  • data (numpy.ndarray) – Input data

  • data2 (numpy.ndarray, optional) – Second input data

  • random (numpy.ndarray, optional) – Random data

  • random2 (numpy.ndarray, optional) – Second random data

  • config (dict, optional) – Configuration dict to be passed to TreeCorr; default is None

Returns

A numpy array of the TreeCorr outputs, handled via the Stile package through the BaseCorrelationFunctionSysTest class

Return type

numpy.ndarray

rho_stats(starcat_path, output_path, rho_def='HSC', hdu_no=2, ylim_l=None, ylim_r=None, print_fun=<function <lambda>>)[source]

Rho Statistics.

Compute and plot the five rho statistics.

Parameters
  • starcat_path (str) – Star catalogue file path

  • output_path (str) – Output directory for plots

  • hdu_no (int, optional) – Input HDU; default is 2

  • ylim_l (numpy.ndarray) – Y-axis limits for left-hand plot

  • ylim-r (numpy.ndarray) – Y-axis limits for right-hand plot

  • print_fun (callable, optional) – Output message function; default is print