|
| 1 | +--- |
| 2 | +jupytext: |
| 3 | + text_representation: |
| 4 | + extension: .md |
| 5 | + format_name: myst |
| 6 | + format_version: 0.13 |
| 7 | + jupytext_version: 1.19.1 |
| 8 | +kernelspec: |
| 9 | + name: python3 |
| 10 | + display_name: python3 |
| 11 | + language: python |
| 12 | +--- |
| 13 | + |
| 14 | +# Searching for AllWISE Atlas Images |
| 15 | + |
| 16 | ++++ |
| 17 | + |
| 18 | +## Learning Goals |
| 19 | + |
| 20 | +By the end of this tutorial, you will: |
| 21 | + |
| 22 | +* Learn how to access IRSA's WISE AllWISE Atlas (L3a) coadded images via the Simple Image Access (SIA) service. |
| 23 | +* identify which of IRSA's AllWISE Atlas images cover a specified coordinate. |
| 24 | +* Visualize one of the identified images using Forefly. |
| 25 | +* Create and display a cutout of the downloaded image. |
| 26 | + |
| 27 | ++++ |
| 28 | + |
| 29 | +## Introduction |
| 30 | + |
| 31 | +The AllWISE program builds upon the work of the successful Wide-field Infrared Survey Explorer mission [(WISE; Wright et al. 2010)](http://adsabs.harvard.edu/abs/2010AJ....140.1868W) by combining data from the WISE cryogenic and NEOWISE [(Mainzer et al. 2011 ApJ, 731, 53)](http://adsabs.harvard.edu/abs/2011ApJ...731...53M) post-cryogenic survey phases to form the a comprehensive view of the full mid-infrared sky. The AllWISE Images Atlas is comprised of 18,240 4-band calibrated 1.56°x1.56° FITS images, depth-of-coverage and noise maps, and image metadata produced by coadding nearly 7.9 million Single-exposure images from all survey phases. For more information about the WISE mission, see: |
| 32 | + |
| 33 | +https://irsa.ipac.caltech.edu/Missions/wise.html |
| 34 | + |
| 35 | +The [NASA/IPAC Infrared Science Archive (IRSA)](https://irsa.ipac.caltech.edu) at Caltech is the archive for AllWISE images and catalogs. The AllWISE Atlas images that are the subject of this tutorial are made accessible via the [International Virtual Observatory Alliance (IVOA)](https://ivoa.net) [Simple Image Access (SIA)](https://wiki.ivoa.net/internal/IVOA/SiaInterface/SIA-V2-Analysis.pdf) protocol. |
| 36 | + |
| 37 | + |
| 38 | +```{note} |
| 39 | +IRSA supports both SIA v1 and SIA v2 protocols. The version used depends on the specific dataset. This IRSA [website](https://irsa.ipac.caltech.edu/ibe/sia.html) provides information on which version each service uses and how to access them. Further information on how to access IRSA data with different techniques is available [here](https://irsa.ipac.caltech.edu/docs/program_interface/api_images.html) |
| 40 | +``` |
| 41 | + |
| 42 | ++++ |
| 43 | + |
| 44 | +## Imports |
| 45 | +- `astropy.coordinates` for defining coordinates |
| 46 | +- `astropy.nddata` for creating an image cutout |
| 47 | +- `astropy.wcs` for interpreting the World Coordinate System header keywords of a fits file |
| 48 | +- `astropy.units` for attaching units to numbers passed to the SIA service |
| 49 | +- `matplotlib.pyplot` for plotting |
| 50 | +- `astropy.io` to manipulate FITS files |
| 51 | +- `firefly_client` for visuzlizing images |
| 52 | +- `astroquery/ipac.irsa` for data access |
| 53 | + |
| 54 | +```{code-cell} ipython3 |
| 55 | +# Uncomment the next line to install dependencies if needed. |
| 56 | +%pip install matplotlib astropy jupyter_firefly_extensions |
| 57 | +``` |
| 58 | + |
| 59 | +```{code-cell} ipython3 |
| 60 | +from astropy.coordinates import SkyCoord |
| 61 | +from astropy.nddata import Cutout2D |
| 62 | +from astropy.wcs import WCS |
| 63 | +import astropy.units as u |
| 64 | +import matplotlib.pyplot as plt |
| 65 | +from astropy.io import fits |
| 66 | +from firefly_client import FireflyClient |
| 67 | +from astroquery.ipac.irsa import Irsa |
| 68 | +``` |
| 69 | + |
| 70 | +## 1. Define the target |
| 71 | + |
| 72 | ++++ |
| 73 | + |
| 74 | +Define coordinates of a bright star |
| 75 | + |
| 76 | +```{code-cell} ipython3 |
| 77 | +ra = 314.30417 |
| 78 | +dec = 77.595559 |
| 79 | +pos = SkyCoord(ra=ra, dec=dec, unit='deg') |
| 80 | +``` |
| 81 | + |
| 82 | +## 2. Discover AllWISE Atlas images |
| 83 | + |
| 84 | ++++ |
| 85 | + |
| 86 | +IRSA provides Simple Image Access (SIA) services for various datasets. A list of available datasets and their access URLs can be found at: |
| 87 | + |
| 88 | +https://irsa.ipac.caltech.edu/ibe/sia.html |
| 89 | + |
| 90 | +This tutorial uses SIA v2 for AllWISE Atlas images. |
| 91 | + |
| 92 | +```{code-cell} ipython3 |
| 93 | +names = Irsa.list_collections(filter="allwise") |
| 94 | +names |
| 95 | +
|
| 96 | +# We see from the resulting table that the dataset collection we are interested in is called "wise_allwise" |
| 97 | +``` |
| 98 | + |
| 99 | +## 3. Search for images |
| 100 | + |
| 101 | +```{code-cell} ipython3 |
| 102 | +#get a table of all images within 1 arcsecond of our target position |
| 103 | +
|
| 104 | +dataset_name = names['collection'][0] |
| 105 | +im_table = Irsa.query_sia(pos=(pos, 1 * u.arcsec), collection=dataset_name) |
| 106 | +``` |
| 107 | + |
| 108 | +Inspect the table that is returned |
| 109 | + |
| 110 | +```{code-cell} ipython3 |
| 111 | +im_table |
| 112 | +``` |
| 113 | + |
| 114 | +```{code-cell} ipython3 |
| 115 | +im_table.colnames |
| 116 | +``` |
| 117 | + |
| 118 | +```{code-cell} ipython3 |
| 119 | +# Let's look at the values in one of the columns |
| 120 | +im_table['energy_bandpassname'] |
| 121 | +``` |
| 122 | + |
| 123 | +## 4.Locate and visualize an image of interest |
| 124 | + |
| 125 | ++++ |
| 126 | + |
| 127 | +Let's search the image results for the W3 band image. |
| 128 | + |
| 129 | +```{code-cell} ipython3 |
| 130 | +# You can put the URL from the column "access_url" into a browser to download the file. |
| 131 | +# Or you can work with it in Python, as shown below. |
| 132 | +w3_mask = im_table['energy_bandpassname'] == 'W3' |
| 133 | +w3_table = im_table[w3_mask] |
| 134 | +
|
| 135 | +# Lets look at the access_url of the first one: |
| 136 | +image_url = w3_table['access_url'][0] |
| 137 | +image_url |
| 138 | +``` |
| 139 | + |
| 140 | +```{code-cell} ipython3 |
| 141 | +#Use Astropy to examine the header of the URL from the previous step. |
| 142 | +
|
| 143 | +hdulist = fits.open(image_url) |
| 144 | +hdulist.info() |
| 145 | +``` |
| 146 | + |
| 147 | +Download the image and open it in Astropy |
| 148 | + |
| 149 | +```{code-cell} ipython3 |
| 150 | +## 7. Visualize a SPHEREx Spectral Image MEF using the Firefly Python Client. |
| 151 | +
|
| 152 | +
|
| 153 | +# We will use the open-source astronomy data visualization software Firefly. |
| 154 | +# Firefly has a Python client. |
| 155 | +
|
| 156 | +#Open a Firefly viewer in a tab within jupyterlab. |
| 157 | +
|
| 158 | +fc = FireflyClient.make_client(url="https://irsa.ipac.caltech.edu/irsaviewer") |
| 159 | +fc = FireflyClient.make_lab_client() |
| 160 | +
|
| 161 | +# Visualize an image by sending its URL to the viewer. |
| 162 | +
|
| 163 | +fc.show_fits_image(file_input=image_url, |
| 164 | + plot_id="image", |
| 165 | + Title="Image" |
| 166 | + ) |
| 167 | +
|
| 168 | +#Try use the interactive tools in the viewer to explore the data. |
| 169 | +
|
| 170 | +``` |
| 171 | + |
| 172 | +## 5. Extract a cutout and plot it |
| 173 | + |
| 174 | +```{code-cell} ipython3 |
| 175 | +data = hdulist[0].data |
| 176 | +wcs = WCS(hdulist[0].header) |
| 177 | +
|
| 178 | +# make 1' x 1' cutout |
| 179 | +cutout = Cutout2D(data, position=pos, size=1 * u.arcmin, wcs=wcs) |
| 180 | +
|
| 181 | +# display |
| 182 | +plt.figure() |
| 183 | +plt.imshow(cutout.data, origin='lower') |
| 184 | +plt.colorbar() |
| 185 | +``` |
| 186 | + |
| 187 | +*** |
| 188 | + |
| 189 | ++++ |
| 190 | + |
| 191 | +## Acknowledgements |
| 192 | + |
| 193 | +- [Caltech/IPAC-IRSA](https://irsa.ipac.caltech.edu/) |
| 194 | + |
| 195 | ++++ |
| 196 | + |
| 197 | +## About this notebook |
| 198 | + |
| 199 | ++++ |
| 200 | + |
| 201 | +## About this notebook |
| 202 | + |
| 203 | +**Authors:** IRSA Data Science Team, including Troy Raen, Brigitta Sipőcz, Jessica Krick, Andreas Faisst, Jaladh Singhal, Vandana Desai, Dave Shupe |
| 204 | + |
| 205 | +**Updated:** 16 February 2026 |
| 206 | + |
| 207 | +**Contact:** [IRSA Helpdesk](https://irsa.ipac.caltech.edu/docs/help_desk.html) with questions or problems. |
| 208 | + |
| 209 | +**Runtime:** As of the date above, this notebook takes about 20 seconds to run to completion on a machine with 8GB RAM and 4 CPU. |
| 210 | +This runtime is dependent on archive servers which means runtime will vary for users. |
| 211 | + |
| 212 | ++++ |
| 213 | + |
| 214 | +## Citations |
| 215 | + |
| 216 | ++++ |
| 217 | + |
| 218 | +If you use `astropy` for published research, please cite the authors. Follow these links for more information about citing `astropy`: |
| 219 | + |
| 220 | +* [Citing `astropy`](https://www.astropy.org/acknowledging.html) |
| 221 | + |
| 222 | ++++ |
| 223 | + |
| 224 | +Please include the following in any published material that makes use of the WISE data products: |
| 225 | + |
| 226 | +"This publication makes use of data products from the Wide-field Infrared Survey Explorer, which is a joint project of the University of California, Los Angeles, and the Jet Propulsion Laboratory/California Institute of Technology, funded by the National Aeronautics and Space Administration." |
| 227 | + |
| 228 | +Please also cite the dataset Digital Object Identifier (DOI): [10.26131/IRSA153](https://www.ipac.caltech.edu/doi/irsa/10.26131/IRSA153) |
0 commit comments