yaw.catalog.patch.Metadata#

class yaw.catalog.patch.Metadata(*, num_records: int, sum_weights: float, center: AngularCoordinates, radius: AngularDistances)[source]#

Bases: YamlSerialisable

Container for patch meta data.

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

Parameters:
  • num_records – Number of data points in the patch.

  • sum_weights – Sum of point weights or same as num_records.

  • center – Center point (mean) of all data points, AngularCoordinates in radian.

  • radius – Radius around center point containing all data points, AngularDistances in radian.

Methods

__init__(*, num_records, sum_weights, ...)

compute(coords, *[, weights, center])

Compute the meta data from the patch data.

from_dict(kwarg_dict)

Restore the class instance from a python dictionary.

from_file(path)

Restore the class instance from a YAML file.

to_dict()

Serialise the class instances into a dictionary.

to_file(path)

Serialise the class instances into a YAML file.

Attributes

num_records

Number of data points in the patch.

sum_weights

Sum of point weights.

center

Center point (mean) of all data points.

radius

Radius around center point containing all data points.

center: AngularCoordinates#

Center point (mean) of all data points.

classmethod compute(coords: AngularCoordinates, *, weights: NDArray | None = None, center: AngularCoordinates | None = None) Self[source]#

Compute the meta data from the patch data.

If no weights are provided, the sum of weights will equal the number of data points. Weights are also used when computing the center point.

Parameters:

coords – Coordinates of patch data points, given as AngularCoordinates.

Keyword Arguments:
  • weights – Optional, weights of data points.

  • center – Optional, use this specific center point, e.g. when using an externally computed patch center.

Returns:

Final instance of meta data.

classmethod from_dict(kwarg_dict: dict) Self[source]#

Restore the class instance from a python dictionary.

Parameters:

the_dict – Dictionary containing all required data attributes to restore the instance, see also to_dict().

Returns:

Restored class instance.

classmethod from_file(path: Path | str) Self#

Restore the class instance from a YAML file.

Parameters:

path – Path (str or pathlib.Path) to YAML file to restore from, see also to_file().

Returns:

Restored class instance.

num_records: int#

Number of data points in the patch.

radius: AngularDistances#

Radius around center point containing all data points.

sum_weights: float#

Sum of point weights.

to_dict() dict[str, Any][source]#

Serialise the class instances into a dictionary.

Returns:

A dictionary containnig the minimal set of data attributes to restore the instance with from_dict().

to_file(path: Path | str) None#

Serialise the class instances into a YAML file.

Parameters:

path – Path (str or pathlib.Path) to YAML file to serialise into, see also from_file().