punchbowl.level1.alignment_parallel#

Functions#

refine_pointing_single_step(→ astropy.wcs.WCS)

Perform a single step of pointing refinement.

_residual(→ float)

Residual used when optimizing the pointing.

get_errors(→ tuple[numpy.ndarray, numpy.ndarray])

Compute errors between expected and observed star locations.

extract_crota_from_wcs(→ tuple[float, float])

Extract CROTA from a WCS.

Module Contents#

punchbowl.level1.alignment_parallel.refine_pointing_single_step(guess_wcs: astropy.wcs.WCS, observed_tree: scipy.spatial.KDTree, catalog_stars: astropy.coordinates.SkyCoord, method: str = 'least_squares', ra_tolerance: float = 10, dec_tolerance: float = 5, fix_crval: bool = False, fix_crota: bool = False, fix_pv: bool = True) astropy.wcs.WCS[source]#

Perform a single step of pointing refinement.

Parameters:
  • guess_wcs (WCS) – the initial guess for the world coordinate system

  • observed_tree (KDTree) – coordinates of the observed star positions extracted from the image, as a tree

  • catalog_stars (SkyCoord) – the coordinates of known stars to be matched with the observed stars

  • method (str) – method used by lmfit for minimization

  • ra_tolerance (float) – how many degrees the guess WCS is allowed to be incorrect by in right ascension

  • dec_tolerance (float) – how many degrees the guess WCS is allowed to be incorrect by in declination

  • fix_crval (bool) – if True the crval is not allowed to vary, otherwise it can be fit

  • fix_crota (bool) – if True the crota is not allowed to vary, otherwise it can be fit

  • fix_pv (bool) – if True the pv is not allowed to vary, otherwise it can be fit

Returns:

the new world coordinate system

Return type:

WCS

punchbowl.level1.alignment_parallel._residual(params: lmfit.Parameters, ra: numpy.ndarray, dec: numpy.ndarray, observed_tree: scipy.spatial.KDTree, guess_wcs: astropy.wcs.WCS, max_error: float = 30) float[source]#

Residual used when optimizing the pointing.

Parameters:
  • params (Parameters) – optimization parameters from lmfit

  • ra (np.ndarray) – expected coordinates of the stars, in degrees

  • dec (np.ndarray) – expected coordinates of the stars, in degrees

  • observed_tree (KDTree) – a KDTree of the pixel coordinates of the observed stars

  • guess_wcs (WCS) – initial guess of the world coordinate system, must overlap with the true WCS

  • max_error (float) – stars more distant than this are complete misses, and their error is zeroed out

Returns:

residual

Return type:

np.ndarray

punchbowl.level1.alignment_parallel.get_errors(wcs: astropy.wcs.WCS, catalog_stars: astropy.coordinates.SkyCoord | tuple[numpy.ndarray, numpy.ndarray], observed_stars: numpy.ndarray | scipy.spatial.KDTree, catalog_stars_in_pixels: bool = True) tuple[numpy.ndarray, numpy.ndarray][source]#

Compute errors between expected and observed star locations.

punchbowl.level1.alignment_parallel.extract_crota_from_wcs(wcs: astropy.wcs.WCS) tuple[float, float][source]#

Extract CROTA from a WCS.