hpmcm.shear_match module

class hpmcm.shear_match.ShearMatch(**kwargs)[source]

Bases: Match

Class to do N-way matching for shear calibration.

Uses pre-assigned pixel locations from cell-based coadd WCS.

Since the pixel locations and cells are pre-assigned, the only configurable parameters this class takes are the attributres listed here.

The pixel_match_scale can we used to allow for matching sources that are seperate by more that 1 pixel.

Expects 5 input catalogs: a reference catalog and 4 counterfactual shear catalogs.

Parameters:

kwargs (Any)

pixel_match_scale

Number of pixels to merge in original counts map

Type:

int

cat_type

Shear catalog type

Type:

str

deshear

Deshearing parameter, -1*applied shear. None -> deshearing is not done.

Type:

float | None

Notes

This expectes a list of parquet files with pandas DataFrames that contain the following columns.

Column name

Description

id

source ID

tract

Tract being matched

x_cell_coadd

X-postion in cell-based coadd used for metadetect

y_cell_coadd

Y-postion in cell-based coadd used for metadetect

snr

Signal-to-Noise of source, used for filtering and centroiding

cell_idx_x

Cell x-index within Tract

cell_idx_y

Cell y-index within Tract

g_1

Shear g1 component

g_2

Shear g1 component

(see hpmcm.input_tables.ShearCoaddSourceTable)

These parquet files can be generated from files with the following columns using the ShearMatch.splitByTypeAndClean() function.

Column name

Description

id

source ID

shear_type

one of “ns”, “1p”, “1m”, “2p” “2m”

patch_{x,y}

id of the patch within the tract

cell_{x,y}

id of the cell withing the patch

snr

Signal-to-Noise of source

{cat_type}_band_flux_{band}

Flux measuremnt in the reference band

{cat_type}_band_flux_err_{band}

Flux error in the reference band

{cat_type}_g_{i}

Shear measurements

Two additional tables are produced beyond the tables produced by the base hpmcm.Match class

Key

Class

_object_shear

hpmcm.output_tables.ShearTable

_cluster_shear

hpmcm.output_tables.ShearTable

classmethod createShearMatch(**kwargs)[source]

Helper function to create a ShearMatch object

This will use the use pixel-coordinates read from the input shear tables.

Return type:

ShearMatch

Parameters:

kwargs (Any) – Passed directly to ShearMatch constructor.

Return type:

Object to create matches for the requested region

extraCols: list[str] = ['ra', 'dec', 'x_pix', 'y_pix', 'g_1', 'g_2']
extractShearStats()[source]

Extract shear stats

Theis will produce two hpmcm.output_tables.ShearTable, one for the objects, and the other for the clusters.

Return type:

list[DataFrame]

getCellIndices(df)[source]

Get the cell index assocatiated to each source

Return type:

ndarray

Parameters:

df (DataFrame)

inputTableClass

alias of ShearCoaddSourceTable

reduceDataFrame(df)[source]

Reduce a single input DataFrame

Return type:

DataFrame

Parameters:

df (DataFrame)

Notes

This applies a trivial cut on signal-to-noise (snr>1).

This will add these columns to the output dataframes

Column

Description

id

Index of object inside catalog

ra

Source RA

dec

Source DEC

cell_idx_x

X-index of Cell

cell_idx_y

Y-index of Cell

x_cell_coadd

X-coordinate in cell frame

y_cell_coadd

Y-coordinate in cell frame

x_pix

X-coordinate in global WCS frame

y_pix

Y-coordinate in global WCS frame

g_1

Shear g_1 component estimate

g_2

Shear g_2 component estimate

snr

Signal-to-noise ratio