Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/hpmcm/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ def reduceDataframe(
"""Filters dataframe to keep only source in the cell"""
assert i_cat is not None

# WCS is defined, use it
x_cell = dataframe["x_pix"] - self.min_pix[0]
y_cell = dataframe["y_pix"] - self.min_pix[1]
x_cell = dataframe["x_pix"].values - self.min_pix[0]
y_cell = dataframe["y_pix"].values - self.min_pix[1]
filtered = (
(x_cell >= 0)
& (x_cell < self.n_pix[0])
Expand All @@ -146,7 +145,7 @@ def reduceDataframe(

def countsMap(self, weight_name: str | None = None) -> np.ndarray:
"""Fill a map that counts the number of source per cell"""
to_fill = self._emtpyCountsMaps()
to_fill = self._emptyCountsMaps()
assert self.data is not None
for df in self.data:
to_fill += self._singleCatalogCountsMap(df, weight_name)
Expand Down Expand Up @@ -231,7 +230,7 @@ def _newObject(
) -> ObjectData:
return ObjectData(cluster, object_id, mask)

def _emtpyCountsMaps(self) -> np.ndarray:
def _emptyCountsMaps(self) -> np.ndarray:
to_fill = np.zeros(np.ceil(self.n_pix).astype(int))
return to_fill

Expand Down Expand Up @@ -270,7 +269,7 @@ def getRaDec(


class ShearCellData(CellData):
"""Subclass of CellData that can compute shear statisitics
"""Subclass of CellData that can compute shear statistics

Attributes
----------
Expand Down Expand Up @@ -302,7 +301,7 @@ def _newObject(
) -> ObjectData:
return ShearObjectData(cluster, object_id, mask)

def _emtpyCountsMaps(self) -> np.ndarray:
def _emptyCountsMaps(self) -> np.ndarray:
pixel_match_scale = self.pixel_match_scale
to_fill = np.zeros(np.ceil(self.n_pix / pixel_match_scale).astype(int))
return to_fill
Expand Down
2 changes: 1 addition & 1 deletion src/hpmcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def addObject(


class ShearClusterData(ClusterData):
"""Subclass of ClusterData that can compute shear statisitics
"""Subclass of ClusterData that can compute shear statistics

Attributes
----------
Expand Down
4 changes: 2 additions & 2 deletions src/hpmcm/input_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class CoaddSourceTable(TableInterface):
id=TableColumnInfo(int, "Unique ID for source"),
tract=TableColumnInfo(int, "Tract"),
x_cell_coadd=TableColumnInfo(
float, "X-postion in cell-based coadd used for metadetect"
float, "X-position in cell-based coadd used for metadetect"
),
y_cell_coadd=TableColumnInfo(
float, "Y-postion in cell-based coadd used for metadetect"
float, "Y-position in cell-based coadd used for metadetect"
),
snr=TableColumnInfo(float, "Signal-to-noise of source"),
cell_idx_x=TableColumnInfo(int, "Cell x-index within Tract"),
Expand Down
2 changes: 1 addition & 1 deletion src/hpmcm/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def extract(self) -> None:


class ShearObjectData(ObjectData):
"""Subclass of ObjectData that can compute shear statisitics"""
"""Subclass of ObjectData that can compute shear statistics"""

def shearStats(self) -> dict:
"""Return the shear statistics"""
Expand Down
6 changes: 1 addition & 5 deletions src/hpmcm/output_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ def buildFromCellData(cell_data: CellData) -> ObjectStatsTable:
n_srcs[idx] = obj.n_src
n_uniques[idx] = obj.n_unique
dist_rms[idx] = obj.rms_dist
x_cents[idx] = obj.x_cent
y_cents[idx] = obj.y_cent
assert obj.data is not None
sum_snr = obj.data.snr.sum()
x_cents[idx] = np.sum(obj.data.snr * obj.data.x_cell) / sum_snr
Expand Down Expand Up @@ -266,7 +264,6 @@ def buildFromCellData(cell_data: CellData) -> ClusterStatsTable:
n_srcs = np.zeros((n_clust), dtype=int)
n_uniques = np.zeros((n_clust), dtype=int)
n_objects = np.zeros((n_clust), dtype=int)
n_uniques = np.zeros((n_clust), dtype=int)
dist_rms = np.zeros((n_clust), dtype=float)
x_cents = np.zeros((n_clust), dtype=float)
y_cents = np.zeros((n_clust), dtype=float)
Expand All @@ -279,7 +276,6 @@ def buildFromCellData(cell_data: CellData) -> ClusterStatsTable:
n_srcs[idx] = cluster.n_src
n_uniques[idx] = cluster.n_unique
n_objects[idx] = len(cluster.objects)
n_uniques[idx] = cluster.n_unique
dist_rms[idx] = cluster.rms_dist
assert cluster.data is not None
sum_snr = cluster.data.snr.sum()
Expand Down Expand Up @@ -316,7 +312,7 @@ class ShearTable(TableInterface):
_schema["good"] = TableColumnInfo(bool, "Has unique match")
for _name in SHEAR_NAMES:
_schema[f"n_{_name}"] = TableColumnInfo(
float, f"number of sourcrs from catalog {_name}"
float, f"number of sources from catalog {_name}"
)
for _i in [1, 2]:
_schema[f"g_{_i}_{_name}"] = TableColumnInfo(
Expand Down
4 changes: 2 additions & 2 deletions src/hpmcm/shear_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def plotMetaDetectBad(


class ShearStats:
"""Simple class to store shear statisitics
"""Simple class to store shear statistics

{type} is the matching type, one of "good", "bad", "all"

Expand Down Expand Up @@ -483,7 +483,7 @@ def __init__(
class ShearData:
"""Collection of shear related data for a single catalog

Attritubes
Attributes
----------
shear: float
Applied shear
Expand Down
6 changes: 3 additions & 3 deletions src/hpmcm/shear_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class ShearMatch(Match):
+--------------+---------------------------------------------------------------+
| tract | Tract being matched |
+--------------+---------------------------------------------------------------+
| x_cell_coadd | X-postion in cell-based coadd used for metadetect |
| x_cell_coadd | X-position in cell-based coadd used for metadetect |
+--------------+---------------------------------------------------------------+
| y_cell_coadd | Y-postion in cell-based coadd used for metadetect |
| y_cell_coadd | Y-position in cell-based coadd used for metadetect |
+--------------+---------------------------------------------------------------+
| snr | Signal-to-Noise of source, used for filtering and centroiding |
+--------------+---------------------------------------------------------------+
Expand All @@ -67,7 +67,7 @@ class ShearMatch(Match):
+--------------+---------------------------------------------------------------+
| g_1 | Shear g1 component |
+--------------+---------------------------------------------------------------+
| g_2 | Shear g1 component |
| g_2 | Shear g2 component |
+--------------+---------------------------------------------------------------+

(see :py:class:`hpmcm.input_tables.ShearCoaddSourceTable`)
Expand Down
Loading
Loading