Hints and Image Metadata
The solver doesn’t search the whole sky. It needs three things before it starts: roughly where the image points, roughly how many arcseconds one pixel covers, and when the image was taken. Capture programs such as NINA, SharpCap, Ekos and SGP write all three into the FITS header, and the solver reads them from there. This page covers where each one comes from, how wrong it can be, and how to supply it when the header doesn’t have it.
Why the solver needs a hint
The matching stage compares image quads with catalog quads from one patch of sky. The position hint picks the patch, and the plate scale sets its size and the spacing of the stars in it. Without them, the solver would have to compare against the whole sky at every scale, which is slower and needs a different kind of index.
The epoch matters less. The catalog positions are for J2016.0, and the solver moves each star by its proper motion to the date of the image. For most stars that’s well under a pixel, but nearby stars move by arcseconds per decade.
What the solver reads from the header
| Needed | Header keywords, in the order tried |
|---|---|
| Position hint | the sky position of the image center under the header’s WCS, then CRVAL1/CRVAL2, then RA/DEC, then OBJCTRA/OBJCTDEC |
| Plate scale | FOCALLEN in mm and XPIXSZ in microns |
| Epoch | MJD-OBS, then DATE-OBS, with TIME-OBS when DATE-OBS has no time |
The plate scale is 206.265 × XPIXSZ / FOCALLEN arcseconds per pixel.
XPIXSZ must be the size of a binned pixel: 7.6 µm for a 3.8 µm sensor
binned 2x2. Most capture programs write it that way.
RA and DEC can be decimal degrees or sexagesimal strings. OBJCTRA
and OBJCTDEC are sexagesimal, in hours and degrees. When a header
repeats a keyword, the last card wins, which is how FITS libraries read
it.
A header with a full WCS from an earlier solve gives the best hint of all, so solving an already solved image works and starts from its old solution.
How wrong the hint can be
The solver has two limits that you can see in its errors:
- Plate scale within a factor of 2. The first fitted scale must be
between half and double the hint. On the jellyfish nebula frame below,
whose true focal length is 2943 mm, each
--focal-lengthtried from 1500 to 5800 solved. 7000 failed this check, and 1000 failed earlier, in matching, because the solver looked for star patterns at the wrong size. - Center within one image diagonal. The fitted center must be within one diagonal of the hint. In practice the catalog search is the tighter limit: it covers a cone of 0.6 diagonals around the hint, and the image has to fall mostly inside it. On the M106 frame, whose diagonal is 0.47°, a hint 0.2° off solved and a hint 0.3° off didn’t. On a 2.3° x 1.7° frame of the Rosette nebula, whose diagonal is 2.9°, a hint 1° off solved.
For a mount that has been synced or plate solved once that night, both limits are generous. They exist to catch a header that is wrong, such as a focal length typed for a different telescope, before the solver returns a match that disagrees with it.
Override a header value
When the header is wrong or missing one value, override that value and
let the rest come from the header. The jellyfish nebula frame has
XPIXSZ, OBJCTRA, OBJCTDEC and DATE-OBS, but no FOCALLEN:
$ image-solver --image jellyfish.fit --catalog catalog-standard.bin
Error: image is missing required header: FOCALLEN
Give the focal length on the command line:
image-solver --image jellyfish.fit --catalog catalog-standard.bin --focal-length 2900
--focal-length also fixes a header that names the bare telescope when a
reducer or Barlow was in the path. --pixel-size fixes a pixel size that
doesn’t account for binning.
In Rust, each value has a setter on the solver: hint, epoch,
focal_length_mm, pixel_size_um and plate_scale_arcsec. The epoch is a
UTC Julian Date, the scale DATE-OBS uses. The solver converts it to TT
for the catalog, so it must be 1960 or later, when UTC begins.
use celestial_catalog::query::catalog::Catalog;
use celestial_images::formats::image::Image;
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")?;
// The header has XPIXSZ but no FOCALLEN.
let result = solve(&img, &catalog).focal_length_mm(2900).run()?;
let (sx, _) = result.wcs.scale_arcsec();
println!("scale: {sx:.3} arcsec/px");
if let Some(f) = result.wcs.effective_focal_mm() {
println!("effective focal length: {f:.0} mm");
}
Ok(())
}
scale: 0.527 arcsec/px
effective focal length: 2943 mm
A plate scale you set with plate_scale_arcsec takes priority over the
focal length and pixel size. Use it when you know the scale from an
earlier solve but not the optics. effective_focal_mm is the focal length
the fitted scale implies. When it’s far from the nominal one, there’s a
reducer or Barlow in the path that the header doesn’t know about.
Images without a header
PNG and TIFF files have no FITS header, and some software writes FITS files
without the keywords above. For those, build an ImageMetadata yourself
and pass it with with_metadata. The solver then reads nothing from the
header:
use celestial_catalog::query::catalog::Catalog;
use celestial_coords::frames::icrs::ICRSPosition;
use celestial_images::formats::image::Image;
use celestial_solver::metadata::image_metadata::ImageMetadata;
use celestial_solver::solve::solve;
use celestial_time::scales::utc::utc_from_calendar;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let img = Image::open("m106.fit")?;
let catalog = Catalog::open("catalog-standard.bin")?;
let meta = ImageMetadata {
hint: ICRSPosition::from_degrees(184.74, 47.30)?, // M106
scale_arcsec: 0.58,
epoch: utc_from_calendar(2023, 3, 20, 4, 17, 45.7)?.to_julian_date(),
focal_mm: None,
pixel_um: None,
};
let result = solve(&img, &catalog).with_metadata(meta).run()?;
println!("center: {:.4}°, {:.4}°", result.wcs.crval1, result.wcs.crval2);
Ok(())
}
center: 184.7260°, 47.3107°
scale_arcsec is the plate scale the solve uses. focal_mm and
pixel_um are optional: the solver copies them into the result for the
report and for effective_focal_mm, and doesn’t use them to solve. Once
you call with_metadata, the individual setters such as hint are
ignored.
The image-solver command has no flags for the position or the epoch, so
an image without them in its header needs the library.
Next steps
- If the solve still fails with good metadata, read When Solving Fails.
- For every flag of the command, see The image-solver Command.