gavo.helpers.anet module

Code to obtain WCS headers for FITS files using has oodles of configurable parameters. Some of them can be passed in via the solverParameters argument to getWCSFieldsFor, a dictionary with keys including:


(default: “index-*.fits”, meaning all indices in your default index dir) The file names from anet’s index directory you want to have used. glob patterns are expanded, but no recursion takes place.

This could be something like:

["index-4211.fits", "index-4210.fits", "index-4209.fits"]

for largeish images or:

["index-4203-*.fits", "index-4202-*.fits"]

for small ones. You can also give absolute path names for custom indices that live, e.g., in your resource directory.


(defaults to 600) – number of seconds after which the anet run should cancel itself.


(defaults to True) – try to obtain a polynomic correction to the entire image after obtaining a solution? This can go wrong in particular for exposures with many objects, so you might want to set it to off for such cases.


(default to 1) – FITS extension to work on


(defaults to not given) – last object to be processed. You don’t want to raise this too high. The library will only pass on 10 objects at a time anyway, but going too high here will waste lots of time on images that are probably not going to resolve anyway.


(defaults to not given) – smallest permissible pixel size in arcsecs. If at all possible, constrain this for much better results.


(defaults to not given) – largest permissible pixel size in arcsecs. See lower_pix.


(defaults to False) – generate all kinds of pretty plots?


(defaults to not given) – factor to downsample the image before trying to solve. This may be necessary when not using source-extractor, and it should be something like 2, 3, or 4.

exception gavo.helpers.anet.Error(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

exception gavo.helpers.anet.NotSolved(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

exception gavo.helpers.anet.ObjectNotFound(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

exception gavo.helpers.anet.ShellCommandFailed(msg, retcode)[source]

Bases: Error

gavo.helpers.anet.getWCSFieldsFor(fName, solverParameters, sourceExtractorControl, objectFilter, copyTo, indexPath, verbose)[source]

returns a pyfits cardlist for the WCS fields on fName.

solverParameters is a dictionary mapping solver keys to their values, sourceExtractorControl is a script for source-extractor, and its presence means that source-extractor should be used for source extraction rather than what anet has built in. objectFilter is a function that is called with the name of the FITS with the extracted sources. It can remove or add sources to that file before tries to match.

To see what solverParameters are available, check the module docstring.