ztforce.psf

DAOPhot PSF sidecar parsing and forced PSF photometry at a fixed position.

Attributes

_SKY_ANNULUS_INNER_FWHM

_SKY_ANNULUS_OUTER_FWHM

Functions

parse_daophot_psf(→ dict)

Parse a ZTF DAOPhot PSF sidecar file (sciimgdao.psf).

reconstruct_psf(→ numpy.ndarray)

Reconstruct the normalized PSF stamp at image position (x_target, y_target).

_poly_weights(→ list[float])

Return polynomial basis weights for n lookup tables.

forced_phot_at_position(→ dict)

Measure forced PSF photometry at a fixed sky position.

Module Contents

_SKY_ANNULUS_INNER_FWHM = 2.0[source]
_SKY_ANNULUS_OUTER_FWHM = 4.0[source]
parse_daophot_psf(psf_fpath: str | pathlib.Path) dict[source]

Parse a ZTF DAOPhot PSF sidecar file (sciimgdao.psf).

The file format follows the DAOPHOT convention (Stetson 1987, PASP, 99, 191): a Gaussian analytic base plus spatially-varying lookup-table residuals.

Returns a dict with keys psf_type, psf_size, n_tables, norm_factor, x_cen, y_cen, sigmas, tables. Pass the result to reconstruct_psf() to get a normalised PSF stamp.

reconstruct_psf(parsed: dict, x_target: float, y_target: float) numpy.ndarray[source]

Reconstruct the normalized PSF stamp at image position (x_target, y_target).

Returns a 2D array of shape (psf_size, psf_size) normalized to sum=1.

_poly_weights(dx: float, dy: float, n: int) list[float][source]

Return polynomial basis weights for n lookup tables.

Follows the DAOPHOT spatial-variation convention (Stetson 1987, PASP, 99, 191):

n=1: [1] n=3: [1, dx, dy] n=6: [1, dx, dy, dx^2, dx*dy, dy^2]

forced_phot_at_position(image: ztforce.image.ZTFImage, parsed_psf: dict, target_coord: astropy.coordinates.SkyCoord) dict[source]

Measure forced PSF photometry at a fixed sky position.

Only the amplitude is free; position is locked. Uses the optimal matched-filter estimator (Naylor 1998, MNRAS, 296, 339): flux = Σ(data·psf/σ²) / Σ(psf²/σ²).

Returns a dict with keys flux, flux_err, mag, mag_err, flags, x_fit, y_fit. flags=1 means the position was too close to the image edge or a NaN region.