Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

When Solving Fails

A failed solve ends with one line that starts with Error:, and that line says which stage gave up. This page goes through the messages in pipeline order, says what each one means, and what to try. How Solving Works describes the stages themselves.

See what the solver saw

Two flags show more than the final error. --verbose logs each stage: how many stars detection kept and why it dropped the rest, how big the catalog search was, and the best log-odds each orientation reached.

image-solver --image cygnus.fit --catalog catalog-standard.bin --verbose
[INFO ] [detect]   components: 1.836125ms (253 regions)
[INFO ] [detect]   centroid:   514.25µs (83 passed, 170 rej_snr, 0 rej_sat)
[INFO ] [detect]   sort+dedup: 10.666µs (66 after dedup)
[INFO ] [solve] detect: 9.2515ms (66 stars)
[DEBUG] match_field: radius=0.176°, scale=1.461"/px
[DEBUG] match_field: 90 catalog stars, 6961 catalog quads
[DEBUG] match_field [det(CD) < 0]: 4954 img quads, 130 raw matches, 19 pairs, best log-odds 2.96 over 130 hypotheses
[DEBUG] match_field [det(CD) > 0]: 4954 img quads, 147 raw matches, 27 pairs, best log-odds 7.01 over 147 hypotheses
Error: no quad match passed verification: det(CD) > 0: best log-odds 7.01 over 147 hypotheses, det(CD) < 0: best log-odds 2.96 over 130 hypotheses (acceptance needs log-odds above 20.72, odds of 1e9)

This is the output from a 512 x 512 cutout of a larger Cygnus Wall stack, trimmed to the lines that matter. The section The hint is too far off below solves it.

--debug DIR writes two PNG files after a successful solve. detections.png circles every detected star, green when it was matched to the catalog and amber when it wasn’t. solve.png marks each matched catalog star with a cyan cross and draws its residual as a magenta line, stretched 20 times. The residuals are those of the linear fit, so the lines show the field’s distortion pattern.

Missing header values

Error: image is missing required header: FOCALLEN
Error: no position hint: need CRVAL1/2, RA/DEC, or OBJCTRA/OBJCTDEC

The solver stops before it looks at a pixel when the header has no position, plate scale or time. On the command line, --focal-length and --pixel-size supply the plate scale. A missing position or time needs the library, through the hint and epoch setters or with_metadata. Hints and Image Metadata has examples of each.

No stars detected

Error: no stars detected

Detection found nothing that looked like a star. Check that the frame isn’t blank, a dark or bias frame, or so far out of focus that stars spread over more than 2000 pixels. A frame dominated by clouds or moonlight can also leave no star above a signal-to-noise ratio of 5.

When detection finds stars but too few, the failure shows up later as a no quad match error. --verbose prints how many detections survived. The M106 frame on the first page solved with 24.

No quad match passed verification

Error: no quad match passed verification: det(CD) > 0: best log-odds 7.01 over 147 hypotheses, det(CD) < 0: best log-odds 2.96 over 130 hypotheses (acceptance needs log-odds above 20.72, odds of 1e9)

The matcher tried every candidate in both orientations and none reached the acceptance threshold of 20.72. det(CD) > 0 and det(CD) < 0 are the normal and mirrored orientations. A best log-odds near zero, or a handful of hypotheses, means the image and catalog stars had nothing in common. That points to the wrong patch of sky or the wrong scale, rather than to a match that came close.

What to try, most likely first:

  1. Check the plate scale. A focal length off by more than a factor of about 2 makes the matcher look for patterns at the wrong size. Compare FOCALLEN and XPIXSZ with your optics, and remember reducers, Barlows and binning.
  2. Check the hint. Is the header position for this frame? A crop, a mosaic panel or a frame taken during a slew can be far from it. See the next section.
  3. Try a deeper catalog. On a narrow field, catalog-small.bin or catalog-standard.bin may hold too few stars. See The Star Catalog.
  4. Raise --max-stars. The default of 100 image stars is plenty for most frames. A field crowded with faint stars or full of false detections may need more. Matching takes longer as it grows.

The hint is too far off

The Cygnus Wall cutout above keeps the header of the stack it came from, and that header gives the center of the full stack. The cutout is about 1° from it, and its own field is only 12 arcminutes across, so the catalog search around the hint missed it.

image-solver can’t widen the search, but the library can. Set a larger catalog search radius and turn off the check that the solution lies near the hint:

use celestial_catalog::query::catalog::Catalog;
use celestial_images::formats::image::Image;
use celestial_solver::match_field::MatchParams;
use celestial_solver::solve::{solve, SolveParams};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let img = Image::open("cygnus.fit")?;
    let catalog = Catalog::open("catalog-standard.bin")?;

    let params = SolveParams {
        matching: MatchParams {
            search_radius_deg: Some(1.0),
            ..MatchParams::default()
        },
        max_center_offset_fov: f64::INFINITY,
        ..SolveParams::default()
    };
    let result = solve(&img, &catalog).params(params).run()?;

    println!("center: {:.4}°, {:.4}°", result.wcs.crval1, result.wcs.crval2);
    println!("{} matched, log-odds {:.1}", result.pairs.len(), result.log_odds);
    Ok(())
}
center: 315.1465°, 43.8118°
32 matched, log-odds 197.0

With the search radius alone, matching succeeds, but the solve stops at the center check:

initial WCS center 1.016° from hint exceeds 0.289° (1× FOV diagonal 0.289°)

A wider search costs time, because the catalog side builds quads across the whole cone. Widen it as far as your hint is wrong, not further. When you know the right position, passing it with hint is faster than either.

The scale or center disagrees with the hint

Error: initial WCS plate scale 0.527"/px diverges from hint 0.222"/px by factor 2.38 (limit 2.00)
Error: initial WCS center 1.016° from hint exceeds 0.289° (1× FOV diagonal 0.289°)

The matcher found a match it believes, but the fitted scale or position contradicts the header. The message gives the fitted value, the header value and the limit. When the fitted value matches your optics or your target, the header is wrong: fix it, or override it as Hints and Image Metadata describes. The first error above came from --focal-length 7000 on a frame taken at 2943 mm.

Both limits are in SolveParams. max_scale_factor defaults to 2 and max_center_offset_fov to 1 diagonal. Raising them is a last resort, because the checks are what stop a wrong header from producing a wrong answer quietly.

A solve that succeeds but looks wrong

The log-odds test makes a false solution very unlikely, but a correct solution can still be poor. Look at these lines of the report:

  • Control points under about 10 leave the fit with little to work with, and often too few stars to fit distortion terms. Against catalog-small.bin, the M106 frame matched 10 stars and got no distortion terms. A deeper catalog helps.
  • SIP RMS well above 1 pixel suggests trailed or doubled stars, or a frame with strong distortion that order 4 can’t model. solve.png from --debug shows where the large residuals are.

In Rust, result.refinement says whether you got the refined solution. When it’s anything other than Refinement::Refined, the solver fell back to its first fit, or left the distortion terms out, and the value holds the error that caused it.

Handle failures in code

SolveError has one variant per kind of failure, so a program can react to each:

use celestial_catalog::query::catalog::Catalog;
use celestial_images::formats::image::Image;
use celestial_solver::error::SolveError;
use celestial_solver::solve::solve;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let img = Image::open("jellyfish.fit")?;
    let catalog = Catalog::open("catalog-standard.bin")?;

    match solve(&img, &catalog).run() {
        Ok(result) => println!("solved with {} stars", result.pairs.len()),
        Err(SolveError::Metadata(e)) => println!("fix the header or set it: {e}"),
        Err(SolveError::NoStars) => println!("no stars found; check the exposure"),
        Err(SolveError::NoMatch { reason }) => println!("no match: {reason}"),
        Err(e) => return Err(e.into()),
    }
    Ok(())
}
fix the header or set it: image is missing required header: FOCALLEN

NoMatch covers the three checks above: no verified quad match, a scale or center that disagrees with the hint, and a final solution that failed verification. InvalidParameter means a value in SolveParams is out of range, and its message names the field.

Next steps