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_classinstance which performs most of the work. See theImageclass for more information.Parameters: filename : str
FITS file to open and build an
image_classinstance from.Returns: image_classinstanceRaises: None
-
-
class
donuts.image.Image(data, header=None)[source]¶ Low level class which handles the image transformations and cross correlation with another
Imageclass.-
compute_offset(reference_image)[source]¶ Given another
Imageobject, compute the shift in pixel units.This method sets
self.xandself.yto the pixel shift, and returns the instance so in effect the user gets a “new”Imageinstance with these variables set.Parameters: reference_image :
ImageThe reference image to compare to. Typically when called using the
Donutsclass this will be whatever was defined as the “reference” imageReturns
——-
self :
ImageThe current
ImageinstanceRaises: 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 :
ImageThe current
ImageinstanceRaises: 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 :
ImageThe current
ImageinstanceRaises: 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 :
ImageThe current
ImageinstanceRaises: 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
nrows/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_widthcolumns from the image, assuming the are not in the imaging region.overscan_width : int
Remove the last
overscan_widthcolumns 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
borderrows/columns from the image, assuming that they are not “typical”, a common case with edge effects in CCDs.Returns: self :
ImageThe current
ImageinstanceRaises: None
-