hpmcm.shear_utils module

hpmcm.shear_utils.makeMatchedShearSourceCatalogs(source_base_name, match_base_name)[source]

Use the associations to join the source tables to their match obects

Return type:

dict[str, DataFrame]

Parameters:
  • source_base_name (str) – _base file name for souces catalogs

  • match_base_name (str) – _base file naem for match tables

Returns:

  • Dict of tables, keyed by shear type, which have the

  • souces catalogs joined to the associated objects

hpmcm.shear_utils.mergeShearReports(inputs, output_file)[source]

Merge reports on the shear calibration

Return type:

None

Parameters:
  • inputs (list[str]) – List of input ShearData pickle files

  • output_file (str) – Where to write the merged file

hpmcm.shear_utils.reduceShearDataForCell(cell, i_cat, dataframe)[source]

Filters dataframe to keep only sources in the cell

Return type:

DataFrame

Parameters:
  • cell (CellData) – The cell being analyzed

  • i_cat (int) – Catalog index

  • dataframe (DataFrame) – Input dataframe

Return type:

Filtered datasets

Notes

This will optionally deshear the source positions if matcher.deshear is not None.

This will add these columns to the output dataframes

Column

Description

x_cell

X-coordinate in cell frame

y_cell

Y-coordinate in cell frame

x_pix

X-coordinate in global WCS frame

y_pix

Y-coordinate in global WCS frame

dx_shear

Change in X position when desheared

dy_shear

Change in X position when desheared

hpmcm.shear_utils.shearReport(basefile, output_file_base, shear, cat_type, tract, snr_cut=7.5)[source]

Report on the shear calibration

Return type:

None

Parameters:
  • basefile (str) – Input base file name (see notes)

  • output_file_base (str | None) – Output file name (see notes)

  • shear (float) – Applied shear

  • cat_type (str) – Catalog type (one of [“pgauss”, “gauss”, “wmom”]

  • tract (int) – Tract, written to outout data

  • snr_cut (float) – Signal-to-noise cut.

Notes

This will read the object shear data from “{basefile}_cluster_shear.pq” This will read the object statisticis from “{basefile}_cluster_stats.pq”

This will write the shear stats to “{output_file_base}.pkl” This will write the figures to “{output_file_base}_{figure}.png”

hpmcm.shear_utils.shearStats(df)[source]

Return the shear statistics

{st} is the shear type, one of “gauss”, “pgauss”, “wmom”

{i}, {j} index the shear parameters 1, 2

Return type:

dict

Parameters:

df (DataFrame) – Input DataFrame, must have hpmcm.ShearTable schema

Return type:

Shear stats in a dict.

Notes

Shear stats include:

Key

Description

n_{st}

Number of sources from that catalog

g_{i}_{st}

g_{i} shear parameter for that catalog

delta_g_{i}_{j}

g_{i,j} shear measurment: g_{i}_{j}p - g_{i}_{j}m

good

True if every catalog has one source in this object

If the matching is not good, then delta_g_1 = delta_g_2 = np.nan

hpmcm.shear_utils.splitByTypeAndClean(basefile, tract, shear, cat_type, *, clean=False)[source]

Split a parquet file by shear catalog type and tract

Return type:

None

Parameters:
  • basefile (str) – Original file name

  • tract (int) – Tract to select

  • shear (float) – Applied shear, saved to output

  • cat_type (str) – Catalog type to select

  • clean (bool) – Remove duplicates

Notes

This will create 5 files with the pattern: “{basefile}_uncleaned_{tract}_{type}.pq”

Column

Description

id

Index of object inside catalog

orig_id

Original object id

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