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). For hint-free (“blind”) solving it builds its own pattern index from those databases (index, pipeline::index_solve()), and also reads Astrometry.net index files.

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::{SearchSpeed, 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,
    speed: SearchSpeed::Auto,
};
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::MatchedStar;
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§

auto
Everything the arcsec command line decides for the user, as a library.
cancel
Cooperative cancellation of a running solve, and progress reports from it.
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, the multi-pass star finder, and the solve-free image analysis behind --analyse and --extract.
error
The crate’s error type.
index
arcsec’s own blind index: disc-anchored 4-star patterns, built from an installed ASTAP star database and memory-mapped at solve time.
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, and SIP distortion.

Functions§

local_max_threads
This thread’s override from with_max_threads, 0 if none: what a solver passes on to a thread it spawns.
max_threads
Resolve the thread limit: this thread’s override from with_max_threads, else the process-wide value from set_max_threads, else one per core.
set_max_threads
Set the maximum number of worker threads any stage may use.
with_max_threads
Run f with the thread limit set to n on this thread only (0 = no override).