Skip to content

Updating links and DQ bits in Drizzlepac Notebooks #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notebooks/DrizzlePac/align_mosaics/align_mosaics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The expected pointing accuracy for various observing scenerios is summarized in the DrizzlePac Handbook [Appendix B](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/AppendixB2.html). Exposures making up visit-level drizzled products are typically aligned to 2-5 milliarcsecond (mas) accuracy with fine-lock on 2 guide stars. The shift file above confirms this, with offsets (dx,dy) between pairs of exposures in the same visit visit averaging ~0.05 IR pixels (6 mas). For different visits using the same set of guide stars, offsets of ~50-100 mas (0.6-1.2 IR pixels are expected. For visits with different sets of guide stars, the pointing accuracy is typically 0.2-0.5 arcseconds. \n",
"The expected pointing accuracy for various observing scenerios is summarized in the DrizzlePac Handbook [Appendix B](http://www.stsci.edu/files/live/sites/www/files/home/scientific-community/software/drizzlepac/_documents/drizzlepac-handbook.pdf). Exposures making up visit-level drizzled products are typically aligned to 2-5 milliarcsecond (mas) accuracy with fine-lock on 2 guide stars. The shift file above confirms this, with offsets (dx,dy) between pairs of exposures in the same visit visit averaging ~0.05 IR pixels (6 mas). For different visits using the same set of guide stars, offsets of ~50-100 mas (0.6-1.2 IR pixels are expected. For visits with different sets of guide stars, the pointing accuracy is typically 0.2-0.5 arcseconds. \n",
"\n",
"The cell below shows how to check the image header for the 'Dominant' and 'Secondary' guide stars used. Since the M16 tiles (visits) each used different guide star pairs, the relatively large offsets (>1 arcsec) required for visits 03 and 04 to match the visit 02 reference image are not surprising, though are larger than expected. Note that the TweakReg `searchrad` parameter was increased to 2.0\" from the default value of 1.0\" to allow TweakReg to find the correct fit for these visits."
]
Expand Down Expand Up @@ -941,7 +941,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"source": [
"## Introduction\n",
"\n",
"This notebook demonstrates how to use `TweakReg` and `AstroDrizzle` tasks to align and combine images. While this example focuses on ACS/WFC data, the procedure can be almost identically applied to WFC3/UVIS images. This notebook is based on [a prior example](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/ch75.html) from the 2012 [DrizzlePac Handbook](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/toc.html), but has been updated for compatibility with the STScI AstroConda software distribution. There is a good deal of explanatory text in this notebook, and users new to DrizzlePac are encouraged to start with this tutorial. Additional DrizzlePac software documentation is available at [the readthedocs webpage](https://drizzlepac.readthedocs.io).\n",
"This notebook demonstrates how to use `TweakReg` and `AstroDrizzle` tasks to align and combine images. While this example focuses on ACS/WFC data, the procedure can be almost identically applied to WFC3/UVIS images. This notebook is based on a prior example from the 2012 [DrizzlePac Handbook](http://www.stsci.edu/files/live/sites/www/files/home/scientific-community/software/drizzlepac/_documents/drizzlepac-handbook.pdf), but has been updated for compatibility with the STScI AstroConda software distribution. There is a good deal of explanatory text in this notebook, and users new to DrizzlePac are encouraged to start with this tutorial. Additional DrizzlePac software documentation is available at [the readthedocs webpage](https://drizzlepac.readthedocs.io).\n",
"\n",
"Before running the notebook, you will need to install the `astroquery` package, which is used to retrieve the data from the MAST archive and the `ccdproc` package which is used to query the image headers. \n",
"\n",
Expand Down Expand Up @@ -357,7 +357,7 @@
" \n",
"New distortion solutions, based on the latest Gaia DR2, are in the process of being derived by the ACS team, so observations retrieved from MAST at a later date may or may not show these systematic skew residuals. Fortunately, these can be corrected by allowing for a higher order `fitgeometry` as shown in the next test.\n",
"\n",
"More information about the distortion reference files used by `AstroDrizzle` may be found [here](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/ch33.html)."
"More information about the distortion reference files used by `AstroDrizzle` may be found [here](http://www.stsci.edu/files/live/sites/www/files/home/scientific-community/software/drizzlepac/_documents/drizzlepac-handbook.pdf)."
]
},
{
Expand Down Expand Up @@ -687,7 +687,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,9 @@
" build=False,\n",
" context=False,\n",
" skymethod='match',\n",
" driz_sep_bits='64, 32',\n",
" driz_sep_bits='64, 16',\n",
" combine_type='minmed',\n",
" final_bits='64, 32')"
" final_bits='64, 16')"
]
},
{
Expand Down Expand Up @@ -566,7 +566,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.6"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions notebooks/DrizzlePac/drizzle_wfpc2/drizzle_wfpc2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"\n",
"One approach is to rescale the input data so that `AstroDrizzle` can properly assume the images/chips have the same sensitivity; that is, a single `PHOTFLAM` value can be used to convert re-scaled image counts (or count-rates) to physical _integrated_ flux units. The `photeq` task in `Drizzlepac` automates this image intensity rescaling to a single inverse-sensitivity factor `PHOTFLAM`.\n",
"\n",
"In this example notebook, archival WFPC2 images are used to demonstrate advanced reprocessing using `TweakReg` and `AstroDrizzle` for alignment and image combination. The notebook is based on a prior WFPC2 [example](http://www.stsci.edu/hst/HST_overview/drizzlepac/examples/example7) but includes additional information about equalizing the chip sensitivities prior to combining. \n",
"In this example notebook, archival WFPC2 images are used to demonstrate advanced reprocessing using `TweakReg` and `AstroDrizzle` for alignment and image combination. The notebook is based on a prior WFPC2 example but includes additional information about equalizing the chip sensitivities prior to combining. \n",
"\n",
"**NOTE:** It is important to note that `photeq` only adjusts image counts so that _integrated_ physical fluxes can be obtained using a single `PHOTFLAM`. It does nothing to account for different throughtputs at different wavelengths."
]
Expand Down Expand Up @@ -105,7 +105,7 @@
"source": [
"## 2. Update the WCS\n",
"\n",
"WFPC2 images downloaded from the archive contain World Coordinate System (WCS) information based on an older-style description of image distortions. Before these images can be processed with `drizzlepac`, their WCS must be converted to a new format. This can be achieved using `updatewcs()` function from the `stwcs` package. More details may be found here: ['Making WFPC2 Images Compatible with AstroDrizzle'](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/ch45.html#601857). Note that `updatewcs` is no longer a parameter in AstroDrizzle or TweakReg and must be run separately before processing the data. \n",
"WFPC2 images downloaded from the archive contain World Coordinate System (WCS) information based on an older-style description of image distortions. Before these images can be processed with `drizzlepac`, their WCS must be converted to a new format. This can be achieved using `updatewcs()` function from the `stwcs` package. More details may be found here: ['Making WFPC2 Images Compatible with AstroDrizzle'](http://www.stsci.edu/files/live/sites/www/files/home/scientific-community/software/drizzlepac/_documents/drizzlepac-handbook.pdf). Note that `updatewcs` is no longer a parameter in AstroDrizzle or TweakReg and must be run separately before processing the data. \n",
"\n",
"First we download the reference files from the CRDS website. See the initialization notebook in this repository for more information. "
]
Expand Down Expand Up @@ -170,7 +170,7 @@
"source": [
"## 3. Align the Images\n",
"\n",
"Due to small pointing errors, the image header WCS typically needs to be updated in order to achieve the best drizzle-combined products. The expected pointing accuracy for various observing scenerios is summarized in the DrizzlePac Handbook [Appendix B](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/AppendixB2.html). Input images must first be aligned so that when the coordinates of a given object (in detector space) are converted to sky coordinates (using the WCS), that object's sky coordinates must be approximately equal in each frame. \n",
"Due to small pointing errors, the image header WCS typically needs to be updated in order to achieve the best drizzle-combined products. The expected pointing accuracy for various observing scenerios is summarized in the DrizzlePac Handbook [Appendix B](http://www.stsci.edu/files/live/sites/www/files/home/scientific-community/software/drizzlepac/_documents/drizzlepac-handbook.pdf). Input images must first be aligned so that when the coordinates of a given object (in detector space) are converted to sky coordinates (using the WCS), that object's sky coordinates must be approximately equal in each frame. \n",
"\n",
"The `DrizzlePac` task `TweakReg` may be used to correct for any errors in the image header WCS. First, `TweakReg` finds sources in each image, matches sources in common across images, and finds a separate linear transformation to align each image. `TweakReg` then computes a new WCS for each image based on this linear transformation.\n",
"\n",
Expand Down Expand Up @@ -444,7 +444,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.6"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions notebooks/DrizzlePac/mask_satellite/mask_satellite.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"\n",
"Assuming that the satellite trail was properly detected, masks can be made to flag the satellite in the data quality array (DQ) of the image. Once this information is in the DQ array, AstroDrizzle knows to ignore the flagged pixels when making the combined image. The function `update_dq` is used to flag pixels in the DQ array of SCI,2 (extension 6) using the default flag value of 16384. \n",
"\n",
"If the satellite were instead on the bottom chip (SCI,1 or extension 1), the `update_dq` function would instead be used to modify extension 3. More detail on the ACS file structure may be found in the [ACS Data Handbook](http://www.stsci.edu/hst/acs/documents/handbooks/currentDHB/acs_Ch23.html)."
"If the satellite were instead on the bottom chip (SCI,1 or extension 1), the `update_dq` function would instead be used to modify extension 3. More detail on the ACS file structure may be found in the [ACS Data Handbook](https://hst-docs.stsci.edu/display/ACSIHB/)."
]
},
{
Expand Down Expand Up @@ -357,7 +357,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.6"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"metadata": {},
"source": [
"## 3. Drizzling\n",
"Before drizzling can be performed, a plate scale for the output image should be chosen. This will usually be dictated by the science needs. In theory, critical sampling of a PSF occurs with 2.355 pixels. The FWHM of the WFC3/IR detector at 1600 nm is ~0.151\" (Table 7.5 of [WFC Instrument Handbook](http://www.stsci.edu/hst/wfc3/documents/handbooks/currentIHB/c07_ir07.html)). Using these values, a plate scale of 0.065\"/pix will be selected for the drizzled output frame, approximately half of the native plate scale (0.1283\"/pix). \n",
"Before drizzling can be performed, a plate scale for the output image should be chosen. This will usually be dictated by the science needs. In theory, critical sampling of a PSF occurs with 2.355 pixels. The FWHM of the WFC3/IR detector at 1600 nm is ~0.151\" (Table 7.5 of [WFC Instrument Handbook](https://hst-docs.stsci.edu/display/WFC3IHB)). Using these values, a plate scale of 0.065\"/pix will be selected for the drizzled output frame, approximately half of the native plate scale (0.1283\"/pix). \n",
"\n",
"The mechanism by which the *drizzle* algorithm improves sampling in the output image is by shrinking the input pixels before adding them to the output pixel grid (see Figure 2 in [Fruchter and Hook (2002)](http://iopscience.iop.org/article/10.1086/338393/pdf)). In practice this process is controlled in the `AstroDrizzle` package by adjusting the `final_pixfrac` parameter, which is the fractional size of the pixel to be used. \n",
"Below `AstroDrizzle` is called twice. The first time, no changes are made to the plate scale or the size of the drop. In the second call, the plate scale and pixfrac are reduced. For a four point dither stack, a `final_pixfrac` value of 0.8 is usually optimal."
Expand All @@ -157,8 +157,8 @@
" build=True,\n",
" preserve=False,\n",
" clean=True,\n",
" driz_sep_bits='64,512',\n",
" final_bits='64,512',\n",
" driz_sep_bits='16,512',\n",
" final_bits='16,512',\n",
" final_wcs=True,\n",
" final_rot=0.)\n",
"\n",
Expand All @@ -169,8 +169,8 @@
" build=True,\n",
" preserve=False,\n",
" clean=True,\n",
" driz_sep_bits='64,512',\n",
" final_bits='64,512',\n",
" driz_sep_bits='16,512',\n",
" final_bits='16,512',\n",
" final_pixfrac=0.8,\n",
" final_wcs=True,\n",
" final_rot=0.,\n",
Expand Down Expand Up @@ -282,8 +282,8 @@
" build=True,\n",
" preserve=False,\n",
" clean=True,\n",
" driz_sep_bits='64,512',\n",
" final_bits='64,512',\n",
" driz_sep_bits='16,512',\n",
" final_bits='16,512',\n",
" final_pixfrac=pixfrac,\n",
" final_wcs=True,\n",
" final_rot=0.,\n",
Expand Down Expand Up @@ -345,7 +345,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Another piece of information that can be useful is the amount of noise in the weight image. As suggested in the [HST Dither Handbook](http://www.stsci.edu/hst/HST_overview/documents/dither_handbook) Chapter 5 and in the [DrizzlePac Handbook](http://documents.stsci.edu/hst/HST_overview/documents/DrizzlePac/ch64.html#586267) Section 6.3.3, statistics performed on the drizzled weight image should yield a RMS/median value less than ~0.2. This threshold controls the trade-off between improving image resolution versus increasing background noise due to pixel resampling.\n",
"Another piece of information that can be useful is the amount of noise in the weight image. As suggested in the [HST Dither Handbook](https://ui.adsabs.harvard.edu/abs/2002hstd.book.....K/abstract) Chapter 5 and in the [DrizzlePac Handbook](http://www.stsci.edu/files/live/sites/www/files/home/scientific-community/software/drizzlepac/_documents/drizzlepac-handbook.pdf) Section 6.3.3, statistics performed on the drizzled weight image should yield a RMS/median value less than ~0.2. This threshold controls the trade-off between improving image resolution versus increasing background noise due to pixel resampling.\n",
" \n",
"The figure below shows the RMS/median as a function of `final_pixfrac`. One should take care to use the same region in the weight image as the region where the object of interest is located in the science image. If one is using the entire image for scientific analysis, then one should measure the statistics of the weight image where there is more variance. "
]
Expand Down Expand Up @@ -435,7 +435,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.6"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions notebooks/DrizzlePac/sky_matching/sky_matching.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
" median=False, \n",
" blot=False, \n",
" driz_cr=False, \n",
" final_bits='64',\n",
" final_bits='16',\n",
" final_wcs=True, \n",
" final_rot=257.)"
]
Expand Down Expand Up @@ -329,7 +329,7 @@
" median=False, \n",
" blot=False, \n",
" driz_cr=False, \n",
" final_bits='64',\n",
" final_bits='16',\n",
" final_wcs=True, \n",
" final_rot=257.)"
]
Expand Down Expand Up @@ -362,7 +362,7 @@
" median=False, \n",
" blot=False, \n",
" driz_cr=False, \n",
" final_bits='64',\n",
" final_bits='16',\n",
" final_wcs=True, \n",
" final_rot=257.)"
]
Expand Down Expand Up @@ -397,7 +397,7 @@
" median=False, \n",
" blot=False, \n",
" driz_cr=False, \n",
" final_bits='64',\n",
" final_bits='16',\n",
" final_wcs=True, \n",
" final_rot=257.)"
]
Expand Down Expand Up @@ -547,7 +547,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.6"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
Loading