Skip to main content

Crate arcsec_core

Crate arcsec_core 

Source
Expand description

Core astrometry for the arcsec plate solver.

Given the pixels of an astronomical image and an approximate pointing, this crate works out exactly where the image lies on the sky and returns a FITS-style WCS solution. It implements the star-pattern matching approach introduced by ASTAP and reads ASTAP’s star databases (.1476, .290 and .001), plus Astrometry.net index files for hint-free (“blind”) position estimates.

The pipeline, driven by pipeline::solve_image:

  1. Detection (detection) — background and noise estimation, then a multi-pass star finder measuring centroid, HFD and SNR.
  2. Patterns (quads) — 4-star quads described by five distance ratios.
  3. Search (pipeline) — a square spiral around the hint; at each position catalogue stars (catalog) are projected onto the tangent plane (math::coords), turned into quads and matched against the image.
  4. Fit and verify (math::lsq, wcs) — a least-squares plate fit, checked star by star before it is accepted.

Angles are radians throughout the API unless a name says otherwise.

§Example

use std::path::PathBuf;
use arcsec_core::ImageBuffer;
use arcsec_core::pipeline::{SolveMethod, SolveParams, solve_image};

let img: ImageBuffer = load_pixels(); // row-major f32 pixels from your FITS reader
let params = SolveParams {
    ra_hint: 83.82_f64.to_radians(),
    dec_hint: (-5.39_f64).to_radians(),
    fov: 1.2_f64.to_radians(),
    search_radius: 10.0_f64.to_radians(),
    quad_tolerance: 0.007,
    hfd_min: 1.5,
    max_stars: 500,
    db_path: PathBuf::from("/usr/share/astap/data"),
    db_name: "d50".into(),
    binning: 1,
    method: SolveMethod::Quads,
    threads: 0,
};
let wcs = solve_image(&img, &params)?;
println!(
    "centre RA {:.4}°, Dec {:.4}°, scale {:.2}\"/px",
    wcs.ra0.to_degrees(),
    wcs.dec0.to_degrees(),
    wcs.cdelt2 * 3600.0
);

Progress is reported through the log crate at info level; install any logger to see it.

Re-exports§

pub use catalog::AnetIndex;
pub use catalog::AnetIndexEntry;
pub use catalog::AnetStar;
pub use catalog::load_anet_index;
pub use catalog::peek_anet_scale;
pub use error::ArcsecError;
pub use error::Result;
pub use pipeline::BlindSolveParams;
pub use pipeline::blind_solve;
pub use types::ImageBuffer;
pub use types::PairedPositions;
pub use types::PlateConstants;
pub use types::Quad;
pub use types::QuadList;
pub use types::Star;
pub use types::StarList;
pub use types::WcsSolution;

Modules§

catalog
Star catalogue readers: ASTAP .1476/.290/.001 databases and Astrometry.net index files, plus the sky tilings used to find the right files.
detection
Star detection: background/noise estimation and the multi-pass star finder.
error
The crate’s error type.
math
Tangent-plane projection and the least-squares plate fit.
pipeline
The end-to-end solvers: the catalogue spiral search and the blind index solve.
quads
Star patterns (quads and triangles), their matching, and match filtering.
types
Plain data types shared across the pipeline.
wcs
Conversion of plate constants into a FITS WCS solution.

Functions§

max_threads
Resolve the thread limit: the configured value, or one per core if unset.
set_max_threads
Set the maximum number of worker threads any stage may use.