{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Access ESASky products with astroquery.esasky\n", "\n", "##### Authors: Ivan Valtchanov, Belén López Martí, H. Norman\n", "\n", "#### Last update: Feb 7, 2019\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook illustrates some example usages of the ESASky implementation in astroquery.\n", "\n", "First you need to install astroquery and esasky.\n", "\n", "Astroquery can be installed with pip install astroquery, the latest version should come with esasky. Alternatively, you can grab the latest astroquery with esasky from [here](https://github.com/imbasimba/astroquery).\n", "\n", "The documentation for astroquery.esasky is available [here](https://astroquery.readthedocs.io/en/latest/esasky/esasky.html).\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### Use Case 1: Retrieve imaging data for a single object\n", "\n", "In this use case, imaging data are retrieved for a single object, indicated by its name (resolved by Simbad) or coordinates.\n", "\n", "We start by importing the ESASky astroquery module and other necessary packages:\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "from matplotlib.colors import LogNorm\n", "import os\n", "from astroquery.esasky import ESASky" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, let's check the available maps: " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['INTEGRAL',\n", " 'XMM',\n", " 'Chandra',\n", " 'SUZAKU',\n", " 'XMM-OM-OPTICAL',\n", " 'XMM-OM-UV',\n", " 'HST',\n", " 'Herschel',\n", " 'ISO']" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ESASky.list_maps()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's do a search around the position of our object:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: W35: None:4:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:28: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:53: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:83: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:6:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "TableList with 7 tables:\n", "\t'0:XMM' with 10 column(s) and 6 row(s) \n", "\t'1:CHANDRA' with 10 column(s) and 16 row(s) \n", "\t'2:XMM-OM-OPTICAL' with 11 column(s) and 4 row(s) \n", "\t'3:XMM-OM-UV' with 10 column(s) and 5 row(s) \n", "\t'4:HST' with 12 column(s) and 156 row(s) \n", "\t'5:HERSCHEL' with 12 column(s) and 9 row(s) \n", "\t'6:ISO' with 7 column(s) and 4 row(s) \n" ] } ], "source": [ "maps = ESASky.query_object_maps('M51')\n", "print (maps)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The output is a TableList with the keys corresponding to the mission (or in some cases, mission and instrument) names for which there are images available covering our target position.\n", "\n", "We can also do a search by coordinates, either by using an [astroquery.coordinates](http://docs.astropy.org/en/stable/coordinates/) object or by typing the coordinates. In this latter case, we have to define the units we are using (d = degrees; h = hours; m = minutes; s = seconds)." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/belenlopezmarti/anaconda3/lib/python3.6/site-packages/astroquery/utils/commons.py:159: UserWarning: Coordinate string is being interpreted as an ICRS coordinate.\n", " warnings.warn(\"Coordinate string is being interpreted as an \"\n", "WARNING: W35: None:4:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:28: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:53: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:5:83: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n", "WARNING: W35: None:6:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "TableList with 7 tables:\n", "\t'0:XMM' with 10 column(s) and 6 row(s) \n", "\t'1:CHANDRA' with 10 column(s) and 16 row(s) \n", "\t'2:XMM-OM-OPTICAL' with 11 column(s) and 4 row(s) \n", "\t'3:XMM-OM-UV' with 10 column(s) and 5 row(s) \n", "\t'4:HST' with 12 column(s) and 156 row(s) \n", "\t'5:HERSCHEL' with 12 column(s) and 9 row(s) \n", "\t'6:ISO' with 7 column(s) and 4 row(s) \n" ] } ], "source": [ "maps = ESASky.query_object_maps('13h29m52.7s +47d11m43s')\n", "print (maps)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The method has a tolerance of 5 arcsec to allow for positional errors." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's check the content of the 'XMM-OM-OPTICAL' table:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "