ztforce.ztf_images

ZTF IRSA metadata queries, URL construction, FITS/PSF download with retry.

Attributes

_IRSA_BASE

_DOWNLOAD_TIMEOUT_SEC

_BAND_TO_FILTERCODE

_REQUIRED_METADATA_COLS

Functions

query_sci_metadata(→ pandas.DataFrame)

Query ZTF IRSA for all science exposures covering (ra, dec) in band.

build_sci_url(→ str)

Construct the IRSA IBE URL for a science image product.

_validate_fits(→ bool)

Return True if the FITS file opens without error.

_download_with_retry(→ pathlib.Path)

Download url to dest, retrying on failure with exponential backoff.

download_fits(→ pathlib.Path)

Download a FITS cutout to dest.

download_psf_sidecar(→ pathlib.Path)

Download a DAOPhot PSF sidecar (.psf) file to dest.

Module Contents

_IRSA_BASE = 'https://irsa.ipac.caltech.edu/ibe/data/ztf/products'[source]
_DOWNLOAD_TIMEOUT_SEC = 120[source]
_BAND_TO_FILTERCODE[source]
_REQUIRED_METADATA_COLS[source]
query_sci_metadata(ra: float, dec: float, band: str, config: ztforce.config.ZTForceConfig, search_radius_deg: float = 0.01) pandas.DataFrame[source]

Query ZTF IRSA for all science exposures covering (ra, dec) in band.

Returns a DataFrame sorted by obsjd ascending. Raises NoImagesFoundError when no images are found.

build_sci_url(row: pandas.Series, ra: float, dec: float, suffix: str = 'sciimg.fits', cutout_size_arcmin: float = DEFAULT_CUTOUT_SIZE_ARCMIN) str[source]

Construct the IRSA IBE URL for a science image product.

For FITS files a cutout query is appended so that only a cutout_size_arcmin × cutout_size_arcmin region centred on (ra, dec) is downloaded. PSF sidecar files are returned in full (they are small text files that describe the whole quadrant).

_validate_fits(path: pathlib.Path) bool[source]

Return True if the FITS file opens without error.

_download_with_retry(url: str, dest: pathlib.Path, config: ztforce.config.ZTForceConfig, validate: bool = True) pathlib.Path[source]

Download url to dest, retrying on failure with exponential backoff.

download_fits(url: str, dest: pathlib.Path, config: ztforce.config.ZTForceConfig) pathlib.Path[source]

Download a FITS cutout to dest.

download_psf_sidecar(url: str, dest: pathlib.Path, config: ztforce.config.ZTForceConfig) pathlib.Path[source]

Download a DAOPhot PSF sidecar (.psf) file to dest.