hpmcm.cell module

class hpmcm.cell.CellData(matcher, id_offset, corner, size, idx, buf=10)[source]

Bases: object

Class to store analyze data for a cell

Includes cell boundries, reduced data tables and clustering results

Does not store sky maps

Cells are square sub-regions of the analysis region that are extracted from the ranges of pixels in the WCS

The cell covers corner:corner+size

The sources are projected into an array that extends buf pixels beyond the cell

This uses the FootprintSet to identify pixels which contain source, and builds those into clusters

Parameters:
  • matcher (Match)

  • id_offset (int)

  • corner (np.ndarray)

  • size (np.ndarray)

  • idx (int)

  • buf (int)

matcher

Parent Match object

Type:

Match

id_offset

Offset used for the Object and Cluster IDs for this cell

Type:

int

corner

pixX, pixY for corner of cell

Type:

np.ndarray

size

size of the cell (in pixels)

Type:

np.ndarray

idx

Id of the cell

Type:

int

buf

Number of buffer pixels around the edge of the cell

Type:

int

min_pix

Lowest number pixel in center of cell

Type:

np.ndarray

max_pix

Highest number pixel in center of cell

Type:

np.ndarray

n_pix

Number of pixels in center of cell

Type:

np.ndarray

data

Reduced dataframes with only sources for this cell

Type:

list[pandas.DataFrame]

n_src

Number of sources in this cell

Type:

int

footprint_ids

Matched arrays with the index of the cluster associated to each source. I.e., these could added to the Dataframes as additional columns

Type:

list[np.ndarray]

cluster_dict

Dictionary with cluster membership data

Type:

OrderedDict[int, ClusterData]

object_dict

Dictionary with object membership data

Type:

OrderedDict[int, ObjectData]

addObject(cluster, mask=None)[source]

Add an object to this cell

Return type:

ObjectData

Parameters:
  • cluster (ClusterData) – Parent cluster for the object

  • mask (ndarray | None) – Mask of which sources in the cluster to include in the object

Return type:

Newly created ObjectData

analyze(weight_name=None, pixel_r2_cut=2.0)[source]

Analyze this cell

Note that this returns the counts maps and clustering info, which can be helpful for debugging.

Return type:

dict | None

Parameters:
  • weight_name (str | None)

  • pixel_r2_cut (float)

buildClusterData(fp_set, pixel_r2_cut=4.0)[source]

Loop through cluster ids and collect sources into the ClusterData objects

Return type:

None

Parameters:
countsMap(weight_name=None)[source]

Fill a map that counts the number of source per cell

Return type:

ndarray

Parameters:

weight_name (str | None)

getRaDec(x_cents, y_cents)[source]

Return the RA, DEC of based from pixel coords

Return type:

tuple[ndarray, ndarray]

Parameters:
  • x_cents (ndarray)

  • y_cents (ndarray)

property n_clusters: int

Return the number of clusters in this cell

property n_objects: int

Return the number of objects in this cell

reduceData(data)[source]

Pull out only the data needed for this cell

Return type:

None

Parameters:

data (list[DataFrame])

reduceDataframe(i_cat, dataframe)[source]

Filters dataframe to keep only source in the cell

Return type:

DataFrame

Parameters:
  • i_cat (int)

  • dataframe (DataFrame)

class hpmcm.cell.ShearCellData(matcher, id_offset, corner, size, idx, buf=10)[source]

Bases: CellData

Subclass of CellData that can compute shear statisitics

Parameters:
  • matcher (ShearMatch)

  • id_offset (int)

  • corner (np.ndarray)

  • size (np.ndarray)

  • idx (int)

  • buf (int)

pixel_match_scale

Number of pixel merged in the original counts map

Type:

int

getRaDec(x_cents, y_cents)[source]

Return the RA, DEC of based from pixel coords

Return type:

tuple[ndarray, ndarray]

Parameters:
  • x_cents (ndarray)

  • y_cents (ndarray)

reduceDataframe(i_cat, dataframe)[source]

Filters dataframe to keep only source in the cell

Return type:

DataFrame

Parameters:
  • i_cat (int)

  • dataframe (DataFrame)