SurveyFootprint#

class uvex_transients.surveys.footprints.base.SurveyFootprint(name: str, generator: ~collections.abc.Callable[[...], ~mocpy.moc.moc.MOC], version: str = 'v1', description: str | None = None, params: dict = <factory>, persist: bool = False, MOC_max_order: int = 10)[source]#

A named survey sky footprint, built lazily and optionally cached to disk.

The ~mocpy.MOC is only generated when first needed (see moc). If persist is set, it is then saved under a key covering everything that can change it (see cache_key) and reloaded from there on later runs. Constructing a footprint registers it in default_registry.

Methods

clear_from_cache()

Delete the cached MOC file, if any, and drop the in-memory copy.

contains(ra, dec)

Test which sky positions fall inside the footprint.

contains_skycoord(coord)

Test which positions of a ~astropy.coordinates.SkyCoord fall inside the footprint.

generate_MOC()

Run generator, degrade to MOC_max_order if needed, and cache if persist.

register([registry, overwrite])

Add this footprint to a registry.

Attributes

MOC_max_order

Maximum HEALPix order of the MOC (order 10 is ~3.4 arcmin cells).

cache_key

Hash of the name, version, generator, params, and max order.

cache_path

Location of this footprint's cached MOC file.

description

Short description of what the footprint covers.

is_cached

Whether a cached MOC matching the current cache_key exists.

moc

The footprint, from memory, else the disk cache, else generator.

persist

Whether to cache the generated MOC at cache_path and reload it from there.

version

Part of cache_key; bump it when the output changes without the inputs changing (e.g. an upstream data fix).

name

Colon-separated name, ordered observatory, survey, region (e.g. uvex:lmlz:wide).

generator

Builds the ~mocpy.MOC, called as generator(max_order=..., **params).

params

Keyword arguments passed to generator.