{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# SPIRE Aperture Photometry for Point Sources\n", "\n", "***Author: Ivan Valtchanov***\n", "\n", "The method for photmetry is outlined in [the SPIRE Handbook](http://herschel.esac.esa.int/Docs/SPIRE/spire_handbook.pdf), section 5.12.1. This notebook just shows one practical example.\n", "\n", "The workflow is the following:\n", "1. Using `ESASky` module of `astroquery` search for the source in _Herschel_ observations. Pick on observation for the example.\n", "2. Download the map using the [astroquery.esasky](https://astroquery.readthedocs.io/en/latest/esasky/esasky.html) results.\n", "3. Perform aperture photometry using [photutils](https://photutils.readthedocs.io/en/stable).\n", "4. Bonus: compare the aperture-derived flux density with the one in the SPIRE point source catalogue, also available in `astroquery.esasky`.\n", "\n", "For this exercise we are going to use a known stellar calibrator: $\\beta$ And, with RA=01:09:43.9, Dec= +35:37:14.\n", "\n", "For reference, the model flux densities of $\\beta$ And in the SPIRE bands ([Decin et al. 2007](https://ui.adsabs.harvard.edu/#abs/2007A&A...472.1041D)) are (430, 217, 105) mJy at (250, 350, 500) µm. \n", "\n", "**Requirements**: `python 3.x`, `matplotlib 2.2.2` (in `matplotlib 3.0.0` the WCS from `astropy` 3.0.4 does not work), `astropy`, `astroquery`, `photutils`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import os\n", "# Set up matplotlib and use a nicer set of plot parameters\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from astropy.io import fits\n", "from astropy.wcs import WCS\n", "from astropy.visualization import PercentileInterval, ImageNormalize\n", "from astropy import units as u\n", "from astropy.coordinates import SkyCoord\n", "from astropy.table import hstack\n", "from astropy.nddata import Cutout2D\n", "\n", "from photutils import SkyCircularAperture, SkyCircularAnnulus, aperture_photometry\n", "\n", "from astroquery.esasky import ESASky\n", "from astroquery.simbad import Simbad " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#\n", "# set the download dir for ESASky products\n", "#\n", "download_dir = os.path.expanduser('~') + \"/tmp/\" # change this to your desired directory\n", "#\n", "# define the target and get its coordinates from Simbad\n", "target_name = 'beta And'\n", "target = Simbad.query_object(target_name)\n", "target_coord = SkyCoord(ra=target[\"RA\"][0], dec=target[\"DEC\"][0], unit=(u.hourangle,u.deg), frame='icrs')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Search in ESASky\n", "\n", "We search for _Herschel_ maps in ESASky, using as an input the target name. The search radius is set to 6\" (that's one pixel of the SPIRE 250 µm map). This should be sufficient. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "#\n", "# We'll search ESASky for $\\beta$ And directly, using the Simbad name resolver\n", "maps = ESASky.query_region_maps(target_name, radius=\"6 arcsec\",missions=['Herschel'])\n", "#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Check the ESASky results table\n", "\n", "The results are returned in a `astropy.Table.table`. It is useful to check it." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "