Skip to main content

Crate target_match

Crate target_match 

Source
Expand description

Identify which catalogued sky objects a telescope frame covers, given a pointing (right ascension / declination) and a field of view (derived from optics, or supplied directly).

A caller-supplied set of catalogue objects is ranked by angular separation from the pointing; objects inside the frame’s membership shape are flagged. Matching uses sky position only — a designation may ride along on a result for display, but it never influences the match.

The crate holds no catalogue data and performs no I/O. A consumer supplies its own objects — from a database, a file, a name resolver, or a hand-built list — by implementing the matcher module’s SkyObject trait.

Coordinate and angle types come from the skymath crate and appear directly in this crate’s signatures: construct positions with skymath::Equatorial and angles with skymath::Angle. The crate is re-exported as target_match::skymath so consumers can name a version-matched skymath without a separate dependency entry.

§Modules

  • optics — plate scale and field-of-view geometry from focal length, pixel size (x/y), binning (x/y), and sensor dimensions — or a directly supplied pixel scale / field of view — plus the search-radius policies.
  • matcher — the SkyObject input trait, match constraints (radius, rectangular field of view, nearest-N), and deterministic ranking.

§Example

use skymath::{Angle, Equatorial, ParseMode};
use target_match::{rank, Constraint, Field, Optics, RadiusPolicy, SkyObject};

struct Target { name: &'static str, ra: f64, dec: f64 }
impl SkyObject for Target {
    fn position(&self) -> Equatorial {
        Equatorial::j2000(Angle::from_degrees(self.ra), Angle::from_degrees(self.dec)).unwrap()
    }
}

let catalog = [
    Target { name: "M 31",  ra: 10.6847, dec: 41.2688 },
    Target { name: "M 33",  ra: 23.4621, dec: 30.6599 },
];
let pointing = Equatorial::parse_j2000("00:42:44.3", "+41:16:09", ParseMode::Strict).unwrap();
let field = Field::from_optics(Optics {
    focal_mm: 800.0, pixel_um: (3.76, 3.76), binning: (1, 1), pixels: (6248, 4176),
}).unwrap();

let hits = rank(pointing, &catalog, Constraint::within(&field, RadiusPolicy::Circumscribed).nearest_one());
assert_eq!(hits[0].object.name, "M 31");

Re-exports§

pub use skymath;

Modules§

error
Error type for target-match.
matcher
The matching engine: input trait, constraints, ranking, and a prebuilt index.
optics
Plate scale and field-of-view geometry.

Structs§

Constraint
A Membership shape combined with a Query mode (and the plate scale, when known, so pixel offsets can be reported).
Field
The angular extent of a frame.
Match
A ranked match: a borrowed catalogue object plus its computed geometry.
Matcher
A prebuilt, declination-sorted index for repeated queries against one catalogue.
Offset
The offset of a matched object relative to the frame centre.
Optics
Full optical train: focal length, per-axis pixel size, per-axis binning, and sensor pixel counts.

Enums§

Error
Everything that can go wrong constructing target-match values.
Membership
The shape that decides whether an object is “in frame”.
Query
What to return from a match.
RadiusPolicy
How a search radius is derived from a Field.

Constants§

ARCSEC_PER_DEGREE
Arcseconds per degree.
ARCSEC_PER_RADIAN
Exact number of arcseconds in one radian (supersedes the rounded 206.265).
DEFAULT_FALLBACK_RADIUS
Fallback search radius when a field of view cannot be derived (5°).

Traits§

SkyObject
A catalogue object that can be matched by sky position.

Functions§

is_framed
Evaluate a single object against a frame, returning its membership + geometry.
rank
Rank a slice of objects against a pointing under a constraint (stateless scan).

Type Aliases§

Result
Convenience alias for Result<T, Error>.