yaw.catalog.patch.Patch#

class yaw.catalog.patch.Patch(cache_path: Path | str, center: AngularCoordinates | None = None)[source]#

Bases: HandlesDataChunk

A single spatial patch of catalog data.

Data has point coordinates and optionally weights and redshifts. This data is cached on disk in a binary file (data.bin) that is read when accessing any of the classes data attributes. Additionaly meta data, such as the patch center and radius, that describe the spatial distribution of the contained data points, are availble and stored as YAML file (meta.yml)

The cached data is organised in a single directory as follows:

[cache_path]/
  ├╴ data.bin
  ├╴ meta.yml
  ├╴ binning   (created by trees.BinnedTrees)
  └╴ trees.pkl (created by trees.BinnedTrees)

Supports efficient pickeling as long as the cached data is not deleted or moved.

Methods

__init__(cache_path[, center])

copy_chunk_info(*[, drop_patch_ids])

Copy the data attribute information.

load_data()

Load the cached object data with coordinates and optional weights and redshifts.

Attributes

meta

Patch meta data; number of records stored in the patch, the sum of weights, and distribution of objects on sky through the center point and containing radius.

cache_path

Directory where (meta) data is cached.

coords

Coordinates in right ascension and declination, in radian.

data_path

Path to binary file with patch data.

has_kappa

Whether this data source provides kappa (or any scalar values).

has_patch_ids

Patches never provide patch IDs.

has_redshifts

Whether this data source provides redshifts.

has_weights

Whether this data source provides weights.

kappa

Kappa or None if there are no kappa.

redshifts

Redshifts or None if there are no redshifts.

weights

Weights or None if there are no weights.

cache_path: Path#

Directory where (meta) data is cached.

property coords: AngularCoordinates#

Coordinates in right ascension and declination, in radian.

copy_chunk_info(*, drop_patch_ids: bool = False) DataChunkInfo#

Copy the data attribute information.

property data_path: Path#

Path to binary file with patch data.

property has_kappa: bool#

Whether this data source provides kappa (or any scalar values).

property has_patch_ids: Literal[False]#

Patches never provide patch IDs.

property has_redshifts: bool#

Whether this data source provides redshifts.

property has_weights: bool#

Whether this data source provides weights.

property kappa: NDArray | None#

Kappa or None if there are no kappa.

load_data() TypeDataChunk[source]#

Load the cached object data with coordinates and optional weights and redshifts.

Returns:

A numpy array with composite data type. The fields represent the different data columns and can be ra, dec, weights, and redshifts, where the latter two are optional.

meta: Metadata#

Patch meta data; number of records stored in the patch, the sum of weights, and distribution of objects on sky through the center point and containing radius.

property redshifts: NDArray | None#

Redshifts or None if there are no redshifts.

property weights: NDArray | None#

Weights or None if there are no weights.