dmitryduev / tails

Tails: chasing comets with ZTF and deep learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extract photometric measurements for Tails detections from *sexcat.fits

dmitryduev opened this issue · comments

The ZTF Sentinel service should extract photometric measurements for Tails detections from the corresponding *sexcat.fits files and post them to Fritz. This would "activate" the MPC search button under the Surveys tab, potentially saving a lot of time.

For bookkeeping:

from astropy.io import fits
import numpy as np

fits_file = "*sexcat.fits"

with fits.open(fits_file) as hdu:
    data = hdu[1].data

xy = list(zip(data["XWIN_IMAGE"], data["YWIN_IMAGE"]))

det = (2788.15, 1345.99)

distances = []
for x, y in xy:
    distances.append(np.sqrt((det[0] - x)**2 + (det[1] - y)**2))

distances = np.array(distances)
closest = np.argmin(distances)

MAG_ZP = 27.4922460092007

mag = data["MAG_BEST"][closest] + MAG_ZP