Skip to content

Image sets and reports ​

Whole image sets, from a .zip, folder or file list to an MPC report (Analyze image sets); MPC reports and their checks (Write and check MPC reports); known objects near a candidate and the NEO Confirmation Page (Is a candidate new?); the observatory from the images' headers (Use a different telescope); camera files as plain images and raw frames calibrated (Raw frames, reduced here).

AsteroidPipeline.IASC_PS1_CONFIG Constant
julia
IASC_PS1_CONFIG

pipeline_config for Pan-STARRS1's IASC frames (0.2563"/pixel).

source
AsteroidPipeline.analyze_set Method
julia
analyze_set(source; workdir, observatory, mpcorb=nothing, header=(;), name=nothing,
            extract_to=dirname(source), config=nothing, reference_stars=nothing,
            extension=nothing, offline=false, star_test=true, faint_test=true,
            progress=(stage, fraction) -> nothing) -> NamedTuple

Everything run_pipeline and the checks around it do for one image set — a same-field sequence of at least 3 frames — source being its .zip, its directory of FITS frames, or a vector of FITS paths; a frame may be tile-compressed (.fz) or one image of a multi-extension file, extension (an HDU number or EXTNAME) choosing which for a mosaic camera's (image_extensions). observatory is the MPC code of the site that took them ("F51" for Pan-STARRS1).

  1. unpack a .zip (extract_set) into extract_to, next to it by default, where Astrometrica can open it too; frames are taken in time order, whatever order they were given in;

  2. copy every frame that is not a plain FITS image into one (plain_frame) and clean BLANK pixels (clean_blank_pixels), copies under workdir;

  3. refine every frame's WCS against Gaia DR3, the frames together (refine_wcs_set), and measure its quality — sources at 10σ per reference star, as set_quality does. A frame above the limit (30), or with next to no valid pixels (all of one value), is left out if at least 3 others remain; with fewer than 3 good frames the set is reliable = false and not searched;

  4. search the remaining frames with config — by default

pipeline_config at the frames' own pixel scale;

  1. identify tracklets with SkyBoT (5") and, given mpcorb, the MPC's orbits (15"), confirmed in at least 3 frames (all, with 3 frames). mpcorb is used only for images within a year of its orbits' epoch: propagated two-body further than that they drift by arcminutes, and SkyBoT's integrated orbits are used instead (JPL's, while SkyBoT is unavailable);

  2. check every candidate left against the known objects within 10' of it (nearby_known_objects): one there moving the same way is most likely a known object with a poor orbit — and, for recent images, against the MPC's NEO Confirmation Page (neocp_check); and, given itf (the file download_itf keeps, or read_itf's observations), against the MPC's Isolated Tracklet File: one there was most likely reported already, by Pan-STARRS's own pipeline for an IASC set (itf_check); and, given digest2 (the path of the MPC's digest2 program), the likelihood that each is a near-Earth object (digest2_score), noting those at 65 or more, the score at which the MPC posts a tracklet to its NEO Confirmation Page;

  3. list the known objects expected in the field (known_objects_in_field), marking which were detected;

  4. write the report: the unidentified tracklets' observations (for vetting in Astrometrica — never to submit unchecked), or, with none, the blank report for "no moving objects detected" (blank_mpc_report). header holds mpc_report_header's keywords (e.g. from astrometrica_settings).

progress(stage, fraction) is called as it goes (stage a Symbol: :extract, :clean, :refine, :search, :identify, :nearby, :field, :report, :done). name names a set given as files (default: their folder's name). reference_stars (a table with ra, dec and, for magnitudes, gmag, as gaia_reference_stars returns) replaces the Gaia DR3 query for the astrometry and photometry: a catalogue of one's own, or work without the network. With offline=true no service is asked: Gaia DR3, SkyBoT and JPL answer as they answered before (answers_dir), a query never answered throwing (Gaia) or leaving a warning (the known objects), and the NEO Confirmation Page is not checked; with the frames, mpcorb and itf as files, the same analysis then gives the same result whether the services are down or have changed. Returns a named tuple: name, paths (the original frames), epochs, wcs (refined, per frame), image_size, ratios, frames_used, dropped, reliable, candidates (an astrometric_calibrate table with frame indexing paths, and mag, its 1σ mag_err, and pos_err, a position's 1σ per axis in arcsec: the Cramér–Rao bound for the frame's point spread and noise with the error of its astrometric fit, which ades_psv writes as rmsRA and rmsDec), limiting_mag (the magnitude of a source 5σ above the frames' sky noise in an aperture of their FWHM, NaN for an unreliable set or when no frame has a zero point: see below_limit; when only 3 frames are searched, candidates fainter than it or with no magnitude are left out, with a warning, and with more, the tracklets of the frame-by-frame search fainter than it unless faint_test=false: a single exposure does not show them, and those found are noise lined up), known (Dict tracklet id => name), stacked (the ids found only by stack_search, which stack=false turns off), unknown_ids, nearby (nearby_known_objects's check of each unknown tracklet), neocp (neocp_check's), itf (itf_check's, empty without itf), digest2 (tracklet id => digest2_score's row, empty without digest2), expected (from known_objects_in_field, each with a detected flag), report, report_kind (:blank, :candidates or :unreliable) and warnings.

With star_test (the default), the points of the frame-by-frame search that lie within their frame's FWHM of a Gaia star as bright as they are or brighter are taken out, as what the subtraction left of that star, and a tracklet left with fewer than 3 goes, with a warning; in a crowded field such points line up by chance. Tracklets found by stacking are not tested.

source
AsteroidPipeline.astrometrica_settings Method
julia
astrometrica_settings(cfg_path) -> NamedTuple

The observing-site fields of an Astrometrica settings file (Settings/PS1.cfg in IASC's installer): code (MPC observatory code), observers, measurers, telescope, contact, and net — the reference catalog's name as Astrometrica writes it in a report's NET line, for the catalog codes seen in real reports (10, "Gaia DR1"), else "".

source
AsteroidPipeline.blank_mpc_report Method
julia
blank_mpc_report(code; header...) -> String

The report for a set with no moving objects: header and end line, no observations — what Astrometrica writes after a reduction once the image has been clicked, and what IASC's portal expects for "no moving objects detected". Keywords as for mpc_report_header.

source
AsteroidPipeline.check_mpc_report Method
julia
check_mpc_report(text; observatory, epochs=nothing, field=nothing, known=nothing,
                 epoch_tolerance=120.0, position_tolerance=10.0)
    -> (ok, issues, cleaned)

Check an MPC 80-column report — normally Astrometrica's MPCReport.txt — before it's submitted, for the mistakes made on a real campaign, and return a corrected version.

issues is a vector of (code, line, detail) named tuples (line is the 1-based line number, 0 for the report as a whole); ok is false if any of them is an error. Codes:

  • :empty — nothing in it. Error.

  • :missing_cod — no COD line: IASC's portal answers "No Telescope Code found at start of MPC Report", as it did for a report copied before the image was clicked once in Astrometrica. Error.

  • :cod_not_first — a COD line, but not first. Error.

  • :wrong_code — COD isn't observatory (detail: the code found; XXX is Astrometrica's default settings, not the PS1 ones). Error.

  • :station_mismatch — an observation's columns 78-80 aren't observatory. Error.

  • :malformed_line — neither a header line, an 80-column observation, nor the end line. Error.

  • :other_set — an observation more than epoch_tolerance seconds from every one of epochs (the set's frame epochs, JD UTC mid-exposure), or off the set's frames (field(ra, dec) false): another set's line still in Astrometrica's report file. Both tests are needed — IASC's sets from one night come from the same exposures (XY45_p01 and XY45_p10 share their epochs to the second), so only the position tells them apart. Error.

  • :known_object — an observation of a known object (detail: its name): its packed designation is one of known's, or it lies within position_tolerance arcsec of one's position at that epoch. Clicking on a known asteroid by mistake put such a line into a "no moving objects" report. Warning — a known object may be reported on purpose.

  • :single_observation — an object with one observation only; the MPC needs at least two. Warning.

  • :missing_end — no ----- end ----- line. Warning.

  • :not_ascii — a header line with accented letters (detail: the line), which the MPC asks for in TeX notation, as the cleaned report has them. Warning.

known is a vector of named tuples with name and optionally packed, and epochs/ra/dec vectors (as known_objects_in_field returns). cleaned is the report with every observation flagged :other_set or :known_object and every malformed line removed, COD (observatory) first and the end line last — a blank report if nothing is left.

source
AsteroidPipeline.clean_blank_pixels Method
julia
clean_blank_pixels(path; outdir) -> String

Write a copy of the FITS file at path with BLANK-sentinel pixels replaced by the frame's own valid-region median, into outdir, header untouched (WCS and epochs stay exact), and return the copy's path — or path itself if the frame has no BLANK pixels. An existing copy is reused.

PS1's IASC frames mark invalid pixels with the BLANK keyword (scaled through BZERO/BSCALE), which FITSIO.jl doesn't turn into NaN: left in, one real frame read 158,443 sentinel pixels as bright flux and gave 176,165 spurious detections at 8σ (176 once cleaned).

source
AsteroidPipeline.default_mpcorb_path Method
julia
default_mpcorb_path() -> String

Where download_mpcorb keeps its copy: $XDG_CACHE_HOME (default ~/.cache) /AsteroidPipeline/MPCORB.DAT.

source
AsteroidPipeline.download_mpcorb Function
julia
download_mpcorb(path=default_mpcorb_path(); max_age_hours=24, url=MPCORB_URL) -> String

A current copy of the MPC's orbit file at path: downloaded (gzipped, ~70 MB) and unpacked if the file is missing or older than max_age_hours, kept as is otherwise. If the download fails and an older copy exists, that copy is returned with a warning; with no copy at all, the error propagates.

The MPC's current orbits identify recently linked or poorly observed objects that SkyBoT's older ones place far off, so the copy is kept fresh.

source
AsteroidPipeline.extract_set Method
julia
extract_set(zip_path, dest_dir) -> (name, paths)

Unpack an image set (an IASC one: ps1-20261005_9_XY45_p01.zip) into dest_dir/<set name>/ and return the set's name (the folder inside the archive, XY45_p01, or the archive's own name if it has none) and its FITS paths, sorted. An already-extracted set is reused, not overwritten; a folder of that name holding other files (another archive's, inside a folder of the same name) is left alone, and the set goes by the archive's name instead, with -2, -3… if that is taken too.

The archive is unpacked into a scratch directory first, and only its regular FITS files are moved out, by base name — so a crafted entry name or a symbolic link inside it can't place anything else in dest_dir.

source
AsteroidPipeline.frame_footprint Method
julia
frame_footprint(wcs_per_frame, image_size; margin=0) -> Function

(ra, dec) -> Bool: whether a sky position falls on any of the frames (image_size = (ny, nx), margin pixels of slack) — the field test check_mpc_report takes.

source
AsteroidPipeline.known_objects_in_field Method
julia
known_objects_in_field(wcs_per_frame, epochs, image_size; mpcorb=nothing,
                       observatory, skybot=true) -> (objects, warnings)

Every catalogued minor planet whose predicted position falls on the frames at any of epochs (JD UTC, one per frame), whether or not the pipeline detected it: what Astrometrica's known-object overlay shows, for checking a set by eye and for not measuring a known asteroid by mistake.

image_size is (ny, nx). Positions come from mpcorb (what read_mpcorb returns, propagated as in crossmatch_catalog's :mpcorb; observer positions from JPL Horizons) and, with skybot, from a SkyBoT cone search at each epoch; an object both know keeps MPCORB's position, the more current one. Each object is a named tuple: name, packed (MPCORB's packed designation, "" if SkyBoT only), mag (predicted V), source, and per-frame vectors epochs, ra, dec, x, y (pixels of each frame's own wcs). A network failure leaves that source out and adds a line to warnings instead of failing.

source
AsteroidPipeline.mpc_report Method
julia
mpc_report(candidates, code; trksub_prefix="", designations=nothing, header...) -> String

mpc80_report's observation lines for candidates, between a mpc_report_header and the end line: a whole report, in the form Astrometrica produces.

source
AsteroidPipeline.mpc_report_header Method
julia
mpc_report_header(code; observers="", measurers="", telescope="", net="",
                  contact="", ack_time=Dates.now()) -> Vector{String}

The header lines of an MPC 80-column report, in the order Astrometrica writes them: COD first (IASC's portal rejects a report that doesn't start with it), then CON, OBS, MEA, TEL, ACK, NET — each only if given. Accented letters are written in TeX notation, as the MPC asks of names (Olguín becomes Olgu\'{i}n).

source
AsteroidPipeline.pack_designation Method
julia
pack_designation(name) -> Union{String,Nothing}

The MPC packed form of a minor-planet designation, as columns 1-12 of an 80-column report carry it: a number ("(656932) 2016 FA12" or "656932" -> "~09bg", "433" -> "00433"), else a provisional designation ("2016 SB115" -> "K16SB5B") or a survey one ("4311 T-1" -> "T1S4311"). nothing for a name it can't pack (a bare proper name).

source
AsteroidPipeline.pipeline_config Method
julia
pipeline_config(pixel_scale_arcsec; n_frames=4) -> NamedTuple

run_pipeline keywords for a same-field sequence of frames at this pixel scale (arcsec/pixel): the configuration validated against every local IASC set (see the IASC validation page of the docs), with its tolerances kept in arcseconds and converted to this scale's pixels — a 2" linking radius, speeds of 3"/h to ~210"/h. Detection on each frame minus the sequence's median at 6σ, fill-value gaps masked, single-pixel spikes, hot pixels, bright-star light and badly subtracted stars (a negative as deep as the detection threshold beside the detection) dropped, each frame's WCS refit to Gaia DR3, tracklets held to straight-line, constant-brightness tests. A tracklet needs half of the sequence's n_frames, and at least 3 (3 for a 4-frame IASC set): in a long sequence a real object is in most frames, while a few frames' noise can line up by chance.

source
AsteroidPipeline.image_extensions Method
julia
image_extensions(path) -> Vector{Int}

The HDUs of the FITS file at path that hold a 2-D image, by number (1 is the primary): one for a plain or tile-compressed (.fz) frame, one per amplifier or detector for a camera that writes several.

source
AsteroidPipeline.plain_frame Method
julia
plain_frame(path; outdir, extension=nothing) -> String

The frame at path as a plain FITS file, its image in the primary HDU: what every function here that takes frames' paths reads. A frame already plain is returned as it is, or as clean_blank_pixels copies it if it has BLANK pixels. Otherwise it is written to outdir as floating point, BLANK pixels replaced by the median of the others:

  • a tile-compressed (.fz) or multi-extension file's image: extension (an HDU number or EXTNAME), by default the first 2-D image;

  • by default, a detector read out through several amplifiers, one image extension each with DATASEC and DETSEC (IRAF's convention), assembled: each amplifier's data section placed at its detector section (counted in unbinned pixels: CCDSUM's binning and a subarray's origin are taken into account), less the median of its overscan (BIASSEC) and, if every amplifier has a GAIN, in electrons (GAIN then 1). What differs between amplifiers beyond that is the bias frames' and flat field's to remove (calibrate_frames).

The header is the image's own, without the keywords of its storage (a compressed image's ZNAXIS1… become NAXIS1…), and with the primary header's keywords it lacks, where cameras that write extensions keep the time, the exposure and the pointing. An existing copy is reused. analyze_set calls it on every frame.

source
AsteroidPipeline.calibrate_frames Method
julia
calibrate_frames(paths; outdir, bias=String[], dark=String[], flat=String[],
                 exptime_key="EXPTIME", extension=nothing) -> Vector{String}

Raw frames reduced with the calibration frames taken for them, written to outdir (a plain FITS file each, its header with a HISTORY line) and returned as paths, for analyze_set. Any of bias, dark and flat may be left out; each is combined by its pixels' median.

  • master bias: the bias frames' median;

  • master dark: the darks less the bias, per second of exposure (exptime_key), scaled to each frame's; without bias frames the darks are subtracted as they are, which suits darks of the frames' own exposure;

  • master flat: the flats less bias and dark, each over its own median, then over their median's median. Pixels whose response is below a fifth of it, or not finite (dead pixels, a vignetted corner, an overscan strip), are set to NaN, which fill_value_mask masks.

Each frame becomes (raw − bias − dark·t) / flat. Overscan is not fitted nor trimmed; frames, compressed or in extensions, are read as plain_frame reads them (extension for a mosaic camera's).

source
AsteroidPipeline.nearby_known_objects Method
julia
nearby_known_objects(candidates; observatory, mpcorb=nothing, radius_arcmin=10,
                     match_arcsec=15, skybot=true) -> (checks, warnings)

For every tracklet in candidates (an astrometric_calibrate table, or its rows), the known minor planets predicted within radius_arcmin of it at its own epochs — from mpcorb (as read_mpcorb returns; observer positions from JPL Horizons) and SkyBoT — compared with it.

checks maps each tracklet id to (verdict, motion, objects): motion is its own tracklet_motion; objects are named tuples name, source, separation_arcsec (median over the frames), mag (predicted V), the object's predicted rate_arcsec_h and pa_deg, and agreement: :position (within match_arcsec), :motion (further off, but at the same rate and in the same direction, displaced along its track — the signature of a poorly known orbit) or :none. verdict is :known if any object agrees in position, :possibly_known if one agrees in motion, else :new. A service that can't be reached is left out, with a line in warnings.

source
AsteroidPipeline.tracklet_motion Method
julia
tracklet_motion(points) -> (rate_arcsec_h, pa_deg, rms_arcsec)

Straight-line motion through a tracklet's points (rows with ra, dec in degrees and epoch in days): its rate in arcsec/hour, its position angle in degrees east of north, and the RMS distance of the points from the fitted line in arcsec — how well they line up, as a real object's do (IASC's "true signature": a straight line, a constant rate).

source
AsteroidPipeline.neocp_check Method
julia
neocp_check(candidates; observatory, radius_arcmin=30, max_age_days=30,
            now_jd=<now>) -> (checks, warnings)

For every tracklet in candidates, the objects of the MPC's NEO Confirmation Page predicted within radius_arcmin of it at its own epochs, from observatory (the MPC's own ephemerides, a live request). checks maps each tracklet id to (verdict, objects): objects are designation, score, separation_arcsec (median over the frames), the object's predicted rate_arcsec_h and pa_deg, uncertain (the MPC marks the ephemeris as uncertain) and agreement: :motion if the object moves like the tracklet (rate within 30%, direction within 15°), else :none. verdict is :on_neocp if one agrees, else :none.

A candidate on the NEOCP is someone else's recent, unconfirmed find: report it under that designation (mpc_report's designations) — the observations help confirm it. The radius is wide because NEOCP ephemerides, from arcs of hours, are uncertain by arcminutes.

Images older than max_age_days are not checked (a warning says so): the NEOCP lists only what is being observed now.

source
AsteroidPipeline.neocp_objects Method
julia
neocp_objects() -> Vector{NamedTuple}

The objects on the MPC's NEO Confirmation Page now (a live request): designation (temporary), score (the MPC's 0-100 likelihood of being a NEO), ra, dec (degrees, at the last observation), mag (V), n_obs, arc_days and not_seen_days.

source
AsteroidPipeline.default_itf_path Method
julia
default_itf_path() -> String

Where download_itf keeps its copy, next to default_mpcorb_path: $XDG_CACHE_HOME (default ~/.cache) /AsteroidPipeline/itf.txt.gz.

source
AsteroidPipeline.download_itf Function
julia
download_itf(path=default_itf_path(); max_age_hours=24, url=ITF_URL) -> String

A current copy of the MPC's Isolated Tracklet File at path, kept gzipped (~130 MB, ten million observations): downloaded if missing or older than max_age_hours. If the download fails and an older copy exists, that copy is returned with a warning; with no copy at all, the error propagates.

source
AsteroidPipeline.itf_check Method
julia
itf_check(candidates, itf; radius_arcsec=2.0, max_gap_hours=0.5) -> Dict{Int,Vector}

The observations of itf (read_itf's) that each tracklet of candidates (id, ra, dec, epoch) passes through: within radius_arcsec of the tracklet's straight-line motion, at most max_gap_hours before its first point or after its last. A tracklet with such observations was most likely reported already, unlinked: by Pan-STARRS's own pipeline, for an IASC set, which IASC rejects as a duplicate. Only tracklets with matches are keys; each match is the ITF observation with its distance_arcsec from the motion.

source
AsteroidPipeline.read_itf Method
julia
read_itf(path, epochs; margin_days=1) -> Vector{NamedTuple}

The observations in the Isolated Tracklet File at path (gzipped, as download_itf keeps it) taken within margin_days of epochs (JD UTC): trksub, jd, ra, dec (degrees) and station. Lines of other dates are skipped unparsed, so a night's observations are read in seconds.

source
AsteroidPipeline.download_obscodes Function
julia
download_obscodes(path=<cache>/ObsCodes.txt; max_age_hours=720, url=OBSCODES_URL) -> String

A copy of the MPC's observatory list at path (default next to default_mpcorb_path's), fetched if missing or older than max_age_hours (30 days: codes are added, rarely changed). On a failed download an existing copy is kept and returned, with a warning.

source
AsteroidPipeline.frame_site Method
julia
frame_site(header::FITSHeader) -> NamedTuple

What a frame's header says about where it was taken: telescope (TELESCOP), instrument (INSTRUME), origin (ORIGIN), observatory (OBSERVAT), and the site's east longitude lon and latitude lat (degrees) and elevation elev (metres) — nothing for any of the three the header doesn't give. Reads the usual keywords (OBSLON/OBSLAT/OBSALT as ZTF writes them, SITELONG/SITELAT, LONG-OBS..., LONGITUD/LATITUDE/HEIGHT as Las Cumbres does, LONGITUD only where its comment says east or west) and Pan-STARRS's FPA.LONGITUDE (west, in hours) / FPA.LATITUDE / FPA.ELEVATION.

source
AsteroidPipeline.observatory_candidates Method
julia
observatory_candidates(site, codes; max_km=10) -> Vector{NamedTuple}

MPC codes that could be the observatory frame_site describes, best first: code, name, distance_km from the header's site (NaN if it has none) and score, the number of words or acronyms the code's name shares with the header's telescope, instrument, origin and observatory names. With a site, only codes within max_km are considered, ranked by score, then distance; without one, every code sharing a word, by score. codes is what read_obscodes returns.

source
AsteroidPipeline.read_obscodes Method
julia
read_obscodes(path) -> Vector{NamedTuple}

The MPC's list of observatory codes (ObsCodes.html, the HTML page or its text): code, east longitude lon (degrees), parallax constants rho_cos and rho_sin (Earth radii), and name, from its fixed columns. Codes without a site on Earth (spacecraft, "250 Hubble Space Telescope") are skipped.

source