hyrax.data_sets.lsst_dataset#

Attributes#

Classes#

LSSTDataset

LSSTDataset: A dataset to access deep_coadd images from lsst pipelines

Module Contents#

logger[source]#
class LSSTDataset(config, data_location=None)[source]#

Bases: hyrax.data_sets.data_set_registry.HyraxDataset, hyrax.data_sets.data_set_registry.HyraxImageDataset, torch.utils.data.Dataset

LSSTDataset: A dataset to access deep_coadd images from lsst pipelines via the butler. Must be run in an RSP.

__init__()[source]#

Initialize the dataset with either a HATS catalog or astropy table.

Config can specify either: - config[“data_set”][“hats_catalog”]: path to HATS catalog - config[“data_set”][“astropy_table”]: path to any file readable by Astropy Table

BANDS = ['u', 'g', 'r', 'i', 'z', 'y'][source]#
object_id_autodetect_names = ['object_id', 'objectId'][source]#
catalog[source]#
sh_deg[source]#
sw_deg[source]#
oid_column_name[source]#
_butler_available()[source]#
_get_butler_thread_safe()[source]#

Thread safe butler creation

This function ensures that there is one and only one butler created per thread and that threads always use their assigned butler.

This is necessary because child classes of this one use butlers, and butler objects are not safe for multithreaded access.

Returns:

The butler assigned to the current thread.

Return type:

butler

_detect_object_id_column_name()[source]#

Setup file naming strategy based on catalog columns.

_load_catalog(data_set_config)[source]#

Load the catalog from either a HATS catalog or an astropy table.

_load_hats_catalog(hats_path)[source]#

Load catalog from HATS format using LSDB.

_load_astropy_catalog(table_path)[source]#

Load catalog from astropy table format or pickled astropy table.

__len__()[source]#
get_image(idxs)[source]#

Get image cutouts for the given indices.

Parameters:

idxs (int or list of int) – The index or indices of the cutouts to retrieve.

Returns:

Single cutout tensor or list of cutout tensors.

Return type:

list or torch.Tensor

__getitem__(idxs)[source]#

Get default data fields for the this dataset.

Parameters:

idxs (int or list of int) – The index or indices of the cutouts to retrieve.

Returns:

A dictionary containing the default data fields.

Return type:

dict

_parse_box(patch, row)[source]#

Return a Box2I representing the desired cutout in pixel space, given a “row” of catalog data which includes the semi-height (sh) and semi-width (sw) in degrees desired for the cutout.

_parse_sphere_point(row)[source]#

Return a SpherePoint with the ra and deck given in the “row” of catalog data. Row must include the RA and dec as “ra” and “dec” columns respectively

_get_tract_patch(row)[source]#

Return (tractInfo, patchInfo) for a given row.

This function only returns the single principle tract and patch in the case of overlap.

_request_patch(tract_index, patch_index)[source]#

Request a patch from the butler. This will be a list of lsst.afw.image objects each corresponding to the configured bands

Uses functools.lru_cache for basic in-memory caching.

_fetch_single_cutout(row)[source]#

Make a single cutout, returning a torch tensor.

Does not handle edge-of-tract/patch type edge cases, will only work near center of a patch.