{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Incorporating masks into calibrated science images" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are three ways of determining which pixels in a CCD image may need to be\n", "masked (this is in addition to whatever mask or bit fields the observatory at\n", "which you are taking images may provide).\n", "\n", "Two of them are the same for all of the science images:\n", "\n", "+ Hot pixels unlikely to be properly calibrated by subtracting dark current,\n", "discussed in [Identifying hot pixels](08-01-Identifying-hot-pixels.html).\n", "+ Bad pixels identified by `ccdproc.ccdmask` from flat field images, discussed\n", "in [Creating a mask with `ccdmask`](08-02-Creating-a-mask.html).\n", "\n", "The third, identifying cosmic rays, discussed in\n", "[Cosmic ray removal](08-03-Cosmic-ray-removal.html), will by its nature be different for each\n", "science image.\n", "\n", "The first two masks could be added to science images at the time the science\n", "images are calibrated, if desired. They are added to the science images here, as\n", "a separate step, because in many situations it is fine to omit masking entirely\n", "and there is no particular advantage to introducing it earlier." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We begin, as usual, with a couple of imports." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "from astropy import units as u\n", "from astropy.nddata import CCDData\n", "\n", "import ccdproc as ccdp" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read masks that are the same for all of the science images\n", "\n", "[*Click here to comment on this section on GitHub (opens in new tab).*](https://github.com/mwcraig/ccd-reduction-and-photometry-guide/pull/197/files#diff-8ef287f1d9f06a3732bd30c19146ef93R60){:target=\"_blank\"}\n", "\n", "In previous notebooks we constructed a mask based on the dark current and a mask\n", "created by `ccdmask` from a flat image. Displaying the summary of the the\n", "information about the reduced images is a handy way to determine which files are\n", "the masks." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table length=37\n", "
file | imagetyp |
---|---|
str31 | str9 |
AutoFlat-PANoRot-r-Bin1-001.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-002.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-003.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-004.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-005.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-006.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-007.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-008.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-009.fit | FLAT |
AutoFlat-PANoRot-r-Bin1-010.fit | FLAT |
... | ... |
Dark-S001-R001-C008-NoFilt.fit | DARK |
Dark-S001-R001-C009-NoFilt.fit | DARK |
Dark-S001-R001-C020-NoFilt.fit | DARK |
combined_bias.fit | BIAS |
combined_dark_90.000.fit | DARK |
combined_flat_filter_r.fit | FLAT |
kelt-16-b-S001-R001-C084-r.fit | LIGHT |
kelt-16-b-S001-R001-C125-r.fit | LIGHT |
mask_from_ccdmask.fits | flat mask |
mask_from_dark_current.fits | dark mask |