Skip to content

Photometry and completeness ​

Calibrated magnitudes, and synthetic asteroids for measuring completeness (Measure completeness).

AsteroidPipeline.aperture_flux Method
julia
aperture_flux(image, x, y; aperture_radius=5.0, annulus=(10.0, 15.0), mask=nothing) -> Float64

Background-subtracted flux inside a circle of aperture_radius pixels at (x, y) (the same x = column, y = row sense as detect_sources's xcen/ycen), with the background taken as the median of the annulus between annulus[1] and annulus[2] pixels — local, so a frame's large-scale background gradients don't leak in. Pixels flagged in mask are left out of both. NaN if the aperture leaves the image or its annulus has no valid pixel.

source
AsteroidPipeline.below_limit Method
julia
below_limit(candidates, limiting_mag) -> Set{Int}

The tracklet ids in candidates whose median magnitude is fainter than limiting_mag, what analyze_set returns: nothing a single exposure can show, so most likely noise lined up by chance. They are worth looking at last, not to be discarded: a stack of frames can hold what one doesn't.

source
AsteroidPipeline.candidate_magnitudes Method
julia
candidate_magnitudes(fits_paths, candidates; timestamp_key=nothing,
                     reference_stars=nothing, aperture_radius=5.0, wcs=nothing) -> Vector{Float64}

Calibrated (Gaia G-equivalent) magnitude of every row of candidates — an astrometric_calibrate table from a run_pipeline call on the same fits_paths — measured on each row's own raw frame, not on a difference image: each frame's WCS is refined (refine_wcs) and its zero point fitted (photometric_zeropoint) against Gaia DR3 stars (reference_stars, or fetched once for the first frame's field — a live network request), then each row's sky position is photometered at its pixel in that frame. Working from ra/dec rather than the table's x/y keeps this independent of which pixel grid the pipeline linked on. wcs, one solution per frame, is used instead of refining each frame on its own, which fails where a header is further off than refine_wcs searches: analyze_set passes the frames' joint fit.

NaN where a row's aperture falls off the frame or measures no positive flux. Each frame gets its own zero point, so a frame taken through thin cloud doesn't make an object look fainter. examples/iasc_demo.jl compares the result with Astrometrica's.

Each row's uncertainties come with the magnitudes from the internal _measure_candidates, which analyze_set uses: see its mag_err and pos_err.

source
AsteroidPipeline.photometric_zeropoint Method
julia
photometric_zeropoint(image, wcs, stars; mask=nothing, aperture_radius=5.0,
                      mag_range=(15.0, 20.0), match_radius=1.5) -> (zeropoint, n_stars, scatter)

The magnitude zero point of a frame against reference stars measured in it: each catalog star in mag_range (stars with ra, dec, gmag, e.g. from gaia_reference_stars) is matched to the nearest detection within match_radius pixels of its position through wcs — which therefore has to be accurate, i.e. refine_wcs's output for real IASC/PS1 headers — and zeropoint = median(gmag + 2.5 log10(aperture_flux)), after rejecting 3σ outliers. scatter is the robust (MAD) spread of the individual stars' values, a direct measure of how well the frame calibrates.

mag_range starts at 15 because brighter stars saturate a PS1 45 s exposure (their cores are clipped flat — see fill_value_mask), and ends at 20 to keep each star's own photon noise small. The catalog band (Gaia G) is not the frame's (PS1 w for IASC sets), so magnitudes on this zero point are G-equivalent with a colour term left in — the same convention Astrometrica's reports use ("21.2 G" in IASC reports), and why reports built on it carry band 'G'.

NaN zero point (and n_stars = 0) if no star matches.

source
AsteroidPipeline.inject_movers Method
julia
inject_movers(fits_paths, out_dir; n=50, mag_range=(19.0, 22.5), speed_range=(5.0, 100.0),
              rng=default_rng(), timestamp_key=nothing, exptime_key="EXPTIME",
              reference_stars=nothing, margin=50) -> (paths, truth)

Write copies of a same-field sequence fits_paths into out_dir with n synthetic asteroids added — known truth to measure the pipeline against, at any brightness and speed, instead of the handful of real objects a few sets happen to contain (6 across all the local IASC sets, which can't say how completeness falls off with magnitude).

Each synthetic object moves in a straight line at constant speed, uniform in speed_range (arcsec/hour) in a uniformly random direction, from a uniformly random start inside the first frame (margin pixels from its edges); its magnitude is uniform in mag_range. Each frame is calibrated — WCS refined with the others (refine_wcs_set, as analyze_set refines them) and its own zero point fitted (photometric_zeropoint) against Gaia DR3 (reference_stars, or fetched once — a live request) — so the object lands at its true sky position and with its true brightness in that frame, transparency changes included. It is drawn as a Gaussian of the frame's own measured FWHM, smeared along its motion during the exposure (exptime_key; fast objects really do trail, and whether the detector finds trails is part of what this measures), with Poisson noise from its own counts (header GAIN, default 1). Detector gaps are not avoided: an object crossing one is lost there, as a real one would be. A frame whose zero point can't be fitted (no catalogue star matched) is copied unchanged, with a warning, and has no rows in truth: its brightness would be a guess.

Returns the written paths (same order) and a truth table, one row per object per frame: object, frame, ra, dec (degrees, mid-exposure), epoch (Julian Date, mid-exposure — the same convention run_pipeline now uses), mag, speed (arcsec/hour), x, y (pixels in that frame). Score a run with injection_recovery.

source
AsteroidPipeline.injection_recovery Method
julia
injection_recovery(candidates, truth; radius=1.5, min_frames=3) -> Table

Score a run_pipeline run on inject_movers output: a synthetic object is recovered if one tracklet in candidates lies within radius arcsec of its true position in at least min_frames frames — the same frame-by-frame standard the demos apply to real known objects. Returns one row per object: object, mag, speed, recovered, tracklet (the matching tracklet's id, or 0).

source