In [1]:
from __future__ import print_function, division, absolute_import
Some exercises make use of code in the notebook. Other exercises will require a GUI interaction. In those cases, one or more images of results are included.
Using matplotlib and astropy:
.data/w5.fits as a bitmap with log stretch and min-max scaling./data/0259p6031_1342192088_SpirePhoto_L20_PMP350_SPG14.0.fits.fits.gz as white contours with levels drawn at [0.7, 1.4, 3] image units (Jy/beam)
In [2]:
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.wcs import WCS
from astropy.visualization import (MinMaxInterval,
LogStretch,
ImageNormalize)
%matplotlib inline
In [3]:
hdu = fits.open('./data/w5.fits')[0]
wcs = WCS(hdu.header)
hdu2 = fits.open('./data/0259p6031_1342192088_SpirePhoto_L20_PMP350_SPG14.0.fits.gz')[1]
norm = ImageNormalize(hdu.data, interval=MinMaxInterval(),
stretch=LogStretch())
In [4]:
fig = plt.figure(figsize=(8,8))
ax = plt.subplot(projection=wcs)
overlay = ax.get_coords_overlay('galactic')
plt.imshow(hdu.data, norm=norm, origin="lower", cmap='Greys_r')
ax.coords['ra'].set_ticks(color='green')
ax.coords['dec'].set_ticks(color='green')
ax.coords['ra'].set_axislabel('Right Ascension')
ax.coords['dec'].set_axislabel('Declination')
ax.coords.grid(color='green', linestyle='solid', alpha=1.0)
overlay['l'].set_ticks(color='cyan')
overlay['b'].set_ticks(color='cyan')
overlay['l'].set_axislabel('Galactic Longitude')
overlay['b'].set_axislabel('Galactic Latitude')
overlay.grid(color='cyan', linestyle='solid', alpha=1.0)
ax.contour(hdu2.data, transform=ax.get_transform(WCS(hdu2.header)),
levels=[0.7,1.4,3], colors='white');
Using astropy and reproject (installable with pip install reproject), follow these instructions in the Astropy documentation to make color RGB images. Compare the second one to Figure 1 of Lupton et al 2004.
In [5]:
import numpy as np
from astropy.visualization import make_lupton_rgb
from astropy.io import fits
from reproject import reproject_interp
In [6]:
# Read in the three images downloaded from here:
g = fits.open('http://dr13.sdss.org/sas/dr13/eboss/photoObj/frames/301/1737/5/frame-g-001737-5-0039.fits.bz2')[0]
r = fits.open('http://dr13.sdss.org/sas/dr13/eboss/photoObj/frames/301/1737/5/frame-r-001737-5-0039.fits.bz2')[0]
i = fits.open('http://dr13.sdss.org/sas/dr13/eboss/photoObj/frames/301/1737/5/frame-i-001737-5-0039.fits.bz2')[0]
In [7]:
# remap r and i onto g
r_new, r_mask = reproject_interp(r, g.header)
i_new, i_mask = reproject_interp(i, g.header)
# zero out the unmapped values
i_new[np.logical_not(i_mask)] = 0
r_new[np.logical_not(r_mask)] = 0
# red=i, green=r, blue=g
# make a file with the default scaling
rgb_default = make_lupton_rgb(i_new, r_new, g.data, filename="ngc6976-default.jpeg")
# this scaling is very similar to the one used in Lupton et al. (2004)
rgb = make_lupton_rgb(i_new, r_new, g.data, Q=10, stretch=0.5, filename="ngc6976.jpeg")
Reproject the 250 um image of W5 in ./data/0259p6031_1342192088_SpirePhoto_L20_PMP250_SPG14.0.fits.gz (extension 1) and the 350 micron image in ./data/0259p6031_1342192088_SpirePhoto_L20_PMP350_SPG14.0.fits.gz onto the 500 micron image in that directory, and try the same 3-color procedures.
In [8]:
w5_250 = fits.open('./data/0259p6031_1342192088_SpirePhoto_L20_PMP250_SPG14.0.fits.gz')[1]
w5_350 = fits.open('./data/0259p6031_1342192088_SpirePhoto_L20_PMP350_SPG14.0.fits.gz')[1]
w5_500 = fits.open('./data/0259p6031_1342192088_SpirePhoto_L20_PMP500_SPG14.0.fits.gz')[1]
In [9]:
im250, msk250 = reproject_interp(w5_250, w5_500.header)
im350, msk350 = reproject_interp(w5_350, w5_500.header)
In [10]:
# zero out the unmapped values
im250[np.logical_not(msk250)] = 0
im350[np.logical_not(msk350)] = 0
In [11]:
rgb_w5_default = make_lupton_rgb(im250, im350, w5_500.data, filename="w5-default.jpeg")
In [12]:
rgb_w5 = make_lupton_rgb(im250, im350, w5_500.data, Q=10, stretch=0.5, filename="w5.jpeg")
If you haven't already, install Ginga with pip install ginga.
312.503802, -0.706603 in the Level 1 images.If you haven't already, install Glue with conda install -c conda-forge glueviz
./data/mrrphotz_xmmbrite.dat./data/xmm-lss-cutout-350umra and dec from the table to Right Ascenscion and Declination from the imagealz2 is $log_{10}(1+z_{phot})$ for free $A_V$ solution. Define a new component photz inside Glue as np.power( 10, mrrphotz_xmmbrite.dat:alz2 ) - 1.0 and add it to the tablenon-zero specznon-zero specz into 5 subsets by nbopt (number of optical bands). Explore the spatial distribution of the data with the highest number of optical bands.If you have Java or are comfortable installing it, you can install a local Firefly server.
Check that you have java 1.8 installed with java -version
Download Firefly Standalone from release page (https://github.com/Caltech-IPAC/firefly/releases
Start with java -jar firefly-exec.war
Firefly will be available on localhost port 80: http://localhost:8080/firefly/
Once it is running, if you have done pip install firefly_client:
.data/w5.fits and display itThe steps are in the ImageVizSlides notebook.
In [ ]: