Skip to content

Nearby Solving

Jussi Saarivirta edited this page Jan 18, 2022 · 16 revisions

In nearby solves we already have a good idea what the center coordinate of our image is, but still it may be off by several degrees or so. So the nearby solving will scan the nearby areas for possible matches, if a match is not immediately found from the provided center coordinates.

We assume that we have a fair idea of the image's field radius. The better the idea and the less we need to guess, the faster the solve process will be.

There are two ways to provide the parameters to the solver in nearby mode: manually or from FITS headers.

Manual parameters

When we do not have a FITS file, there are no FITS headers to dig the coordinates from and the solver needs manual input. Minimum parameters example:

watney-solve nearby --image andromeda.png --manual --ra "00 41 02" --dec "41 07 50" --field-radius 2 --search-radius 10

You may also just run watney-solve nearby to get the list of available parameters.

For reference, the parameters available in watney-solve at the time of writing are:

Parameter Description
-m, --manual Specifies that the center is provided using --ra and --dec parameters and scope radius in --field-radius.
-r, --ra The search center in RA coordinate (either decimal or hours minutes seconds).
-d, --dec The search center in Dec coordinate (either decimal or degrees minutes seconds).
-f, --field-radius The (telescope) field radius (in degrees) to use. Mutually exclusive with the --field-radius-range parameter. Value should be between 0.1 .. 16.
-g, --field-radius-range The (telescope) field radius (in degrees) to use as a min-max range. Separate the values with a dash, e.g. '4-2.5'. The order of those two values does not matter. If this argument is set, it will override --field-radius. Range should be set between 0.1 .. 16.
-n, --field-radius-steps (Default: 0) How many intermediate steps to use between min-max when trying out field radii when --field-radius-range argument is given, otherwise this value will be ignored. If given the parameter 'auto', the number of intermediate steps will be auto-generated: the tried field radius value will be halved until minimum value is reached. If not given, defaults to 0.
-h, --use-fits-headers Specifies that the assumed center and field radius is provided by the file FITS headers. Will result in an error if the input file is not FITS or it does not contain the required FITS headers.
-s, --search-radius Required. The search radius (deg), the solver search will cover this area around the center coordinate.
-p, --use-parallelism (Default: false) Use parallelism, search multiple areas simultaneously.
-i, --image Required. The image file to solve.
--out-format (Default: json) Output format. Valid values are 'json', 'tsv'.
-o, --out Output file. If not set, output will be printed to stdout.
-w, --wcs Output filename for WCS coordinates. If given, a FITS file containing WCS headers will be produced.
-x, --lower-density-offset (Default: 1) Include this many lower quad density passes in search (compared to image quad density).
-z, --higher-density-offset (Default: 1) Include this many higher quad density passes in search (compared to image quad density).
--max-stars (Default: 0) Maximum number of stars to use from the image. When not given, the solver decides itself. When given, the solver uses this number. In cases of very high star count present in the image (wide-field images), the solve may fail if this number is not set high enough. A low number of stars will speed up the solve, since it means less calculations are required, but there's a bigger chance that the solve will fail. 300 is generally a good value.A high number (> 1000) will however also affect performance due to the high number of calculations, and this gets especially noticeable with blind solves.
--sampling (Default: 0) Try to solve the field using a sampled set of database quads first. With sampling, we try to match the image's star quads to only a fraction of the available database quads at a time, effectively making the search faster. The idea is that even if we can't find a solution (enough matching quads), we still get potential matching areas with one or more matching quad, which we can then scan with a full set of database quads to get the answer faster. Less work is performed in scanning, which makes it faster. Recommended (and default) value to use is 4 but some images may well solve faster with higher values. Too high values will however result in time wasted in scanning and making the solve actually slower.
--extended (Default: false) Produce extended output. This will print out a lot of additional detail about the solve.
--log-stdout (Default: false) Verbose logging. If true, will log a lot of additional lines to stdout.
--log-file Verbose logging. Give a filename to print verbose log lines into a file.
--use-config Path to configuration file. By default tries to load watney-solve-config.yml in the same directory where the solver is.

Use FITS headers

When solving FITS files, we may use the --use-fits-headers to provide us the field radius and the assumed center coordinate. Example:

watney-solve nearby --image andromeda.fits --use-fits-headers --search-radius 10

The FITS reader will try to read coordinates from RA, DEC, RA_OBJ, DEC_OBJ, OBJCTRA, OBJCTDEC, and also determine the field size from PIXSIZEn, XBINNING, YBINNING and FOCALLEN. If those records are found, the header information can be used.

Note that you can still just as well use manual coordinates with FITS files.

The output

The standard output (non-extended) as JSON looks like:

{
  "success": true,
  "ra": 10.699383363408096,
  "dec": 41.233739193910566,
  "fieldRadius": 1.9419199703800536,
  "orientation": 118.30302117174008,
  "pixScale": 2.398400722425611
}

Where:

  • success: true or false
  • ra: the RA coordinate as decimal degrees
  • dec: the Dec coordinate as decimal degrees
  • fieldRadius: the field radius in degrees (imagine a circle drawn around the image's widest corners)
  • orientation: the field orientation in degrees
  • pixScale: pixel scale, in arc seconds per pixel

The TSV output is plain key-value strings, with key and value separated by a tab character ('\t'):

success true
ra      10.699383363408096
dec     41.233739193910566
fieldRadius     1.9419199703800536
orientation     118.30302117174008
pixScale        2.398400722425611

The extended output (--extended flag) gives out some more information:

{
  "success": true,
  "ra": 10.699383363408094,
  "dec": 41.233739193910566,
  "fieldRadius": 1.9419199703800565,
  "orientation": 118.30302117174008,
  "pixScale": 2.3984007224256145,
  "timeSpent": "00:00:00.5028904",
  "searchIterations": 1,
  "searchRunCenter": "[10.25, 41.128055555555555]",
  "searchRunRadius": 2.0,
  "quadMatches": 108,
  "fieldWidth": 3.097934266466419,
  "fieldHeight": 2.3424380389023503,
  "fits_cd1_1": -0.0003157366622118217,
  "fits_cd1_2": 0.0005867266726920985,
  "fits_cd2_1": -0.0005864879715460347,
  "fits_cd2_2": -0.00031595967211472953,
  "fits_cdelt1": 0.0006660764075035569,
  "fits_cdelt2": 0.0006663923040155763,
  "fits_crota1": 118.30302117174008,
  "fits_crota2": 118.29586663465102,
  "fits_crpix1": 2325.0554679307497,
  "fits_crpix2": 1758.1229364862065,
  "fits_crval1": 10.699455989783395,
  "fits_crval2": 41.23366782000766
}
  • timeSpent: time spent on the solve
  • searchIterations: how many areas were searched
  • searchRunCenter: the center coordinate of the search run that produced the result
  • searchRunRadius: the field radius that was used in the above search run
  • quadMatches: how many star quads matched
  • fieldWidth: the width of the field, in degrees
  • fieldHeight: the height of the field, in degrees
  • fits_cd1_1 .. fits_cd2_2: for FITS, rotation and scale matrix
  • fits_cdelt1..2: for FITS, coordinate increment along axis n
  • fits_crota1..2: for FITS, coordinate system rotation angle
  • fits_crpix1..2: for FITS, pixel coordinates of the reference point to which the projection and the rotation refer
  • fits_crval1..2: for FITS, the center coordinate as right ascension and declination or longitude and latitude in decimal degrees

Additionally, the WCS file (an empty FITS file) that contains the WCS headers can be saved using the --wcs <filename> parameter.

How it works

The technicality is described in more detail in NearbySearchStrategy.