Mapping Galaxy Properties with MaNGA + HST#


Learning Goals#

By the end of this tutorial, you will:

  • Understand how to search the MAST Archive and download SDSS MaNGA data using astroquery.mast

  • Plot galaxy properties including H-\(\alpha\) emission line flux and stellar velocities with MaNGA

  • Understand how to search for HST data complementing the MaNGA observations

  • Create maps of galaxy properties by combining HST and MaNGA data

Table of Contents#

  • Introduction

  • Imports

  • Accessing MaNGA data at MAST

    • Querying All MaNGA data

    • Searching for a specific galaxy

    • Downloading MaNGA data products

    • Plotting velocity and flux maps from MaNGA

  • Searching for HST data of this galaxy

    • Coordinate search using astroquery.mast

    • Colorizing HST images with astropy

  • Combining MaNGA and HST data

    • Creating an H-alpha Emission Map

    • Plotting the stellar velocity field

  • Additional Resources

    • How to Cite

    • About This Notebook

Introduction#

The Mapping Nearby Galaxies at Apache Point Observatory (MaNGA) survey provides optical-wavelength integral field unit (IFU) spectroscopy for over 10,000 nearby galaxies. MaNGA collected data between 2014 - 2020 as part of the Sloan Digital Sky Survey (SDSS-IV) project. MaNGA data is now available at the Mikulski Archive for Space Telescopes (MAST) through the SDSS Legacy Archive at MAST.

In this notebook tutorial, we will demonstrate how to access MaNGA data at MAST using Python. One MaNGA observation, an interacting galaxy pair named MaNGA 7443-12703 will be used to demonstrate the basics of how to download and plot MaNGA data. We will then combine this MaNGA data with HST observations, also accessible from MAST, to study this galaxy pair in detail, exploring how its gas and stars are moving as the galaxies merge together.

Imports#

The main packages we’re using for this notebook and their use-cases are:

  • astropy.coordinates for handling astronomical coordinates

  • astroquery.mast Observations for searching the MAST archive

  • astropy.visualization for colorizing images

  • astropy.wcs WCS for handling spatial footprints

  • astropy.units for working with astronomical units

  • astropy.io fits for accessing FITS files

  • matplotlib.pyplot for plotting data

  • numpy to handle array functions

  • PIL for plotting and handling preview (png/jpg) images

  • reproject for coordinate transformations and projections

%matplotlib inline

from astropy.coordinates import SkyCoord
from astroquery.mast import Observations
from astropy.visualization import make_lupton_rgb
from astropy.wcs import WCS

import astropy.units as u
import astropy.io.fits as fits
import matplotlib.pyplot as plt
import numpy as np
import PIL
import reproject

This cell updates some of the settings in matplotlib to use larger font sizes in the figures:

#Update Plotting Parameters
params = {'axes.labelsize': 12, 'xtick.labelsize': 12, 'ytick.labelsize': 12, 
          'text.usetex': False, 'lines.linewidth': 1,
          'axes.titlesize': 18, 'font.family': 'serif', 'font.size': 12}
plt.rcParams.update(params)

Accessing MaNGA data at MAST#

The SDSS Legacy Archive at MAST hosts all of the science-ready data products from the SDSS-IV MaNGA Survey, which includes data for over 10,000 different nearby galaxies taken with the Apache Point Observatory SDSS-2.5m telescope. This notebook will demonstrate how to search and download MaNGA data using MAST.

The SDSS MaNGA survey obtains spectra across the entire face of target galaxies using custom designed fiber bundles. The title text in the top-center of the image reads 'SDSS-IV Dissects 10,000 Galaxies in Nearby Universe'. In the top left corner is a small inset image of the SDSS 2.5m telescope at Apache Point Observatory, where the MaNGA data was taken. The center-left shows an image of a pair of hands plugging an optical fiber into the MaNGA instrument. The SDSS-IV logo is in the bottom-left. A close-up photo of the MaNGA instrument is shown in the center and bottom-right area of the image, demonstrating that each MaNGA data cube is made from dozens of optical fibers arranged in a hexagon shape, which each take a spectrum at a different location in the galaxy. The top-right inset shows two example spectra from MaNGA, one taken from the center of the fiber bundle (labeled 1) and one taken from the edge of the fiber bundle (labeled 2), showing how the spectrum of the central regions differs dramatically from outer regions. Image Credit: Dana Berry / SkyWorks Digital Inc., David Law, and the SDSS collaboration.
Image Credit: Dana Berry / SkyWorks Digital Inc., David Law, and the SDSS collaboration.

Querying all MaNGA data#

Searching for MaNGA data is straightforward with astroquery.mast. In this example, we use Observations.query_criteria and search for provenance_name = 'MaNGA'. This will return a table describing all of the MaNGA data hosted by the MAST archive.

Other useful search parameters for MaNGA data might include:

  • obs_collection = 'SDSS': searches for all SDSS data

  • target_classification = 'GALAXY': searches for only galaxies

  • obs_id to search for specific targets

# Search for MaNGA data
manga_obs_list = Observations.query_criteria(provenance_name='MaNGA')

# Display First Ten Entries in Table
manga_obs_list[:10]
Table masked=True length=10
intentTypeobs_collectionprovenance_nameinstrument_nameprojectfilterswavelength_regiontarget_nametarget_classificationobs_ids_ras_decdataproduct_typeproposal_picalib_levelt_mint_maxt_exptimeem_minem_maxobs_titlet_obs_releaseproposal_idproposal_typesequence_numbers_regionjpegURLdataURLdataRightsmtFlagsrcDenobsidobjID
str7str4str5str5str4str4str7str9str9str22float64float64str4str18int64float64float64float64float64float64str59float64str3str1int64str50str37str61str6boolfloat64str9str9
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL12-193481GALAXYsdss_manga_7443-12703229.5255842.745842cubeSDSS Collaboration356741.056745.013501.5362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 229.52558 42.745842 0.0045138888888888885mast:SDSS/manga/7443/12703/12703.pngmast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE.fits.gzPUBLICFalsenan232291699635410707
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-601561GALAXYsdss_manga_12696-190113.9432920.6450414cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 13.943292 0.6450414 0.001736111111111111mast:SDSS/manga/12696/1901/1901.pngmast:SDSS/manga/12696/1901/manga-12696-1901-LOGCUBE.fits.gzPUBLICFalsenan232291748635473185
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32796GALAXYsdss_manga_12696-1270414.3742750.10294809cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 14.374275 0.10294809 0.0045138888888888885mast:SDSS/manga/12696/12704/12704.pngmast:SDSS/manga/12696/12704/manga-12696-12704-LOGCUBE.fits.gzPUBLICFalsenan232291749635473584
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32827GALAXYsdss_manga_12696-1270514.560282-0.29682866cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 14.560282 -0.29682866 0.0045138888888888885mast:SDSS/manga/12696/12705/12705.pngmast:SDSS/manga/12696/12705/manga-12696-12705-LOGCUBE.fits.gzPUBLICFalsenan232291750635473984
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32223GALAXYsdss_manga_12696-1270213.427716-1.0851671cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 13.427716 -1.0851671 0.0045138888888888885mast:SDSS/manga/12696/12702/12702.pngmast:SDSS/manga/12696/12702/manga-12696-12702-LOGCUBE.fits.gzPUBLICFalsenan232291751635474496
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32708GALAXYsdss_manga_12696-1270113.976234-0.92219584cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 13.976234 -0.92219584 0.0045138888888888885mast:SDSS/manga/12696/12701/12701.pngmast:SDSS/manga/12696/12701/manga-12696-12701-LOGCUBE.fits.gzPUBLICFalsenan232291752635474974
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32623GALAXYsdss_manga_12696-370314.197601-0.92006382cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 14.197601 -0.92006382 0.0024305555555555556mast:SDSS/manga/12696/3703/3703.pngmast:SDSS/manga/12696/3703/manga-12696-3703-LOGCUBE.fits.gzPUBLICFalsenan232291753635475119
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32786GALAXYsdss_manga_12696-610314.2109070.34647026cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 14.210907 0.34647026 0.003125mast:SDSS/manga/12696/6103/6103.pngmast:SDSS/manga/12696/6103/manga-12696-6103-LOGCUBE.fits.gzPUBLICFalsenan232291754635475317
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-32691GALAXYsdss_manga_12696-610214.292417-0.34695556cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 14.292417 -0.34695556 0.003125mast:SDSS/manga/12696/6102/6102.pngmast:SDSS/manga/12696/6102/manga-12696-6102-LOGCUBE.fits.gzPUBLICFalsenan232291755635475480
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL1-107844GALAXYsdss_manga_12696-370214.365107-0.47157688cubeSDSS Collaboration359080.059083.013501.2362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 14.365107 -0.47157688 0.0024305555555555556mast:SDSS/manga/12696/3702/3702.pngmast:SDSS/manga/12696/3702/manga-12696-3702-LOGCUBE.fits.gzPUBLICFalsenan232291756635475604

Searching for a specific galaxy#

Let’s narrow down the search to one particular galaxy: MaNGA galaxy 7443-12703, also known as “Mrk 848B”. This is an interacting galaxy pair currently undergoing a merger event: the two galaxies are colliding and will eventually merge together into one large galaxy. Studying merger events like this one help us understand how galaxies grow and evolve over time.

We can search for this galaxy in particular using the obs_id keyword:

# Search for MaNGA galaxy 7443-12703
manga_obs_list = Observations.query_criteria(provenance_name='MaNGA',
                                             obs_id='sdss_manga_7443-12703')

# Display results
manga_obs_list
Table masked=True length=1
intentTypeobs_collectionprovenance_nameinstrument_nameprojectfilterswavelength_regiontarget_nametarget_classificationobs_ids_ras_decdataproduct_typeproposal_picalib_levelt_mint_maxt_exptimeem_minem_maxobs_titlet_obs_releaseproposal_idproposal_typesequence_numbers_regionjpegURLdataURLdataRightsmtFlagsrcDenobsidobjID
str7str4str5str5str4str4str7str9str6str21float64float64str4str18int64float64float64float64float64float64str59float64str3str1int64str48str36str59str6boolfloat64str9str9
scienceSDSSMaNGAMaNGASDSSNoneOPTICAL12-193481GALAXYsdss_manga_7443-12703229.5255842.745842cubeSDSS Collaboration356741.056745.013501.5362.099999999999971035.4Mapping Nearby Galaxies at Apache Point Observatory (MaNGA)59554.0N/A----CIRCLE 229.52558 42.745842 0.0045138888888888885mast:SDSS/manga/7443/12703/12703.pngmast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE.fits.gzPUBLICFalsenan232291699635410707

Downloading MaNGA data products#

List all of the data products availble for this galaxy using Observations.get_product_list().

There are 13 total files available for this galaxy, which include include a preview image (12703.png), the 3D MaNGA spectral cube (manga-7443-12703-LOGCUBE.fits.gz), and the MaNGA MAP file (manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz) which contains measurements and parameters from the MaNGA data analysis pipeline.

More information on all of these products can be seen in the search results table:

# Get list of products (files) associated with this observation 
manga_products_list = Observations.get_product_list(manga_obs_list)

# Show Products List
manga_products_list
Table masked=True length=13
obsIDobs_collectiondataproduct_typeobs_iddescriptiontypedataURIproductTypeproductGroupDescriptionproductSubGroupDescriptionproductDocumentationURLprojectprvversionproposal_idproductFilenamesizeparent_obsiddataRightscalib_levelfilters
str9str4str4str21str256str1str83str7str28str9str1str5str6str3str56int64str9str6int64str4
232291699SDSScubesdss_manga_7443-12703Preview-FullSmast:SDSS/manga/7443/12703/12703.pngPREVIEW------MaNGAv3_1_1N/A12703.png238960232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA IFU Data Cube, with linear wavelength samplingSmast:SDSS/manga/7443/12703/manga-7443-12703-LINCUBE.fits.gzSCIENCE--CUBE--MaNGAv3_1_1N/Amanga-7443-12703-LINCUBE.fits.gz308685608232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Data Analysis Maps. Same as HYB10-MILESHC-MASTARSSP except hierarchically clustered templates from MaStar are used to fit the stellar continuum in the emission-line module.Smast:SDSS/manga/7443/12703/manga-7443-12703-MAPS-HYB10-MILESHC-MASTARHC2.fits.gzSCIENCE--MAPS--MaNGAv3_1_1N/Amanga-7443-12703-MAPS-HYB10-MILESHC-MASTARHC2.fits.gz11180464232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Data Analysis Maps. Analysis of each individual spaxel with S/N>1 ; spaxels must have a valid continuum fit for an emission-line model to be fit.Smast:SDSS/manga/7443/12703/manga-7443-12703-MAPS-SPX-MILESHC-MASTARSSP.fits.gzSCIENCE--MAPS--MaNGAv3_1_1N/Amanga-7443-12703-MAPS-SPX-MILESHC-MASTARSSP.fits.gz10814176232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Data Analysis Maps. Spaxels are binned to S/N~10 using the Voronoi binning algorithm; all binned spectra are treated independently.Smast:SDSS/manga/7443/12703/manga-7443-12703-MAPS-VOR10-MILESHC-MASTARSSP.fits.gzSCIENCE--MAPS--MaNGAv3_1_1N/Amanga-7443-12703-MAPS-VOR10-MILESHC-MASTARSSP.fits.gz6018405232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Data Analysis Model Cubes. Same as HYB10-MILESHC-MASTARSSP except hierarchically clustered templates from MaStar are used to fit the stellar continuum in the emission-line module.Smast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARHC2.fits.gzSCIENCE--MODELCUBE--MaNGAv3_1_1N/Amanga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARHC2.fits.gz178831813232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Data Analysis Model Cubes. Analysis of each individual spaxel with S/N>1 ; spaxels must have a valid continuum fit for an emission-line model to be fit.Smast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE-SPX-MILESHC-MASTARSSP.fits.gzSCIENCE--MODELCUBE--MaNGAv3_1_1N/Amanga-7443-12703-LOGCUBE-SPX-MILESHC-MASTARSSP.fits.gz248679687232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SSDSS MaNGA Data Analysis Model Cubes. Spaxels are binned to S/N~10 using the Voronoi binning algorithm; all binned spectra are treated independently.Smast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE-VOR10-MILESHC-MASTARSSP.fits.gzSCIENCE--MODELCUBE--MaNGAv3_1_1N/Amanga-7443-12703-LOGCUBE-VOR10-MILESHC-MASTARSSP.fits.gz132859770232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Row-Stacked Spectra, with linear wavelength samplingSmast:SDSS/manga/7443/12703/manga-7443-12703-LINRSS.fits.gzSCIENCE--RSS--MaNGAv3_1_1N/Amanga-7443-12703-LINRSS.fits.gz247013854232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA IFU Data Cube, with logarithmic wavelength samplingSmast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE.fits.gzSCIENCEMinimum Recommended ProductsCUBE--MaNGAv3_1_1N/Amanga-7443-12703-LOGCUBE.fits.gz212028256232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Data Analysis Maps. Stellar-continuum analysis of spectra binned to S/N~10 for the stellar kinematics, with hierarchically clustered MILES templates; emission-line analysis done on individual spaxels, with MaStar simple stellar population modelsSmast:SDSS/manga/7443/12703/manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gzSCIENCEMinimum Recommended ProductsMAPS--MaNGAv3_1_1N/Amanga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz11162876232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA DAP Model Cubes. Stellar-continuum analysis of spectra binned to S/N~10 for the stellar kinematics, with hierarchically clustered MILES templates; emission-line analysis done on individual spaxels, with MaStar simple stellar population modelsSmast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARSSP.fits.gzSCIENCEMinimum Recommended ProductsMODELCUBE--MaNGAv3_1_1N/Amanga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARSSP.fits.gz179163798232291699PUBLIC3None
232291699SDSScubesdss_manga_7443-12703SDSS MaNGA Row-Stacked Spectra, with logarithmic wavelength samplingSmast:SDSS/manga/7443/12703/manga-7443-12703-LOGRSS.fits.gzSCIENCEMinimum Recommended ProductsRSS--MaNGAv3_1_1N/Amanga-7443-12703-LOGRSS.fits.gz169503381232291699PUBLIC3None

Now we will download some of these files using Observations.download_products(). To start, let’s download the preview image to see what this galaxy pair looks like. The parameters used are:

  • manga_products_list: the list of products from the previous cell

  • productType='PREVIEW': limit the list to preview files only

  • flat=True: download the data into the current directory

The download will print a status message when completed.

print(Observations.download_products(manga_products_list, productType='PREVIEW', flat=True))
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:SDSS/manga/7443/12703/12703.png to ./12703.png ...
 [Done]
 Local Path  Status  Message URL 
----------- -------- ------- ----
./12703.png COMPLETE    None None

The Right Ascension (RA) and declination (Dec) coordinates for this image are contained in the file as a World Coordinate System (WCS) axis. Using astropy.wcs.WCS(), we can retrieve this information from the file and use it in the plot.

def get_wcs_from_png(file):
    """ Retrieves WCS information from png file """
    with PIL.Image.open(file) as ii:
        ww = {}
        for k, v in ii.info.items():
            try:
                ww[k] = float(v)
            except ValueError:
                ww[k] = v
        ww.pop("WCSAXES")
        return WCS(ww)   

Now let’s plot this preview image to see what these galaxies look like!

# Open image file
manga_preview = np.asarray(PIL.Image.open('12703.png'))

# Set up plot using WCS projection from the file
plt.subplot(projection=get_wcs_from_png('12703.png'))

# Show the image
plt.imshow(manga_preview)

# Label title and axes
plt.title('MaNGA Preview Image')
plt.xlabel('Right Ascension')
plt.ylabel('Declination')

plt.show()
../../../_images/c5e927360e0be32d9d07b9b44414313887d087e7d796980392bf34c4dcc9abe0.png

Next, let’s download the Minimum Recommended Products. These are the recommended files to download for this MaNGA galaxy. You can select the Minimum Recommended Products using mrp_only=True. This will download 4 files.

# Download Minimum Recommended Products
Observations.download_products(manga_products_list, mrp_only=True, flat=True)
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARSSP.fits.gz to ./manga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARSSP.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:SDSS/manga/7443/12703/manga-7443-12703-LOGCUBE.fits.gz to ./manga-7443-12703-LOGCUBE.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:SDSS/manga/7443/12703/manga-7443-12703-LOGRSS.fits.gz to ./manga-7443-12703-LOGRSS.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:SDSS/manga/7443/12703/manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz to ./manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz ...
 [Done]
Table length=4
Local PathStatusMessageURL
str58str8objectobject
./manga-7443-12703-LOGCUBE-HYB10-MILESHC-MASTARSSP.fits.gzCOMPLETENoneNone
./manga-7443-12703-LOGCUBE.fits.gzCOMPLETENoneNone
./manga-7443-12703-LOGRSS.fits.gzCOMPLETENoneNone
./manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gzCOMPLETENoneNone

Plotting velocity and flux maps from MaNGA#

Now that the MaNGA data has been downloaded, we can plot some of the galaxy properties. The ManGA MAP file (manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz) contains the output and results from the MaNGA Data Analysis Pipeline (DAP). This example is based off of the MaNGA DAP Python Tutorial, and plots the g-band flux, the H-alpha emission line flux, and the stellar velocity field from MaNGA.

The full description of contents of the the MaNGA MAP file is available here.

Let’s open the file and view some basic information:

# Open MaNGA MAP file
manga_map = fits.open('manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz')

# Print information on file extensions
manga_map.info()
Filename: manga-7443-12703-MAPS-HYB10-MILESHC-MASTARSSP.fits.gz
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU     147   ()      
  1  SPX_SKYCOO    1 ImageHDU        44   (74, 74, 2)   float32   
  2  SPX_ELLCOO    1 ImageHDU        49   (74, 74, 4)   float32   
  3  SPX_MFLUX     1 ImageHDU        37   (74, 74)   float32   
  4  SPX_MFLUX_IVAR    1 ImageHDU        38   (74, 74)   float32   
  5  SPX_SNR       1 ImageHDU        35   (74, 74)   float32   
  6  BINID         1 ImageHDU        46   (74, 74, 5)   int32   
  7  BIN_LWSKYCOO    1 ImageHDU        44   (74, 74, 2)   float32   
  8  BIN_LWELLCOO    1 ImageHDU        49   (74, 74, 4)   float32   
  9  BIN_AREA      1 ImageHDU        36   (74, 74)   float32   
 10  BIN_FAREA     1 ImageHDU        35   (74, 74)   float32   
 11  BIN_MFLUX     1 ImageHDU        38   (74, 74)   float32   
 12  BIN_MFLUX_IVAR    1 ImageHDU        39   (74, 74)   float32   
 13  BIN_MFLUX_MASK    1 ImageHDU        38   (74, 74)   int32   
 14  BIN_SNR       1 ImageHDU        35   (74, 74)   float32   
 15  STELLAR_VEL    1 ImageHDU        38   (74, 74)   float32   
 16  STELLAR_VEL_IVAR    1 ImageHDU        39   (74, 74)   float32   
 17  STELLAR_VEL_MASK    1 ImageHDU        38   (74, 74)   int32   
 18  STELLAR_SIGMA    1 ImageHDU        38   (74, 74)   float32   
 19  STELLAR_SIGMA_IVAR    1 ImageHDU        39   (74, 74)   float32   
 20  STELLAR_SIGMA_MASK    1 ImageHDU        38   (74, 74)   int32   
 21  STELLAR_SIGMACORR    1 ImageHDU        44   (74, 74, 2)   float32   
 22  STELLAR_FOM    1 ImageHDU        59   (74, 74, 9)   float32   
 23  EMLINE_SFLUX    1 ImageHDU        79   (74, 74, 35)   float32   
 24  EMLINE_SFLUX_IVAR    1 ImageHDU        80   (74, 74, 35)   float32   
 25  EMLINE_SFLUX_MASK    1 ImageHDU        79   (74, 74, 35)   int32   
 26  EMLINE_SEW    1 ImageHDU        79   (74, 74, 35)   float32   
 27  EMLINE_SEW_CNT    1 ImageHDU        77   (74, 74, 35)   float32   
 28  EMLINE_SEW_IVAR    1 ImageHDU        80   (74, 74, 35)   float32   
 29  EMLINE_SEW_MASK    1 ImageHDU        79   (74, 74, 35)   int32   
 30  EMLINE_GFLUX    1 ImageHDU        79   (74, 74, 35)   float32   
 31  EMLINE_GFLUX_IVAR    1 ImageHDU        80   (74, 74, 35)   float32   
 32  EMLINE_GFLUX_MASK    1 ImageHDU        79   (74, 74, 35)   int32   
 33  EMLINE_GEW    1 ImageHDU        79   (74, 74, 35)   float32   
 34  EMLINE_GEW_CNT    1 ImageHDU        77   (74, 74, 35)   float32   
 35  EMLINE_GEW_IVAR    1 ImageHDU        80   (74, 74, 35)   float32   
 36  EMLINE_GEW_MASK    1 ImageHDU        79   (74, 74, 35)   int32   
 37  EMLINE_GVEL    1 ImageHDU        79   (74, 74, 35)   float32   
 38  EMLINE_GVEL_IVAR    1 ImageHDU        80   (74, 74, 35)   float32   
 39  EMLINE_GVEL_MASK    1 ImageHDU        79   (74, 74, 35)   int32   
 40  EMLINE_GSIGMA    1 ImageHDU        79   (74, 74, 35)   float32   
 41  EMLINE_GSIGMA_IVAR    1 ImageHDU        80   (74, 74, 35)   float32   
 42  EMLINE_GSIGMA_MASK    1 ImageHDU        79   (74, 74, 35)   int32   
 43  EMLINE_INSTSIGMA    1 ImageHDU        77   (74, 74, 35)   float32   
 44  EMLINE_TPLSIGMA    1 ImageHDU        77   (74, 74, 35)   float32   
 45  EMLINE_GA     1 ImageHDU        77   (74, 74, 35)   float32   
 46  EMLINE_GANR    1 ImageHDU        76   (74, 74, 35)   float32   
 47  EMLINE_FOM    1 ImageHDU        59   (74, 74, 9)   float32   
 48  EMLINE_LFOM    1 ImageHDU        76   (74, 74, 35)   float32   
 49  SPECINDEX     1 ImageHDU       135   (74, 74, 46)   float32   
 50  SPECINDEX_IVAR    1 ImageHDU       136   (74, 74, 46)   float32   
 51  SPECINDEX_MASK    1 ImageHDU        90   (74, 74, 46)   int32   
 52  SPECINDEX_CORR    1 ImageHDU        87   (74, 74, 46)   float32   
 53  SPECINDEX_MODEL    1 ImageHDU        87   (74, 74, 46)   float32   
 54  SPECINDEX_BF    1 ImageHDU       135   (74, 74, 46)   float32   
 55  SPECINDEX_BF_IVAR    1 ImageHDU       136   (74, 74, 46)   float32   
 56  SPECINDEX_BF_MASK    1 ImageHDU        90   (74, 74, 46)   int32   
 57  SPECINDEX_BF_CORR    1 ImageHDU        87   (74, 74, 46)   float32   
 58  SPECINDEX_BF_MODEL    1 ImageHDU        87   (74, 74, 46)   float32   
 59  SPECINDEX_WGT    1 ImageHDU       135   (74, 74, 46)   float32   
 60  SPECINDEX_WGT_IVAR    1 ImageHDU       136   (74, 74, 46)   float32   
 61  SPECINDEX_WGT_MASK    1 ImageHDU        90   (74, 74, 46)   int32   
 62  SPECINDEX_WGT_CORR    1 ImageHDU        87   (74, 74, 46)   float32   
 63  SPECINDEX_WGT_MODEL    1 ImageHDU        87   (74, 74, 46)   float32   

To make the plot in the next cell, we will use three different extensions of the MAP file. Here is the description of each of these extensions from the data model:

  • SPX_MFLUX

    • Description: “g-band-weighted mean flux, not corrected for Galactic extinction or internal attenuation.”

  • The EMLINE_GFLUX

    • Description: “gaussian profile integrated flux from a combined continuum+emission-line fit. The flux ratio of the [NeIII], [OIII], [OI], [NII], and [S III] lines are fixed and cannot be treated as independent measurements. The emission-line fluxes account for Galactic reddening using the E(B-V) (copied to the DAP primary headers, see the EBVGAL header keyword) value provided by the DRP header and assuming an O’Donnell (1994, ApJ, 422, 158) reddening law; however, no attenuation correction is applied for dust internal to the galaxy. See here for more information.”

    • Specifically, we will be using the H-alpha emission line flux from this extension

  • STELLAR_VEL

    • Description: “Line-of-sight stellar velocity, relative to the input guess redshift (given as cz by the keyword SCINPVEL in the header of the PRIMARY extension, and most often identical to the NSA redshift).”

#=========================================
# Set up Plot
#=========================================
plt.figure(figsize=(12, 6))
# Grab the WCS information from the header
manga_wcs = WCS(manga_map['SPX_MFLUX'].header)
ax1 = plt.subplot(131, projection=manga_wcs)
ax2 = plt.subplot(132, projection=manga_wcs)
ax3 = plt.subplot(133, projection=manga_wcs)

for ax in [ax1, ax2, ax3]:
    ax.set_xlabel('Right Ascension')
    ax.set_ylabel('Declination')


#=========================================
# Subplot 1: MaNGA Flux Map
#=========================================
# The 'SPX_MFLUX' ext contains the g-band-weighted mean flux
manga_flux = manga_map['SPX_MFLUX'].data
manga_flux[manga_flux == 0] = np.nan # mask for quality data

# Plot image
im = ax1.imshow(manga_flux, cmap='Greys_r')
ax1.set_title('MaNGA g-band Flux')
plt.colorbar(im, label=r'Flux [$10^{-17}$ erg/s/cm$^{2}$/Å/spaxel]',
             orientation='horizontal')
             

#=========================================
# Subplot 2: MaNGA H-Alpha Emission Map
#=========================================

# Define the emission line indexes for this ext
emline = {}
for k, v in manga_map['EMLINE_GFLUX'].header.items():
    if k[0] == 'C':
        try:
            i = int(k[1:])-1
        except ValueError:
            continue
        emline[v] = i
        
# The 'EMLINE_GFLUX' ext contains the emission line measurements
h_alpha_flux = np.copy(manga_map['EMLINE_GFLUX'].data[emline['Ha-6564']])
h_alpha_flux[h_alpha_flux == 0] = np.nan # mask for quality data

# Plot image
im = ax2.imshow(h_alpha_flux, cmap='magma', vmin=0, vmax=200)
plt.colorbar(im, label=r'H-$\alpha$ Emission [$10^{-17}$ erg/s/cm$^{2}$/spaxel]',
             orientation='horizontal')

ax2.set_title(r'H-$\alpha$ Emission')

#=========================================
# Subplot 3: MaNGA Stellar Velocity Field
#=========================================
# The 'STELLAR_VEL' ext contains the stellar velocity measurements
qual_mask = manga_map['STELLAR_VEL'].header['QUALDATA'] # mask for quality data
velocity_map = np.ma.MaskedArray(manga_map['STELLAR_VEL'].data,
                                 mask=manga_map[qual_mask].data > 0)

# plot Image
im = ax3.imshow(velocity_map, interpolation='nearest', 
                vmin=-125, vmax=125, cmap='RdBu_r')

ax3.set_title(r'Stellar Velocity')
plt.colorbar(im, label=r'Stellar Velocity [km/s]',
             orientation='horizontal')

#plt.subplots_adjust(hspace=0)

plt.tight_layout()
plt.show()
../../../_images/6a371050bd4b4f392abfe496e7658f2d481f20187d2a1e24030963df51b53ae4.png

Searching for HST observations of this galaxy#

Coordinate search using astroquery.mast#

Now let’s search for HST obersvations of this same galaxy. Similar to before, we will be using Observations.query_criteria() to search the MAST archive, but this time, we will search for HST observations (obs_collection='HST') near the coordinates of this MaNGA galaxy pair.

# Retrieve RA and DEC of MaNGA observations
ra = manga_obs_list['s_ra'][0]
dec = manga_obs_list['s_dec'][0]
# make a SkyCoord object from these coordinates
coord = SkyCoord(ra=ra*u.deg, dec=dec*u.deg)
print(coord)

# Search for HST observations based on coordinates
hst_obs = Observations.query_criteria(# Search by coordinates
                                      coordinates=coord, 
                                      # Search for HST observations
                                      obs_collection='HST',
                                      # Select only Science observations (not calibration files)
                                      intentType='science',
                                      # Select calibrated reduced observations
                                      provenance_name='CAL*') 

# Display Results
hst_obs
<SkyCoord (ICRS): (ra, dec) in deg
    (229.52558, 42.745842)>
Table masked=True length=3
intentTypeobs_collectionprovenance_nameinstrument_nameprojectfilterswavelength_regiontarget_nametarget_classificationobs_ids_ras_decdataproduct_typeproposal_picalib_levelt_mint_maxt_exptimeem_minem_maxobs_titlet_obs_releaseproposal_idproposal_typesequence_numbers_regionjpegURLdataURLdataRightsmtFlagsrcDenobsidobjIDobjID1distance
str7str3str6str7str3str5str8str6str72str9float64float64str5str16int64float64float64float64float64float64str92float64str5str2int64str1018str34str35str6boolfloat64str8str9str9float64
scienceHSTCALACSACS/WFCHSTF435WOpticalVV705GALAXY;INTERACTING GALAXYj9cv55010229.5262542.74361111111imageEvans, Aaron S.353688.66626797453553688.6852494560151320.0370.0479.99999999999994An ACS Survey of a Complete Sample of Luminous Infrared Galaxies in the Local Universe54054.3758217110592GO--POLYGON -130.43192424000009 42.709320519999878 -130.43365449999982 42.737909309999957 -130.4337529317022 42.737911043013639 -130.43380304000004 42.738738559999888 -130.43390147880342 42.738740292976125 -130.43395158999988 42.739567809999961 -130.4342075292484 42.739572315111893 -130.4360726999999 42.765917500000093 -130.43616278895598 42.765919959882218 -130.43622134999993 42.766746739999988 -130.43631144527563 42.766749199904545 -130.43637000999993 42.767575989999933 -130.51272945999986 42.769635319999914 -130.51073934999991 42.742010469999961 -130.51064930025817 42.742008068768754 -130.51058976999991 42.741181329999925 -130.51049972627087 42.741178928778268 -130.51047888276389 42.740889446885376 -130.51120778999976 42.740901790000045 -130.50944171000017 42.712314169999942 -130.50934332360208 42.712312501929482 -130.50929222999994 42.711485029999928 -130.50919384069635 42.711483361716873 -130.50914275000005 42.710655890000126 -130.43192424000009 42.709320519999878 -130.43192424000009 42.709320519999878mast:HST/product/j9cv55010_drz.jpgmast:HST/product/j9cv55010_drz.fitsPUBLICFalsenan248263493741715763741715760.0
scienceHSTCALACSACS/WFCHSTF814WOpticalVV705GALAXY;INTERACTING GALAXYj9cv55020229.5262542.74361111111imageEvans, Aaron S.353688.7314298263953688.74207797454760.0708.0959.0An ACS Survey of a Complete Sample of Luminous Infrared Galaxies in the Local Universe54054.3968054710592GO--POLYGON -130.43207268999996 42.710149770000072 -130.43380304000004 42.738738559999888 -130.43390147880342 42.738740292976125 -130.43395159 42.73956781 -130.43429750999272 42.739573898841904 -130.43622134999993 42.766746739999988 -130.51257979000002 42.768806179999935 -130.51058976999991 42.741181329999925 -130.48078808475015 42.740382738212055 -130.51120778999996 42.74090179 -130.50944171000003 42.71231417 -130.50934332360211 42.712312501929581 -130.50929222999994 42.711485029999928 -130.43207268999996 42.710149770000072 -130.43207268999996 42.710149770000072mast:HST/product/j9cv55020_drz.jpgmast:HST/product/j9cv55020_drz.fitsPUBLICFalsenan248263503692880613692880610.0
scienceHSTCALWF3WFC3/IRHSTF160WInfraredVV-705GALAXY;INTERACTING GALAXY;MULTIPLE NUCLEI;ULTRALUMINOUS IR GAL;STARBURSTia1e42010229.5262542.74361111111imageSurace, Jason A.355191.0802018518555191.143445173612395.3989241393.89999999999991692.4HST NICMOS Survey of the Nuclear Regions of Luminous Infrared Galaxies in the Local Universe55556.2257755111235GO--POLYGON -130.45141896 42.72726823 -130.45139424562964 42.727623085811551 -130.45085739 42.72760092 -130.45083267175158 42.727955780706409 -130.45029576000002 42.72793361 -130.44791957 42.76202341 -130.44881279242628 42.762060290893743 -130.44877189 42.76264689 -130.50066389 42.76477749 -130.50068833934091 42.764422591918347 -130.50122566 42.76444453 -130.50125010335393 42.764089669031847 -130.5017873 42.7641116 -130.50413399 42.73002074 -130.50324120188574 42.729984288688932 -130.50328157 42.72939763 -130.45141896 42.72726823 -130.45141896 42.72726823mast:HST/product/ia1e42010_drz.jpgmast:HST/product/ia1e42010_drz.fitsPUBLICFalsenan247945493977534453977534450.0

The table of results shown above tells us that there are three observations of this galaxy from HST, in three different filters: F160W, F435W, and F814W. Let’s see what data products are available associated with these observations:

hst_products = Observations.get_product_list(hst_obs)

# Filter product list 
hst_products = Observations.filter_products(hst_products,
                                            # Select science files
                                            productType="SCIENCE",
                                            # Recommended Products
                                            productGroupDescription="Minimum Recommended Products", 
                                            # Select DRZ files - the calibrated combined images
                                            productSubGroupDescription='DRZ')
hst_products
Table masked=True length=3
obsIDobs_collectiondataproduct_typeobs_iddescriptiontypedataURIproductTypeproductGroupDescriptionproductSubGroupDescriptionproductDocumentationURLprojectprvversionproposal_idproductFilenamesizeparent_obsiddataRightscalib_levelfilters
str8str3str5str35str64str1str95str9str28str11str1str7str20str5str50int64str8str6int64str9
24794549HSTimageia1e42010DADS DRZ file - Calibrated combined image ACS/WFC3/WFPC2/STISDmast:HST/product/ia1e42010_drz.fitsSCIENCEMinimum Recommended ProductsDRZ--CALWF33.7.1 (Oct-18-2023)11235ia1e42010_drz.fits1357632024794549PUBLIC3F160W
24826349HSTimagej9cv55010DADS DRZ file - Calibrated combined image ACS/WFC3/WFPC2/STISDmast:HST/product/j9cv55010_drz.fitsSCIENCEMinimum Recommended ProductsDRZ--CALACSDrizzlePac 3.6.210592j9cv55010_drz.fits22126176024826349PUBLIC3F435W
24826350HSTimagej9cv55020DADS DRZ file - Calibrated combined image ACS/WFC3/WFPC2/STISDmast:HST/product/j9cv55020_drz.fitsSCIENCEMinimum Recommended ProductsDRZ--CALACSDrizzlePac 3.6.210592j9cv55020_drz.fits21780000024826350PUBLIC3F814W

With our products selected, we can proceed to download. We’ll use flat=True to put them all into the same directory.

# Download products
Observations.download_products(hst_products, flat=True)
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ia1e42010_drz.fits to ./ia1e42010_drz.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/j9cv55010_drz.fits to ./j9cv55010_drz.fits ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/j9cv55020_drz.fits to ./j9cv55020_drz.fits ...
 [Done]
Table length=3
Local PathStatusMessageURL
str20str8objectobject
./ia1e42010_drz.fitsCOMPLETENoneNone
./j9cv55010_drz.fitsCOMPLETENoneNone
./j9cv55020_drz.fitsCOMPLETENoneNone

Plot the HST images#

Let’s plot the three HST images.

# Open files
f160w = fits.open('ia1e42010_drz.fits')
f435w = fits.open('j9cv55010_drz.fits')
f814w = fits.open('j9cv55020_drz.fits')


f160w_wcs = WCS(f160w[1].header)
f435w_wcs = WCS(f435w[1].header)
f814w_wcs = WCS(f814w[1].header)

#=========================================
# Set up Plot
#=========================================
fig = plt.figure(figsize=(15, 5))
ax1 = plt.subplot(131, projection=f160w_wcs)
ax2 = plt.subplot(132, projection=f435w_wcs)
ax3 = plt.subplot(133, projection=f814w_wcs)

for ax in [ax1, ax2, ax3]:
    ax.set_xlabel('Right Ascension')
    ax.set_ylabel('Declination')

#=========================================
# Subplot 1: F160W filter image
#=========================================
# Note - this image is upside-down compared to the other two
fits_file = f160w
ax1.imshow(fits_file[1].data, cmap='Greys_r', vmin=0, vmax=2.5, origin='lower')
ax1.set_title(f"{fits_file[0].header['INSTRUME']}/{fits_file[0].header['FILTER']}")

#=========================================
# Subplot 2: F435W filter image
#=========================================
fits_file = f435w
wcs = WCS(fits_file[1].header)
ax2.imshow(fits_file[1].data, cmap='Greys_r', vmin=0, vmax=0.5, origin='lower')
ax2.set_title(f"{fits_file[0].header['INSTRUME']}/{fits_file[0].header['FILTER2']}")

#=========================================
# Subplot 3: F814W filter image
#=========================================
fits_file = f814w
wcs = WCS(fits_file[1].header)
ax3.imshow(fits_file[1].data, cmap='Greys_r', vmin=0, vmax=0.5, origin='lower')
ax3.set_title(f"{fits_file[0].header['INSTRUME']}/{fits_file[0].header['FILTER2']}")

plt.tight_layout()
plt.show()
../../../_images/94427d0b59edfd98d05744b0254c3cd1135379d82af6bf9bc9d417906d6e4531.png

Colorizing HST images with astropy#

We can combine all three HST images here and colorize them using the make_lupton_rgb() function from astropy. This function takes image data from three filter images, and combines them as an RGB image. In this example, we will order by wavelength and map the IR filter (F160W) to the red channel (‘r’), the F814W filter to the green channel (‘g’), and the F435W filter to the blue channel (‘b’).

Before we colorize the images, however, we need to reproject them onto the same coordinate system. We will resample the F160W and F814W images to the same projection as the F435W image, because the F435W image is the largest.

# Print image shapes:
print(f"F160W shape: {f160w[1].data.shape}")
print(f"F814W shape: {f814w[1].data.shape}")
print(f"F435W shape: {f435w[1].data.shape}")

# Reproject all three HST images into the same frame (using F435W image as base)
# This may take about a minute.
r, _ = reproject.reproject_interp(f160w[1], f435w[1].header)
g, _ = reproject.reproject_interp(f814w[1], f435w[1].header)
b, _ = reproject.reproject_interp(f435w[1], f435w[1].header)

# Colorize image using the three filters
hst_image = make_lupton_rgb(r*0.1, g, b*2.5, Q=4, stretch=0.75)
F160W shape: (995, 1124)
F814W shape: (4298, 4220)
F435W shape: (4358, 4228)

Our reprojection and colorization is complete! Let’s now plot the image.

# Make plot
plt.figure(figsize=(5, 10))
ax = plt.subplot(projection=f435w_wcs)

# Plot image
ax.imshow(hst_image)

# Zoom in
ax.set_xlim(1800, 2600)
ax.set_ylim(2000, 2900)

# Label Plot
ax.set_xlabel('Right Ascension')
ax.set_ylabel('Declination')
ax.set_title('HST Image (colorized)')
plt.show()
../../../_images/d0e928efaa7a8205579686bd44ae4cb36ef1e7b7385a1b5949ef388827570072.png

This image looks great! There are certainly a few places where bright spots in one image are affecting the final result; this can be seen as the green speckles across the lower third of the image.


Combining MaNGA and HST data#

Now that we have downloaded both MaNGA and HST data, let’s combine them into one plot to map some of properties of this merging pair of galaxies!

The key to combining the HST and MaNGA data is the World Coordinate System (WCS) transformations done by astropy. Using information from the file headers, astropy.wcs() will calculate the RA and DEC coordinates corresponding to each pixel in the image, allowing us to project both datasets on the same figure.

# Store WCS for easy coordinate transformations
hst_wcs = WCS(f435w[1].header)
manga_wcs = WCS(manga_map[3].header)

#=========================================
# Set up Plot
#=========================================
plt.figure(figsize=(15, 5))

ax1 = plt.subplot(131, projection=hst_wcs)
ax2 = plt.subplot(132, projection=hst_wcs)
ax3 = plt.subplot(133, projection=hst_wcs)

for ax in [ax1, ax2, ax3]:
    # Zoom in
    ax.set_xlim(1850, 2550)
    ax.set_ylim(2300, 3000)
    # Label Axes
    ax.set_xlabel('RA')
    ax.set_ylabel('Dec')
    # Plot Grid
    ax.grid(color='white', ls='dotted', alpha=0.5)

    
#=========================================
# Subplot 1: HST Image
#=========================================
ax1.imshow(hst_image)
ax1.set_title('HST Image (colorized)')

#=========================================
# Subplot 2: MaNGA H-alpha Emission
#=========================================
ax2.set_title(r'MaNGA H-$\alpha$ Flux' + '\n' + r'[$10^{-17}$ erg/s/cm$^{2}$/spaxel]')

h_alpha_flux = np.copy(manga_map['EMLINE_GFLUX'].data[emline['Ha-6564']])
h_alpha_flux[h_alpha_flux == 0] = np.nan # mask for quality data


# Plot H-alpha flux
ax2.imshow(np.log10(h_alpha_flux),
           transform=ax2.get_transform(manga_wcs),
           cmap='magma', vmin=0, vmax=2)

# Plot MaNGA contours
contour_levels = [1, 10, 20, 50, 100]
contour_labels = [str(c) for c in contour_levels]
fmt = {}
for label_level, label_string in zip(contour_levels, contour_labels):
    fmt[label_level] = label_string

contours = ax2.contour(h_alpha_flux,
                       transform=ax2.get_transform(manga_wcs),
                       levels=contour_levels, colors='white')
ax2.clabel(contours, contours.levels, inline=True, fmt=fmt, fontsize=12)


#=========================================
# Subplot 3: HST + MaNGA
#=========================================
ax3.set_title(r'HST + MaNGA H-$\alpha$ Contours')

# Plot background HST image
ax3.imshow(hst_image)
    
# Plot MaNGA contours
contours = ax3.contour(h_alpha_flux,
                       transform=ax3.get_transform(manga_wcs),
                       levels=contour_levels, colors='white')
ax3.clabel(contours, contours.levels, inline=True, fmt=fmt, fontsize=8)


plt.tight_layout()
plt.show()
../../../_images/6f01fa398f31b2519a132de03769577d228660a227246f60fce79722bdf4da7b.png

This plot encapsulates everything we have learned so far, showing the colorized HST image (left), the H-alpha flux from MaNGA (middle), and combining them both into a single image (right).

Creating an H-alpha Emission Map#

We can isolate the last panel and plot it by itself, too.

plt.figure(figsize=(10, 10))
ax = plt.subplot(projection=hst_wcs)
ax.set_xlim(1950, 2550)
ax.set_ylim(2350, 2900)
plt.xlabel(r'Right Ascension')
plt.ylabel(r'Declination')
plt.title(r'HST Image + H-$\alpha$ Emission from MaNGA')

# Plot the HST image
ax.imshow(hst_image)


# Plot MaNGA contours
contour_levels = [1, 10, 20, 50, 100]
contour_labels = [str(c) for c in contour_levels]
contour_labels[0] = r'1 $\times10^{-17}$ erg/s/cm$^{2}$/spaxel'
fmt = {}
for label_level, label_string in zip(contour_levels, contour_labels):
    fmt[label_level] = label_string

contours = ax.contour(h_alpha_flux,
                      transform=ax.get_transform(manga_wcs),
                      levels=contour_levels, colors='white')
ax.clabel(contours, contours.levels, inline=True, fmt=fmt, fontsize=14)

plt.savefig('manga_halpha_map.png')
plt.show()
../../../_images/acb77fa2eef3143dbbff627e93bf3cb3d6263c39510ed68654bd1e4fda78930a.png

In this figure, we can see that the H-alpha flux from MaNGA follows the spiral arms of the top galaxy, and the emission is strongest near the center of both galaxies.

Plotting the stellar velocity field#

Last but not least, let’s do the same thing with the stellar velocity! The stellar velocity field from MaNGA will show which parts of the galaxies are redshifted (moving away from us, which we will plot in red), and which parts are blueshifted (moving toward us, which we will plot in blue).

plt.figure(figsize=(14, 10))
ax = plt.subplot(projection=WCS(f435w[1].header))

ax.imshow(f435w[1].data, vmin=0, vmax=0.5, cmap='Greys_r',
          transform=ax.get_transform(WCS(f435w[1].header)))

ax.set_xlim(1950, 2550)
ax.set_ylim(2350, 2900)

bin_indx = manga_map['BINID'].data[1]
unique_bins, unique_indices = tuple(map(lambda x: x[1:],
                                        np.unique(bin_indx.ravel(), return_index=True)))

x_pix = np.array([x for y in range(74) for x in range(74)])[unique_indices]
y_pix = np.array([y for y in range(74) for x in range(74)])[unique_indices]
v_map = velocity_map.ravel()[unique_indices]

# Get the luminosity-weighted x and y coordinates of the unique bins
im = ax.scatter(x_pix, y_pix, c=v_map,
                marker='.', s=100, lw=0,
                vmin=-150, vmax=150, cmap='seismic', 
                transform=ax.get_transform(manga_wcs))

plt.colorbar(im, label='Stellar Velocity [km/s]')


plt.xlabel(r'Right Ascension')
plt.ylabel(r'Declination')
plt.title(r'Stellar Velocity from MaNGA')

plt.savefig('manga_velocity_map.png')
plt.show()
../../../_images/1fc1d39f764477c740311ea5de4f50fb0409193ca862f4220d9a10048fb4cb5b.png

This plot shows that this galaxy pair is rotating vertically (from the perspective of this image). The arm in the upper galaxy is blueshifted, while most of the lower galaxy, and the end of the arm is redshifted.


Congratulations! You have reached the end of this tutorial notebook. You have learned how to access and download MaNGA data from MAST, and combine it with HST images to map different properties for this merging pair of galaxies.

Additional Resources#

Additional resources are linked below:

Citations#

If you use MaNGA data for published research, see the following links for information on which citations to include in your paper:

About this Notebook#

For questions or issues with this notebook, you can open a github issue or email archive@stsci.edu.

Authors: Julie Imig, Brian Cherinka
Keywords: Tutorial, SDSS, MaNGA, HST, galaxies
First published: October 2024
Last updated: October 2024


Top of Page Space Telescope Logo