8.2 Practical Tutorials

This section provides a summary of each notebook to help identify which example will be useful for specific issues and science goals.

Improving Astrometry Using Alternate WCS Solutions

As mentioned in Chapter 1 and discussed in detail in Chapter 4, a new type of astrometry for HST images has been adopted as of December 2019 as part of an effort to automatically align to Gaia. This notebook guides users through the new features available in images from MAST including headerlets and provides code to change between the various world coordinate solutions (WCS), to evaluate the image alignment of a given WCS, and to change the WCS of a drizzled image. For those who need to learn about and manipulate the new MAST astrometry, this notebook is an ideal place to start and should answer most common questions.

Aligning HST Images to an Absolute Reference Catalog

This notebook details a workflow that will align HST images to an external catalog, which can be useful for many science applications, especially when absolute astrometry is necessary. The example uses WFC3/UVIS images of NGC 6791 and walks through downloading the HST images and catalogs (e.g. SDSS or Gaia) with astroquery, using TweakReg to align to the catalog positions, and then creating a final drizzled image with AstroDrizzle.

Aligning Multiple HST Visits

This notebook contains an example of aligning images from multiple visits. In this case, three ACS/WFC images of the globular cluster NGC 104 taken over a three month period with different telescope orientations are downloaded programmatically from the MAST archive, aligned with TweakReg, and then processed by AstroDrizzle into a combined image. The notebook also defines different TweakReg parameters and shows how to optimize them, and explains the outputs of AstroDrizzle and how to use them to evaluate the final image.

Aligning Deep Exposures of Sparse Fields

This notebook discusses one way to align deep exposures of sparse fields that is helpful when there are more cosmic rays or other artifacts than point sources in a given field. This example uses four ACS/WFC images from the COSMOS 2-Degree ACS Survey and describes several key parameter changes to the photometry code in TweakReg that detects the sources necessary to align images. These modifications to the source detection can help exclude the spurious detections from cosmic rays and include small compact sources like background galaxies, which enables the alignment of the images. The final combined image from AstroDrizzle is then evaluated.

Creating HST Mosaics Observed with Multiple Detectors

The Aligning Mosaics notebook walks through a reduction of the Eagle Nebula (M16) with both UVIS and IR images from WFC3, although the theory also works for ACS/WFC images. It explains the observation strategy and the dither patterns used, and will programmatically download the data from the MAST archive. The notebook explains manipulating TweakReg parameters to better align images and how to evaluate and troubleshoot the resulting solution. Then it discusses features in AstroDrizzle to use when combining images into a mosaic and the procedure for combining multiple filters.

If the full notebook is run, it will produce a complete mosaic image of the Eagle Nebula with HST WFC3 images.

Using Sky Matching Features for HST Mosaics

This notebook explains the four options available in AstroDrizzle to match the sky background between images when creating a larger mosaic. It downloads WFC3/IR images of the Horsehead Nebula and describes how the images are combined, applies each of the four sky background methods, and then compares the results, providing recommendations about how to get the best image.

At the end of the notebook, a mosaic image of the Horsehead Nebula will be produced.

Optimizing the Image Sampling for Sub-pixel Dithers

This example walks through the process of recovering some of the information lost in undersampled images with AstroDrizzle. WFC3/IR images of NGC 3370 are downloaded and then drizzled with various scale and pixel fraction parameters. The results are evaluated to determine the optimized parameters, balancing between the extremes of failing to recover information by remaining undersampled and degrading the combined image by introducing noise. This type of analysis is especially beneficial for the lower resolution of WFC3/IR images, but can be used any time proper dithering is performed.

Drizzling New WFPC2 FLT Data Products

This notebook shows how to work with a new type of WFPC2 calibrated data product in MAST. The new products combine the previously separate files containing the science array c0m.fits and data quality array c1m.fits into a new file with suffix flt.fits, similar to calibrated images for ACS and WFC3. These flt files have now been corrected for differences in the inverse sensitivity the science arrays of each chip using the software 'photeq' so that a single PHOTFLAM (or PHOTFNU) value may be used for photometry.  This means that the SCI arrays from different chips may now be drizzled together in a mosaic. Additionally, the header WCS now includes improved absolute astrometry by aligning to Gaia, when possible.

This example uses observations of Omega Centauri (NGC 5139), where two exposures have been dithered to place the same stars on the WF2 and WF4 chips to measure relative photometry across the two chips. After using TweakReg to realign the images, we show how to combine the images with AstroDrizzle.

Masking Satellite Trails Prior to Drizzling

This notebook explains how to mask satellite trails, which are a common artifact in HST images. Images of galaxy cluster MACSJ0717.5+3745 from the Hubble Frontier Fields, chosen because they contain satellite trails, are downloaded and used to demonstrate two techniques: 1) An automated tool developed by the ACS team to find and mask satellite trails in the DQ array, and 2) manually identifying image artifacts with DS9 region files and using the regions to mask the DQ array. The first technique is often quicker due to the automation, but the second allows for more control and for masking other types of image artifacts, such as dragon's breath and blooming. When the DQ arrays are appropriately masked, AstroDrizzle knows to avoid those pixels when creating the combined image, leading to a final result that is not impacted by the satellite trails.

Using DS9 Region Files in TweakReg

This example explains how to use DS9 region files to include and exclude sources in TweakReg's internal source detection photometry. The notebook first demonstrates how to download two specific ACS/WFC images of MACSJ1149.5+2223-HFFPAR without having to download the entire association, creates source lists with TweakReg, and explains the format of DS9 region files and how to read them using Python. The notebook walks through writing exclusion and inclusion text files with their unique and very particular formatting so that TweakReg can utilize the DS9 region files. The regions can exclude areas of the image from TweakReg, which can be useful to remove galaxy centers or objects that are not point sources from the source list. They can also be used to include, so that only the sources inside the DS9 regions are used by TweakReg. Lastly, the exclusion and inclusion functions can be combined to give complete control over which areas of the images are in the source list, although care should be taken with this as the formatting is not straightforward. Examples of the DS9 region files and the exclusion files used by TweakReg are provided in the repository.

The introduction of this notebook includes a brief explanation of DS9 and its region files, including some resources for those unfamiliar with this tool.