rail.yaw_rail.cache module
This file implements a wrapper for a cache directory for yet_another_wizz catalogs. The cache is designed to hold a pair of a data and an (optional) random catalog. The patch center coordinates are enforced to be consistent within a cache. These caches are created by YawCacheCreate, but must currently be removed manually by the user when they are no longer needed.
- class rail.yaw_rail.cache.YawCache
Bases:
objectA cache directory for yet_another_wizz to store a data and (optional) random catalogue.
The data sets are split into consistent spatial patches used for spatial resampling and covariance estiation by yet_another_wizz and wrapped by YawCatalog instances. Once any data set is specifed, the other data set will inherit its patch centers.
Create a new instance with the create method or open an existing cache. If an existing cache is used, the code checks if the provided directory is a valid cache. To interact with the data set and the randoms, directly access the methods of the data and rand attributes.
- Parameters:
path (str) – Path at which the data and random catalogues are cached, must exist and has to be created with the create method.
- __init__(path)
- Parameters:
path (str)
- Return type:
None
- classmethod create(path, overwrite=False)
Create an empty cache directory at the specifed path.
- Parameters:
path (str) – Path at which the data and random catalogues are cached.
overwrite (bool, optional) – Whether to overwrite an existing cache directory.
- Returns:
The newly created cache instance.
- Return type:
- data: YawCatalog
Catalog instance for the data set.
- drop()
Delete the entire cache directy.
- Return type:
None
- get_patch_centers()
Get the patch center coordinates.
- Returns:
The patch center coordinates in radian as yaw.core.coordinates.CoordSky instance.
- Return type:
CoordSky
- Raises:
FileNotFoundError – If not data is cached yet.
- classmethod is_valid(path)
Whether the provided path is a valid cache.
- Parameters:
path (str)
- Return type:
bool
- property num_patches: int
Get the number of spatial patches.
- Returns:
The number of patches.
- Return type:
int
- Raises:
FileNotFoundError – If not data is cached yet.
- path: str
Path at which the data and random catalogues are cached.
- rand: YawCatalog
Catalog instance for the randoms.