API¶
-
class
donuts.
Donuts
(refimage, image_ext=0, exposure='EXPTIME', normalise=True, subtract_bkg=True, prescan_width=0, overscan_width=0, scan_direction='x', border=64, ntiles=32, image_class=<class 'donuts.image.Image'>)[source]¶ This class provides methods for measuring shifts between a series of images of the same star field. First we initialise the object and generate a reference image. Subsequent images are aligned to this frame of this reference image.
Attributes
None Initialise and generate a reference image. This reference image is used for measuring frame to frame offsets.
Parameters: refimage : str
The image representing the reference frame.
image_ext: int, optional
The fits image extension to extract. The default is 0.
exposure : str, optional
Fits header keyword for exposure time. The default is
EXPTIME
.normalise : bool, optional
Convert image counts to counts/s. The default is True.
subtract_bkg : bool, optional
Subtract the sky background. The default is True.
prescan_width : int, optional
Width of prescan region (left) in pixels. The default is 0.
overscan_width : int, optional
Width of overscan region (right) in pixels. The default is 0.
scan_direction : str, optional
Direction along which the pre/overscan regions are found (‘x’ | ‘y’)
border : int, optional
Width of exclusion area to avoid errors from CCD edge effects. The default is 64.
ntiles : int, optional
Number of tiles used to sample the sky background. The default is 32.
Returns: None
Raises: None
-
construct_object
(filename)[source]¶ Builds an
image_class
instance which performs most of the work. See theImage
class for more information.Parameters: filename : str
FITS file to open and build an
image_class
instance from.Returns: image_class
instanceRaises: None
-
-
class
donuts.image.
Image
(data, header=None)[source]¶ Low level class which handles the image transformations and cross correlation with another
Image
class.-
compute_offset
(reference_image)[source]¶ Given another
Image
object, compute the shift in pixel units.This method sets
self.x
andself.y
to the pixel shift, and returns the instance so in effect the user gets a “new”Image
instance with these variables set.Parameters: reference_image :
Image
The reference image to compare to. Typically when called using the
Donuts
class this will be whatever was defined as the “reference” imageReturns
——-
self :
Image
The current
Image
instanceRaises: None
-
compute_projections
()[source]¶ Compute the projection profiles. Follows the following logic:
- if the image has not been trimmed and not background subtracted, then use the raw pixels
- otherwise if the image has been trimmed then use the trimmed pixels
- otherwise use the background subtracted pixels
See
_projection_from_image()
for details of the projection calculation.Parameters: None
Returns: self :
Image
The current
Image
instanceRaises: None
-
normalise
(exposure_keyword='EXPOSURE')[source]¶ Convert the image data into ADU per second
Parameters: exposure_keyword : str
Fits header keyword for exposure time. The default is
EXPTIME
.Returns: self :
Image
The current
Image
instanceRaises: RuntimeError if the image region has not been trimmed (see the ``trim``
method).
-
postconstruct_hook
()[source]¶ Hook to modify the class after any standard processing
To add functionality, alter
backsub_region()
-
preconstruct_hook
()[source]¶ Hook to modify the class before any standard processing
To add functionality, alter
raw_image()
-
remove_background
(ntiles=32)[source]¶ Subtract the background from the image. See
_generate_bkg_map()
for more detailsParameters: ntiles : int
Number of tiles used to sample the sky background. The default is 32.
Returns: self :
Image
The current
Image
instanceRaises: None
-
trim
(prescan_width=0, overscan_width=0, scan_direction='x', border=64)[source]¶ Remove the optional prescan and overscan from the image, as well as the outer
n
rows/colums of the image. Finally ensure the imaging region is the correct dimensions forskimage.transform.resize()
(i.e. a multiple of 16.)Parameters: prescan_width : int
Remove the first
prescan_width
columns from the image, assuming the are not in the imaging region.overscan_width : int
Remove the last
overscan_width
columns from the image, assuming the are not in the imaging region.scan_direction : ‘x’ | ‘y’
Direction along which the pre/overscans occur. If along left and right side, select ‘x’. If along the top and bottom of the image select ‘y’
border : int
Ignore the first/last
border
rows/columns from the image, assuming that they are not “typical”, a common case with edge effects in CCDs.Returns: self :
Image
The current
Image
instanceRaises: None
-