Module: wcs_utils#
A collection of utility functions for working with WCS in KBMOD.
- kbmod.wcs_utils.append_wcs_to_hdu_header(wcs, header)[source]#
Append the WCS fields to an existing HDU header.
- Parameters:
- wcsastropy.wcs.WCS or dict
The WCS to use or a dictionary with the necessary information.
- headerastropy.io.fits.Header
The header to which to append the data.
- kbmod.wcs_utils.calc_ecliptic_angle(wcs, center_pixel=(1000, 2000), step=12)[source]#
Projects an unit-vector parallel with the ecliptic onto the image and calculates the angle of the projected unit-vector in the pixel space.
- Parameters:
- wcs
astropy.wcs.WCS
World Coordinate System object.
- center_pixeltuple, array-like
Pixel coordinates of image center.
- step
float
orint
Size of step, in arcseconds, used to find the pixel coordinates of the second pixel in the image parallel to the ecliptic.
- wcs
- Returns:
- suggested_angle
float
Angle the projected unit-vector parallel to the eclipticc closes with the image axes. Used to transform the specified search angles, with respect to the ecliptic, to search angles within the image.
- suggested_angle
Notes
It is not neccessary to calculate this angle for each image in an image set if they have all been warped to a common WCS.
- kbmod.wcs_utils.deserialize_wcs(wcs_str)[source]#
Convert a JSON string into a WCS object.
- Parameters:
- wcs_strstr
The serialized WCS.
- Returns:
- wcsastropy.wcs.WCS or None
The resulting WCS or None if no data is provided.
- kbmod.wcs_utils.extract_wcs_from_hdu_header(header)[source]#
Read an WCS from the an HDU header and do basic validity checking.
- Parameters:
- headerastropy.io.fits.Header
The header from which to read the data.
- Returns:
- curr_wcsastropy.wcs.WCS
The WCS or None if it does not exist.
- kbmod.wcs_utils.make_fake_wcs(center_ra, center_dec, height, width, deg_per_pixel=None)[source]#
Create a fake WCS given basic information. This is not a realistic WCS in terms of astronomy, but can provide a place holder for many tests.
- Parameters:
- center_rafloat
The center of the pointing in RA (degrees)
- center_devfloat
The center of the pointing in DEC (degrees)
- heightint
The image height (pixels).
- widthint
The image width (pixels).
- deg_per_pixelfloat, optional
The angular resolution of a pixel (degrees).
- Returns:
- resultastropy.wcs.WCS
The resulting WCS.