SkyLine (chip outline on the sky) management for image mosaic
This module provides support for working with footprints on the sky. Primary use case would use the following generalized steps:
Initialize
SkyLineobjects for each input image. This object would be the union of all the input image’s individual chips WCS footprints.Determine overlap between all images. The determination would employ a recursive operation to return the extended list of all overlap values computed as [img1 vs [img2,img3,…,imgN],img2 vs [img3,…,imgN],…]
Select the pair with the largest overlap, or the pair which produces the largest overlap with the first input image. This defines the initial reference
SkyLineobject.Perform some operation on the 2 images: for example, match sky in intersecting regions, or aligning second image with the first (reference) image.
Update the second image, either apply the sky value or correct the WCS, then generate a new
SkyLineobject for that image.Create a new reference
SkyLineobject as the union of the initial reference object and the newly updatedSkyLineobject.Repeat Steps 2-6 for all remaining input images.
This process will work reasonably fast as most operations
are performed using the SkyLine objects and WCS information
solely, not image data itself.
- Authors:
Mihai Cara, Warren Hack, Pey-Lian Lim
- License:
- class stsci.skypac.skyline.SkyLine(mlist)[source]
Manage outlines on the sky.
Skylines are designed to capture and manipulate HST WCS image information as spherical polygons. They are represented by the
SkyLineclass, which is an extension ofSphericalPolygonclass.Each skyline has a list of members,
members, and a composite spherical polygon,polygon, members. The polygon has all the functionalities ofSphericalPolygon.Each
SkyLinehas a list ofmembersand a compositepolygonwith all the functionalities ofSphericalPolygon.Each member in
membersbelongs to theSkyLineMemberclass, which contains image name (with path if given), science extension(s), and composite WCS and polygon of the extension(s). All skylines start out with a single member from a single image. When operations are used to find composite or intersecting skylines, the resulting skyline can have multiple members.For example, a skyline from an ACS/WFC full-frame image would give 1 member, which is a composite of extensions 1 and 4. A skyline from the union of 2 such images would have 2 members, and so forth.
- Parameters:
- add_image(other)[source]
Return a new
SkyLinethat is the union of self and other.- Parameters:
- other: `SkyLine` object
Examples
>>> s1 = SkyLine('image1.fits') >>> s2 = SkyLine('image2.fits') >>> s3 = s1.add_image(s2)
- find_intersection(other)[source]
Return a new
SkyLinethat is the intersection of self and other.- Parameters:
- other: `SkyLine` object
Examples
>>> s1 = SkyLine('image1.fits') >>> s2 = SkyLine('image2.fits') >>> s3 = s1.find_intersection(s2)
- find_max_overlap(skylines)[source]
Find
SkyLinefrom a list of skylines that overlaps the most with self.
- property is_mf_mosaic
returns True if
SkyLinemembers are from distinct image files (multi-file mosaic) and False otherwise.
- property members
List of
SkyLineMemberobjects that belong to self. Duplicate members are discarded. Members are kept in the order of their additions to self.
- class stsci.skypac.skyline.SkyLineMember(image, ext, dq_bits=0, dqimage=None, dqext=None, usermask=None, usermask_ext=None)[source]
Container for
SkyLinemembers that holds information about properties of a single extension (chip) in a FITS image such as:WCS of the chip image;
bounding spherical polygon;
file name and extension from which the chip’s image has originated;
information required for unit conversions (
EXPTIME,PHOTFLAM,BUNIT, etc.);user mask and DQ array associated with chip’s image data.
- Parameters:
- image: ImageRef
An
ImageRefobject that refers to an open FITS file- ext: tuple, int, str
Extension specification in the
imagetheSkyLineMemberobject will be associated with.An int
extspecifies extension number. A tuple in the form (str, int) specifies extension name and number. A stringextspecifies extension name and the extension version is assumed to be 1. See documentation forastropy.io.fits.getDatafor examples.- dq_bits: int, None (Default = 0)
Integer sum of all the DQ bit values from the input
image’s DQ array that should be considered “good” when building masks for sky computations. For example, if pixels in the DQ array can be combinations of 1, 2, 4, and 8 flags and one wants to consider DQ “defects” having flags 2 and 4 as being acceptable for sky computations, thendq_bitsshould be set to 2+4=6. Then a DQ pixel having values 2,4, or 6 will be considered a good pixel, while a DQ pixel with a value, e.g., 1+2=3, 4+8=12, etc. will be flagged as a “bad” pixel.Default value (0) will make all non-zero pixels in the DQ mask to be considered “bad” pixels, and the corresponding image pixels will not be used for sky computations.Setdq_bitstoNoneto turn off the use of image’s DQ array for sky computations.Note
DQ masks (if used), will be combined with user masks specified by the
usermaskparameter.- dqimage: ImageRef
An
ImageRefobject that refers to an open FITS file that has DQ data of the inputimage.- dqext: tuple, int, str
Extension specification of the
dqimagethat containsimage’s DQ information. See help forextfor more details on acceptable formats for this parameter.- usermask: ImageRef
An
ImageRefobject that refers to an open FITS file that has user mask data that indicate what pixels in the inputimageshould be used for sky computations (1) and which pixels should not be used for sky computations (0).- usermask_ext: tuple, int, str
Extension specification of the
usermaskmask file that contains user’s mask data that should be associated with the inputimageandext. See help forextfor more details on acceptable formats for this parameter.