SkyImage

class stcal.skymatch.skyimage.SkyImage(image, mask, wcs_fwd, wcs_inv, skystat, sky_id=None, stepsize=None, meta=None)[source]

Bases: object

Container that holds information about properties of a single image.

Including:

  • image data;

  • WCS of the chip image;

  • bounding spherical polygon;

  • id;

  • pixel area;

  • sky background value;

  • sky statistics parameters;

  • mask associated image data indicating “good” (1) data.

Initialize the SkyImage object.

Parameters:
  • image (numpy.ndarray) – A 2D array of image data.

  • mask (numpy.ndarray) – A 2D array that indicates which pixels in the input image should be used for sky computations (1) and which pixels should not be used for sky computations (0).

  • wcs_fwd (collections.abc.Callable) – “forward” pixel-to-world transformation function.

  • wcs_inv (collections.abc.Callable) – “inverse” world-to-pixel transformation function.

  • skystat (collections.abc.Callable, None, optional) – A callable object that takes a either a 2D image (2D numpy.ndarray) or a list of pixel values (a Nx1 array) and returns a tuple of two values: some statistics (e.g., mean, median, etc.) and number of pixels/values from the input image used in computing that statistics.

  • sky_id (Any) – The value of this parameter is simple stored within the SkyImage object. While it can be of any type, it is preferable that id be of a type with nice string representation.

  • stepsize (int, None, optional) – Spacing between vertices of the image’s bounding polygon. Default value of None creates bounding polygons with four vertices corresponding to the corners of the image.

  • meta (dict, None, optional) – A dictionary of various items to be stored within the SkyImage object.

Methods Summary

calc_sky([overlap, delta])

Compute sky background value.

intersection(skyimage)

Compute intersection.

Methods Documentation

calc_sky(overlap=None, delta=True)[source]

Compute sky background value.

Parameters:
  • overlap (SkyImage, SkyGroup, None, optional) – This parameter is used to indicate that sky statistics should computed only in the region of intersection of this image with the SkyImage or SkyGroup indicated by overlap. When overlap is None, sky statistics will be computed over the entire image.

  • delta (bool, optional) – Should this function return absolute sky value or the difference between the computed value and the value of the sky stored in the sky property.

Returns:

  • skyval (float, None) – Computed sky value (absolute or relative to the sky attribute). If there are no valid data to perform this computations (e.g., because this image does not overlap with the image indicated by overlap), skyval will be set to None.

  • npix (int) – Number of pixels used to compute sky statistics.

  • polyarea (float) – Area (in srad) of the polygon that bounds data used to compute sky statistics.

intersection(skyimage)[source]

Compute intersection.

Compute intersection of this SkyImage object and another SkyImage or SkyGroup object.

Parameters:

skyimage (SkyImage, SkyGroup) – Another object that should be intersected with this SkyImage.

Returns:

polygon – A SphericalPolygon that is the intersection of this SkyImage and skyimage.

Return type:

SphericalPolygon