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

The image-solver Command

Reference for the image-solver binary. Build it with the cli feature:

cargo install --path celestial-solver --features cli

Usage

image-solver [OPTIONS] --image <IMAGE> --catalog <CATALOG>
FlagMeaning
-i, --image PATHThe image to solve, FITS or XISF. Required.
-c, --catalog PATHThe catalog file. Required. See The Star Catalog.
-o, --output PATHWrite a copy of the image with the solution in its header. The extension picks the format: .fits, .fit, .fts or .xisf.
--focal-length MMUse this focal length instead of the FOCALLEN header.
--pixel-size UMUse this pixel size instead of the XPIXSZ header.
--max-stars NThe most image stars to build quads from. Default 100.
--debug DIRWrite detections.png and solve.png to DIR, creating it if needed.
--verboseLog each stage of the solve to standard error.
-h, --helpPrint the flags.

The image must carry a position hint, an observation time and a plate scale, or the flags above must supply the plate scale. Hints and Image Metadata lists the header keywords read for each.

An --output path with another extension is rejected before the solve starts. The output directory is created if it doesn’t exist.

Output streams and exit status

The solution report goes to standard output. Timings, --verbose logs, wrote PATH after --output, and errors go to standard error.

The exit status is 0 when the image solved and 1 when it didn’t. A failure prints one line that starts with Error:. When Solving Fails explains each message.

RUST_LOG overrides the log level, for example RUST_LOG=info for the stage timings without the debug lines.

The report

The report for the M106 frame is on Solve Your First Image. Its lines, in order:

LineMeaning
Creation timeWhen the report was made, UTC.
Creation softwareThe solver version.
Reference catalogThe catalog library version.
Linear transformation matrixThe linear part of the solution: tangent-plane offsets in degrees from report pixel coordinates. The third column is the offset of report pixel (0, 0).
ProjectionGnomonic (TAN-SIP) with distortion terms, Gnomonic (TAN) without.
Projection originThe reference pixel, in report pixel coordinates, and its sky position.
ResolutionPlate scale in arcseconds per pixel. “Linear approximation” marks a solution with distortion terms, where the scale varies across the field.
RotationAngle from image up to north, in degrees, positive clockwise. (flipped) marks a mirrored image.
Reference systemAlways ICRS.
Observation start timeThe time the solve used, from MJD-OBS or DATE-OBS.
Geodetic coordinatesThe observing site, when the header gives one.
Focal distanceThe focal length the fitted scale implies for the header’s pixel size. Present when the pixel size is known.
Pixel sizeThe pixel size used, in microns.
Field of viewWidth x height of the frame on the sky.
Image dimensionsWidth x height in pixels.
Image center, Image boundsSky positions of the center and the four outer corners. ex and ey are the mean residual, in pixels, of the five fitted stars nearest that point.
SIP distortion orderThe order of the distortion polynomials, followed by their coefficients. Present only when distortion terms were fitted.
Control pointsThe number of stars in the final fit.
Linear RMSThe RMS residual of the linear fit alone.
SIP RMSThe RMS residual with the distortion terms.
Weighted SIP RMSThe same, with each star weighted by the precision of its centroid.
ImprovementHow much the distortion terms reduced the RMS.

Without distortion terms, the last four lines are replaced by RMS error and Weighted RMS.

Pixel coordinates

The report, the FITS header and the library put the first pixel at different coordinates:

WhereCenter of the first pixel
The report(0.5, 0.5): the outer corner of the first pixel is (0, 0)
The FITS header (CRPIX1, CRPIX2)(1, 1)
SolveResult::pixel_to_sky and sky_to_pixel(0, 0)

The M106 report puts the projection origin at (1164.5, 880.5). The same point is CRPIX (1165, 881) in the FITS header and (1164, 880) in the library.

What --output writes

The output is a copy of the input with its old WCS keywords removed and the new solution added:

  • CTYPE1/CTYPE2 (RA---TAN-SIP and DEC--TAN-SIP with distortion terms, RA---TAN and DEC--TAN without), CUNIT1/CUNIT2, CRPIX1/CRPIX2, CRVAL1/CRVAL2, the CD1_1 to CD2_2 matrix and LATPOLE.
  • With distortion terms, A_ORDER, B_ORDER and the A_p_q and B_p_q coefficients, plus the inverse AP_ORDER, BP_ORDER, AP_p_q and BP_p_q coefficients for mapping sky to pixel.
  • RADESYS = 'ICRS'.

Other keywords, including EQUINOX and EPOCH, are kept. An XISF output also gets the solution as PCL:AstrometricSolution properties, with a spline fitted through the matched stars, when there are at least 5 of them.

Debug images

--debug DIR writes two PNG files, with the image stretched so faint stars show:

  • detections.png circles every detected star: green when it was matched to a catalog star, amber when it wasn’t.
  • solve.png marks each matched catalog star with a cyan cross, and draws a magenta line from the detected star along its residual, stretched 20 times. The residuals are those of the linear fit.