yaw.catalogs.PatchLinkage#
- class yaw.catalogs.PatchLinkage(patch_tuples: list[PatchIDs])[source]#
Bases:
objectClass that links patches for pair counting, serves as task generator.
This class is useful to generate pairs of patches that need to be paired for pair count measurements for a given maximum angular search radius. Patches that are separated by more than the sum of their radii and the maximum search radius do not contribute any pair counts and can be discarded.
Populate a patch linkage container.
To create a new linkage, use the
from_setup()method.- Parameters:
patch_tuples (list[
PatchIDs]) – List of patch pairs that need to be visited to count pairs.
Methods
__init__(patch_tuples)Populate a patch linkage container.
from_setup(config, catalog)Generate a new patch linkage.
get_matrix(collection1[, collection2, ...])Convert the list of linked patches to a boolean matrix indicating if two patches are linked.
get_pairs(auto[, crosspatch])Get a list of linked patch pairs.
get_patches(collection1[, collection2, ...])Return linked pairs of patch data ready for processing.
Attributes
Get ratio of the number of linked patch pairs compared to all possible combinations.
Get the total number of patches.
- property density: float#
Get ratio of the number of linked patch pairs compared to all possible combinations.
- classmethod from_setup(config: Configuration, catalog: BaseCatalog) PatchLinkage[source]#
Generate a new patch linkage.
Compute a maximum angular separation for at low redshift for the scales provided in the configuration. Generate a list of all patch pairs that are separated by less than this maximum separation (factoring in the size of the patches).
- Parameters:
config (~yaw.Configuration) – Configuration object that defines the scales and cosmology needed to compute the maximum angular scale.
catalog (
BaseCatalog) – Catalog instance with patch centers and sizes.
- Returns:
- get_matrix(collection1: BaseCatalog, collection2: BaseCatalog | None = None, crosspatch: bool = True) NDArray[np.bool_][source]#
Convert the list of linked patches to a boolean matrix indicating if two patches are linked.
Depending on if one or two catalogs are provided as input, the result resembles a cross- or autocorrelation patch linkage. This is the only purpose of the inputs.
- Parameters:
collection1 (
BaseCatalog) – First catalog for patch linkage.collection2 (
BaseCatalog, optional) – Second catalog for patch linkage. If not provided, returns a matrix for an autocorrelation case.crosspatch (
bool) – Link patches just with themselves and ignore cross-patch pairs.
- Returns:
NDArray
Warning
The patch centers of both catalogues must be (very close to) identical.
- get_pairs(auto: bool, crosspatch: bool = True) list[PatchIDs][source]#
Get a list of linked patch pairs.
- Parameters:
auto (
bool) – For autocorrelation measurements, only visit patch pairs where patch ID1 >= ID2.crosspatch (
bool) – If false, ignore all cross-patch pair counts and link patches just with themselves.
- Returns:
list[PatchIDs]
- get_patches(collection1: BaseCatalog, collection2: BaseCatalog | None = None, crosspatch: bool = True) tuple[list, list][source]#
Return linked pairs of patch data ready for processing.
Instead of returning a list of patch index pairs, the actual patch data is returned in two aligned list, where item 1 form the first list is linked to item 1 of the second list. Depending on if one or two catalogs are provided as input, the result resembles a cross- or autocorrelation patch linkage.
- Parameters:
collection1 (
BaseCatalog) – First catalog for patch linkage.collection2 (
BaseCatalog, optional) – Second catalog for patch linkage. If not provided, returns a matrix for an autocorrelation case.crosspatch (
bool) – Link patches just with themselves and ignore cross-patch pairs.
- Returns:
Two lists with patch data from
collection1andcollection2(if provided, elsecollection1) that are linked.- Return type:
list, list
Warning
The patch centers of both catalogues must be (very close to) identical.
- property n_patches: int#
Get the total number of patches.