Preface
Contents
Preface#
The purpose of this text is to walk through image reduction and photometry using Python, especially Astropy and its affiliated packages. It assumes some basic familiarity with astronomical images and with Python. The inspiration for this work is a pair of guides written for IRAF, “A User’s Guide to CCD Reductions with IRAF” (Massey 1997) and “A User’s Guide to Stellar CCD Photometry with IRAF” (Massey and Davis 1992).
The focus is on optical/IR images, not spectra.
Edition numbers#
The guide now has version numbers, roughly equivalent to editions in a printed
book. Each
number has three pieces – for example the first official stable version is
2.0.0
.
Think of that as roughly equivalent to “edition”, “revision” and “printing” in
the physical
book world.
The edition number is listed in the sidebar.
This is what changes in each of those numbers means:
Change in the first number, e.g. changing
2.0.0
→3.0.0
, indicates a major revision that changes the numbering of sections or adds significant new sections.Changes in the middle number, e.g. changing
2.0.0
→2.1.0
, indicates suibstantive updates have been made to the content and/or important errors have been fixed. The section numbers will not change, though.Changes in the last number, e.g. changing
2.0.0
→2.0.1
, indicates minor changes have been made like fixing typographic errors, broken links, and similar corrections. The section numbers will not change in these revisions. In addition, there is a “development” version available that reflects the latest changes made to the guide between releases.
Those familiar with semantic versioning from software development will recognize this as roughly the equivalent for text.
Credits#
Funding#
Made possible by the Astropy Project and ScienceBetter Consulting through financial support from the Community Software Initiative at the Space Telescope Science Institute.
Acknowledgments#
The following people contributed to this work by making suggestions, testing code, or providing feedback on drafts. We are grateful for their assistance!
Nicolás Cardiel
Simon Conseil
Lia Corrales
Kelle Cruz
Adam Ginsburg
Johannes Goller
Yash Gondhalekar
Lia G
Richard Hendricks
Stuart Littlefair
Matt Phillips
Benjamin Shafransky
Isobel Snellenberger
Kris Stern
Thomas Stibor
Sarah Tuttle
If you have provided feedback and are not listed above, we apologize – please open an issue here so we can fix it.
Resources#
This astronomical content work was inspired by, and guided by, the excellent resources below:
“A User’s Guide to CCD Reductions with IRAF” (Massey 1997) is very thorough, but IRAF has become more difficult to install over time and is no longer supported.
“A User’s Guide to Stellar CCD Photometry with IRAF” (Massey and Davis 1992).
The Handbook of Astronomical Image Processing by Richard Berry and James Burnell. This provides a very detailed overview of data reduction and photometry. One virtue is its inclusion of real images with defects.
The AAVSO CCD Obseving Manual provides a complete introduction to CCD data reduction and photometry.
A Beginner’s Guide to Working with Astronomical Data is much broader than this guide. It includes an introduction to Python.
Software setup/getting started on your computer#
Setting up Python#
To use any of this software you will need an installation of Python. We recommend the mambaforge installer or miniconda installer (or the much larger Anaconda Python distribution if you must). Once you have that, you can install everything you need with:
conda install -c astropy ccdproc photutils ipywidgets matplotlib jupyterlab
(alternatively, mamba
should work in place of conda
; if you get an error
message saying you need to initialize mamba
then follow the instructions in
that message.
Getting a copy of these notebooks#
Get a copy of these files from https://github.com/astropy/ccd-reduction-and-photometry-guide – click the
green “Code” button and either clone (if you are using git
) or download the
zip file and extract it. If you are looking for a specific edition, e.g. 2.0.0
then go to https://github.com/astropy/ccd-reduction-and-photometry-guide/releases.
If you want to run this code in a notebook from the command line#
Open a terminal, change directory into the notebooks
folder in this
repository, type jupyter lab
and a browser tab should open with the notebooks.
You will still need to download the data by following the instructions below in Data files
If you want to run this code in some other way (IPython
, Spyder
, Visual Studio Code
, …)#
Spyder
and Visual Studio Code
can run notebooks; follow the instructions
above to get the notebooks. Follow the instructions
for opening notebooks in the tool you chose.
If you are copy/pasting code from the online book into one of these tools, you
need two files from the repository. Follow the instructions for getting a copy of the repository,
then copy the two files download_data.py
and convenience_functions.py
from
the notebooks
folder to whatever folder you plan to run the code in.
You will still need to download the data by following the instructions below in Data files
Data files#
The list of the data files, and their approximate sizes, is below. You can either download them one by one, or use the download helper included with these notebooks.
Use this in a terminal to download the data#
$ python download_data.py
Use this in a notebook cell to download the data#
%run download_data.py
List of data files#
Combination of 100 bias images (26MB) (DOI: https://doi.org/10.5281/zenodo.3320113)
Single bias image from thermoelectric camera (DOI: https://doi.org/10.5281/zenodo.5931364)
Single dark frame, exposure time 1,000 seconds (11MB) (DOI: https://doi.org/10.5281/zenodo.3312535)
Combination of several dark frames, each 1,000 exposure time (52MB) (DOI: https://doi.org/10.5281/zenodo.4302262)
Combination of several dark frames, each 300 sec (7MB) (DOI: https://doi.org/10.5281/zenodo.3332818)
“Example 1” in the reduction notebooks: Several images from the Palomar Large Format Camera, Chip 0 (162MB) (DOI: https://doi.org/10.5281/zenodo.3254683)
“Example 2” in the reduction notebooks: Several images from an Andor Aspen CG16M (483MB) (DOI: https://doi.org/10.5281/zenodo.3245296)