Proposal Preparation Solution#

The Story: Suppose that you are preparing to write a proposal on NGC1365, aiming to investigate the intriguing black hole spin this galaxy with Chandra grating observations (see: Monster Blackhole Spin Revealed)

In writing proposals, there are often the same tasks that are required: including finding and analyzing previous observations of the proposal, and creating figures that include, e.g., multiwavelength images and spectrum for the source.

# As a hint, we include the code block for Python modules that you will likely need to import:
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

# For downloading files
from astropy.utils.data import download_file
from astropy.io import fits

import pyvo as vo

## There are a number of relatively unimportant warnings that
## show up, so for now, suppress them:
import warnings
warnings.filterwarnings("ignore", module="astropy.io.votable.*")
warnings.filterwarnings("ignore", module="pyvo.utils.xml.*")

Step 1: Find out what the previously quoted Chandra 2-10 keV flux of the central source is for NGC 1365#

Hint: Do a Registry search for tables served by the HEASARC (where high energy data are archived) to find potential table with this information

#  This gets all services matching, which should be a list of only one:
tap_services=vo.regsearch(servicetype='table',keywords=['heasarc'])
#  This fetches the list of tables that this service serves:
heasarc_tables=tap_services[0].service.tables

Hint: The Chansngcat table is likely the best table. Create a table with ra, dec, exposure time, and flux (and flux errors) from the public.chansngcat catalog for Chandra observations matched within 0.1 degree.

for tablename in heasarc_tables.keys():
    if "chansng" in tablename:
        print("Table {} has columns={}\n".format(
            tablename,
            sorted([k.name for k in heasarc_tables[tablename].columns ])))
Table chansngcat has columns=['__row', '__x_ra_dec', '__y_ra_dec', '__z_ra_dec', 'agn_flag', 'bii', 'class', 'dec', 'distance', 'exposure', 'fit_chi_squared', 'fit_dof', 'flux', 'flux_lower', 'flux_upper', 'hardness_ratio_0', 'hardness_ratio_0_error', 'hardness_ratio_1', 'hardness_ratio_1_error', 'hardness_ratio_2', 'hardness_ratio_2_error', 'hubble_type', 'instrument', 'lii', 'log_blackhole_mass', 'log_blackhole_mass_lower', 'log_blackhole_mass_upper', 'log_l_cpt1', 'log_l_cpt2', 'log_l_halpha', 'log_l_halpha_flag', 'log_lx', 'log_lx_lower', 'log_lx_note', 'log_lx_upper', 'name', 'nh', 'nh_from_hr', 'nh_from_hr_lower', 'nh_from_hr_upper', 'nh_gal', 'nh_lower', 'nh_upper', 'nuclear_class', 'obsid', 'off_set', 'ra', 'ref_spectrum', 'sigma', 'sigma_error', 'source_number', 'spectral_index', 'spectral_index_lower', 'spectral_index_upper', 'spectral_model', 'spectral_norm_cpt1', 'spectral_norm_cpt2', 'temperature', 'temperature_lower', 'temperature_upper']
# Get the coordinate for NGC 1365
import astropy.coordinates as coord
pos=coord.SkyCoord.from_name("ngc1365")
# Construct a query that will get the ra, dec, exposure time, flux, and flux errors
#  from this catalog in the region around this source:
query="""SELECT ra, dec, exposure, flux, flux_lower, flux_upper FROM public.chansngcat as cat
    where contains(point('ICRS',cat.ra,cat.dec),circle('ICRS',{},{},0.1))=1
    and cat.exposure > 0 order by cat.exposure""".format(pos.ra.deg, pos.dec.deg)
#  Submit the query.  (See the CS_Catalog_queries.md for
#    information about these two search options.)
results=tap_services[0].service.run_async(query)
#results=tap_services[0].search(query)
#  Look at the results
results.to_table()
Table length=1
radecexposurefluxflux_lowerflux_upper
degdegserg/s/cm^2erg/s/cm^2erg/s/cm^2
float64float64float64float64float64float64
53.40192-36.14067155007.751e-127.1727e-128.2075e-12

Step 2: Make Images#

Create ultraviolet and X-ray images#

Hint: Start by checking what UV image services exist (e.g., GALEX?)

## Note that to browse the columns, use the .to_table() method
uv_services=vo.regsearch(servicetype='image',keywords='galex', waveband='uv')
uv_services.to_table()['ivoid','short_name']
Table length=3
ivoidshort_name
objectobject
ivo://archive.stsci.edu/sia/galexGALEX
ivo://mast.stsci/siap/galex_atlasGALEX_Atlas
ivo://nasa.heasarc/skyview/galexGALEX

The keyword search for ‘galex’ returned a bunch of things that may have mentioned it, but let’s just use the ones that have GALEX as their short name:

uv_services.to_table()[
    np.array(['GALEX' in u.short_name for u in uv_services])
    ]['ivoid', 'short_name']
Table length=3
ivoidshort_name
objectobject
ivo://archive.stsci.edu/sia/galexGALEX
ivo://mast.stsci/siap/galex_atlasGALEX_Atlas
ivo://nasa.heasarc/skyview/galexGALEX

Though using the result as an Astropy Table makes it easier to look at the contents, to call the service itself, we cannot use the row of that table. You have to use the entry in the service result list itself. So use the table to browse, but select the list of services itself using the properties that have been defined as attributes such as short_name and ivoid:

galex_stsci=[s for s in uv_services if 'GALEX' in s.short_name and 'stsci' in s.ivoid][0]
galex_heasarc=[s for s in uv_services if 'GALEX' in s.short_name and 'heasarc' in s.ivoid][0]

Hint: Next create a UV image for the source

# Do an image search for NGC 1365 in the UV service found above
im_table_stsci=galex_stsci.search(pos=pos,size=0.1)
im_table_stsci.to_table()
Table length=809
productTypeimageFormatcontentLengthnamecollectioninsnamemetaReleasedataReleasetrgposRAtrgPosDecs_regionposition_naxesposition_naxisposition_scalecrpixcrvalcdmatrixcoordFrameprojectionposition_ctype1position_ctype2position_cunit1position_cunit2timBoundsSTCStime_bounds_cval1time_bounds_cval2time_bounds_centertimExposureenergy_bandpassNameenergy_bounds_cval1energy_bounds_cval2energy_bounds_centerenergy_unitspublisherDIDaccessURLcloud_access
objectobjectint32objectobjectobjectobjectobjectfloat64float64objectint32objectobjectobjectobjectobjectobjectstr3objectobjectobjectobjectobjectfloat64float64float64float64objectfloat64float64float64objectobjectobjectobject
CATALOGimage/fits12795448FORNAX_MOS07-xd-mcat.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-xd-mcat.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-xd-mcat.fits.gz"}}
AUXILIARYimage/fits26657879FORNAX_MOS07-nd-intbgsub.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-intbgsub.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-intbgsub.fits.gz"}}
AUXILIARYimage/fits69109FORNAX_MOS07-nd-flags.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-flags.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-flags.fits.gz"}}
AUXILIARYimage/fits25025FORNAX_MOS07-nd-flagstar.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-flagstar.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-flagstar.fits.gz"}}
THUMBNAILimage/jpeg11223FORNAX_MOS07-xd-int_2color_thumb.jpgGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/qa/FORNAX_MOS07-xd-int_2color_thumb.jpg{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/qa/FORNAX_MOS07-xd-int_2color_thumb.jpg"}}
INFOimage/fits16434FORNAX_MOS07-nd-cat_mch_rtastar.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-cat_mch_rtastar.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-cat_mch_rtastar.fits.gz"}}
PREVIEWimage/jpeg606044FORNAX_MOS07-xd-int_2color_medium_annot.jpgGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/qa/FORNAX_MOS07-xd-int_2color_medium_annot.jpg{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/qa/FORNAX_MOS07-xd-int_2color_medium_annot.jpg"}}
SCIENCEimage/fits21333361FORNAX_MOS07-nd-int.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-int.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-int.fits.gz"}}
AUXILIARYimage/fits6466083FORNAX_MOS07-nd-cnt.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-cnt.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-cnt.fits.gz"}}
AUXILIARYimage/fits2512896FORNAX_MOS07-nd-skybg.fits.gzGALEXGALEX5/11/2010 12:14:57 AM5/11/2010 12:14:57 AM54.0331936068986-36.367881838288CIRCLE ICRS 54.03319361 -36.36788184 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][54.0332 -36.3679][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54105.698090 55148.07208354105.698090277855148.072083333354626.88508680563241.6NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?2555337728220725248https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-skybg.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/01-vsn/07091-FORNAX_MOS07/d/01-main/0001-img/07-try/FORNAX_MOS07-nd-skybg.fits.gz"}}
............................................................................................................
AUXILIARYimage/fits2203AIS_423_0002_sg49-fd-flag_tbl.fits.gzGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-flag_tbl.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-flag_tbl.fits.gz"}}
PREVIEWimage/jpeg618132AIS_423_0002_sg49-xd-int_2color_medium_annot.jpgGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/qa/AIS_423_0002_sg49-xd-int_2color_medium_annot.jpg{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/qa/AIS_423_0002_sg49-xd-int_2color_medium_annot.jpg"}}
AUXILIARYimage/fits54117AIS_423_0002_sg49-fd-exp.fits.gzGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-exp.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-exp.fits.gz"}}
AUXILIARYimage/fits3967636AIS_423_0002_sg49-fd-intbgsub.fits.gzGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-intbgsub.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-intbgsub.fits.gz"}}
AUXILIARYimage/fits11794AIS_423_0002_sg49-fd-flags.fits.gzGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-flags.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-fd-flags.fits.gz"}}
INFOimage/fits13483AIS_423_0002_sg49-rtastar.fits.gzGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-rtastar.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-rtastar.fits.gz"}}
INFOimage/fits8757AIS_423_0002_sg49-aspraw.fits.gzGALEXGALEX6/16/2010 2:52:42 AM6/16/2010 2:52:42 AM53.9452301043047-36.1117650864775CIRCLE ICRS 53.94523010 -36.11176509 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][53.9452 -36.1118][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 54460.401042 54460.40215354460.401041666754460.402152777854460.401597222296.0FUV1.34e-071.806e-071.573e-07metersivo://archive.stsci.edu/GALEX?6385798660088659968https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-aspraw.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0002-img/07-try/AIS_423_0002_sg49-aspraw.fits.gz"}}
INFOimage/fits11263AIS_423_0001_sg40-asp.fits.gzGALEXGALEX9/14/2012 11:17:05 PM9/14/2012 11:17:05 PM52.7737068509356-35.944179375355CIRCLE ICRS 52.77370685 -35.94417938 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][52.7737 -35.9442][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 55859.604201 55859.60582255859.604201388955859.605821759355859.6050115741140.0NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?6385798650391429120https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0001-img/07-try/AIS_423_0001_sg40-asp.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0001-img/07-try/AIS_423_0001_sg40-asp.fits.gz"}}
AUXILIARYimage/fits61937AIS_423_0001_sg40-nd-cat_mch_flagstar.fits.gzGALEXGALEX9/14/2012 11:17:05 PM9/14/2012 11:17:05 PM52.7737068509356-35.944179375355CIRCLE ICRS 52.77370685 -35.94417938 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][52.7737 -35.9442][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 55859.604201 55859.60582255859.604201388955859.605821759355859.6050115741140.0NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?6385798650391429120https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0001-img/07-try/AIS_423_0001_sg40-nd-cat_mch_flagstar.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0001-img/07-try/AIS_423_0001_sg40-nd-cat_mch_flagstar.fits.gz"}}
AUXILIARYimage/fits32793AIS_423_0001_sg40-nd-flag_tbl.fits.gzGALEXGALEX9/14/2012 11:17:05 PM9/14/2012 11:17:05 PM52.7737068509356-35.944179375355CIRCLE ICRS 52.77370685 -35.94417938 0.6252[3840 3840][-0.00041666667 0.00041666667][1920.5 1920.5][52.7737 -35.9442][-0.000416667 -0.0 -0.0 0.000416667]ICRSTANRA---TANDEC--TANdegdegRANGE 55859.604201 55859.60582255859.604201388955859.605821759355859.6050115741140.0NUV1.693e-073.007e-072.35e-07metersivo://archive.stsci.edu/GALEX?6385798650391429120https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0001-img/07-try/AIS_423_0001_sg40-nd-flag_tbl.fits.gz{"aws": {"bucket_name":"stpubdata","region":"us-east-1","access":"open","key":"galex/GR6/pipe/02-vsn/50423-AIS_423/d/00-visits/0001-img/07-try/AIS_423_0001_sg40-nd-flag_tbl.fits.gz"}}
#  Let's see what HEASARC offers, and this time limit it to FITS
#   this option doesn't currently work for STScI's service)
im_table_heasarc=galex_heasarc.search(pos=pos,size=0.1,format='image/fits')
im_table_heasarc.to_table()
Table length=2
SurveyRaDecDimSizeScaleFormatPixFlagsURLLogicalName
objectfloat64float64int32objectobjectobjectobjectobjectobject
galexnear53.4019083-36.14065832[300 300][-0.0003333333333333334 0.0003333333333333334]image/fitsFhttps://skyview.gsfc.nasa.gov/cgi-bin/images?position=53.4019083%2C-36.1406583&survey=galexnear&pixels=300%2C300&sampler=LI&size=0.10000000000000002%2C0.10000000000000002&projection=Tan&coordinates=J2000.0&requestID=skv1704310798554&return=FITS1
galexfar53.4019083-36.14065832[300 300][-0.0003333333333333334 0.0003333333333333334]image/fitsFhttps://skyview.gsfc.nasa.gov/cgi-bin/images?position=53.4019083%2C-36.1406583&survey=galexfar&pixels=300%2C300&sampler=LI&size=0.10000000000000002%2C0.10000000000000002&projection=Tan&coordinates=J2000.0&requestID=skv1704310798765&return=FITS2
## If you only run this once, you can do it in memory in one line:
##  This fetches the FITS as an astropy.io.fits object in memory
#dataobj=im_table_heasarc[0].getdataobj()
## But if you might run this notebook repeatedly with limited bandwidth,
##  download it once and cache it.
file_name = download_file(im_table_heasarc[0].getdataurl(), cache=True, timeout=600)
dataobj=fits.open(file_name)
print(type(dataobj))
<class 'astropy.io.fits.hdu.hdulist.HDUList'>
# Get the FITS file (which is index 0 for the NUV image or index=2 for the FUV image)
from pylab import figure, cm
from matplotlib.colors import LogNorm
plt.matshow(dataobj[0].data, origin='lower', cmap=cm.gray_r, norm=LogNorm(vmin=0.005, vmax=0.3))
<matplotlib.image.AxesImage at 0x7f003c499c00>
../../_images/562a1eb47a96225892d2d094c82a4147202e02a94623836882b39f281951770e.png

Hint: Repeat steps for X-ray image. (Note: Ideally, we would find an image in the Chandra ‘cxc’ catalog)

x_services=vo.regsearch(servicetype='image',keywords=['chandra'], waveband='x-ray')
print(x_services.to_table()['short_name','ivoid'])
 short_name                 ivoid                 
----------- --------------------------------------
        CDA         ivo://cxc.harvard.edu/cda.siap
        CSC         ivo://cxc.harvard.edu/csc.siap
      CSCR1       ivo://cxc.harvard.edu/cscr1.siap
      CSCR2       ivo://cxc.harvard.edu/cscr2.siap
    Chandra          ivo://nasa.heasarc/chanmaster
GOODSACISFB ivo://nasa.heasarc/skyview/goodsacisfb
## Do an image search for NGC 1365 in the X-ray CDA service found above
xim_table=x_services[0].search(pos=pos,size=0.2)
## Some of these are FITS and some JPEG.  Look at the columns:
print( xim_table.to_table().columns )
first_fits_image_row = [x for x in xim_table if 'image/fits' in x.format][0]
<TableColumns names=('name','instrument','date_obs','ra','dec','naxis','imgscale','imgfmt','accref','filesize','obsid')>
## Create an image from the first FITS file (index=1) by downloading:
## See above for options
#xhdu_list=first_fits_image_row.getdataobj()
file_name = download_file(first_fits_image_row.getdataurl(), cache=True, timeout=600)
xhdu_list=fits.open(file_name)


plt.imshow(xhdu_list[0].data, origin='lower', cmap='cool', norm=LogNorm(vmin=0.1, vmax=500.))
plt.xlim(460, 560)
plt.ylim(460, 560)
(460.0, 560.0)
../../_images/bd1d82ec208c4da2eebc800d78bcd673b6ca0799183504bfa6796658c6aac656.png

Step 3: Make a spectrum#

Find what Chandra spectral observations exist already for this source#

Hint: try searching for X-ray spectral data tables using the registry query

# Use the TAP protocol to list services that contain X-ray spectral data
xsp_services=vo.regsearch(servicetype='ssa',waveband='x-ray')
xsp_services.to_table()['short_name','ivoid','waveband']
Table length=6
short_nameivoidwaveband
objectobjectobject
Chandraivo://nasa.heasarc/chanmasterx-ray
HITOMASTERivo://nasa.heasarc/hitomasterx-ray
INTEGRAL/BSCivo://nasa.heasarc/intbscgamma-ray#x-ray
RXTEivo://nasa.heasarc/xtemasterx-ray
NED_SEDivo://ned.ipac/sed_data_near_positionradio#millimeter#infrared#optical#uv#euv#x-ray#gamma-ray
HEAVENS @ ISDCivo://wfau.roe.ac.uk/heavens_at_isdc/light-curvesx-ray#gamma-ray

Hint 2: Take a look at what data exist for our candidate, NGC 1365.

spec_tables=xsp_services[0].search(pos=pos,radius=0.2,verbose=True)
spec_tables.to_table()
Table length=15
obsidstatusnameradectimedetectorgratingexposuretypepipublic_datedatalinkSSA_start_timeSSA_tmidSSA_stop_timeSSA_durationSSA_coord_obsSSA_raSSA_decSSA_fovSSA_titleSSA_referenceSSA_datalengthSSA_datamodelSSA_instrumentSSA_publisherSSA_formatSSA_wavelength_minSSA_wavelength_maxSSA_bandwidthSSA_bandpasscloud_access
degdegdsddddsdegdegdegdegmmmm
objectobjectobjectfloat64float64float64objectobjectfloat64objectobjectint32objectfloat64float64float64float64float64float64float64float64objectobjectobjectobjectobjectobjectobjectfloat64float64float64float64object
25036archivedNGC 136553.40192-36.1406659345.6677ACIS-SHETG18180GTOCanizares597104448:chandra.obs.misc59345.6677199074----18180.0--53.40192-36.140660.81acisf25036N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/6/25036/primary/acisf25036N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/6/25036/primary/acisf25036N001_pha2.fits.gz"}}
25024archivedNGC 136553.40192-36.1406659340.9376ACIS-SHETG14080GTOCanizares597104449:chandra.obs.misc59340.9376041667----14080.0--53.40192-36.140660.81acisf25024N002_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/4/25024/primary/acisf25024N002_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/4/25024/primary/acisf25024N002_pha2.fits.gz"}}
24737archivedNGC 136553.40192-36.1406659319.8031ACIS-SHETG20080GTOCanizares597104450:chandra.obs.misc59319.8030787037----20080.0--53.40192-36.140660.81acisf24737N002_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/7/24737/primary/acisf24737N002_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/7/24737/primary/acisf24737N002_pha2.fits.gz"}}
24787archivedNGC 136553.40192-36.1406659340.0616ACIS-SHETG39090GTOCanizares597104451:chandra.obs.misc59340.0615740741----39090.0--53.40192-36.140660.81acisf24787N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/7/24787/primary/acisf24787N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/7/24787/primary/acisf24787N001_pha2.fits.gz"}}
24788archivedNGC 136553.40192-36.1406659342.738ACIS-SHETG25080GTOCanizares597104452:chandra.obs.misc59342.737974537----25080.0--53.40192-36.140660.81acisf24788N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/8/24788/primary/acisf24788N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/8/24788/primary/acisf24788N001_pha2.fits.gz"}}
24789archivedNGC 136553.40192-36.1406659333.3037ACIS-SHETG21280GTOCanizares597104453:chandra.obs.misc59333.30375----21280.0--53.40192-36.140660.81acisf24789N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/9/24789/primary/acisf24789N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/9/24789/primary/acisf24789N001_pha2.fits.gz"}}
24790archivedNGC 136553.40192-36.1406659343.4834ACIS-SHETG18080GTOCanizares597104454:chandra.obs.misc59343.4834143519----18080.0--53.40192-36.140660.81acisf24790N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/0/24790/primary/acisf24790N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/0/24790/primary/acisf24790N001_pha2.fits.gz"}}
24792archivedNGC 136553.40192-36.1406659344.0923ACIS-SHETG17080GTOCanizares597104455:chandra.obs.misc59344.0923148148----17080.0--53.40192-36.140660.81acisf24792N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/2/24792/primary/acisf24792N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/2/24792/primary/acisf24792N001_pha2.fits.gz"}}
24791archivedNGC 136553.40192-36.1406659326.8302ACIS-SHETG26580GTOCanizares597104456:chandra.obs.misc59326.8301736111----26580.0--53.40192-36.140660.81acisf24791N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/1/24791/primary/acisf24791N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/1/24791/primary/acisf24791N001_pha2.fits.gz"}}
24793archivedNGC 136553.40192-36.1406659335.6602ACIS-SHETG17080GTOCanizares597104457:chandra.obs.misc59335.6602083333----17080.0--53.40192-36.140660.81acisf24793N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/3/24793/primary/acisf24793N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/3/24793/primary/acisf24793N001_pha2.fits.gz"}}
24794archivedNGC 136553.40192-36.1406659321.5437ACIS-SHETG38090GTOCanizares597104458:chandra.obs.misc59321.5437152778----38090.0--53.40192-36.140660.81acisf24794N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/4/24794/primary/acisf24794N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/4/24794/primary/acisf24794N001_pha2.fits.gz"}}
24795archivedNGC 136553.40192-36.1406659328.2974ACIS-SHETG27880GTOCanizares597104459:chandra.obs.misc59328.2974189815----27880.0--53.40192-36.140660.81acisf24795N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/5/24795/primary/acisf24795N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/5/24795/primary/acisf24795N001_pha2.fits.gz"}}
25015archivedNGC 136553.40192-36.1406659336.1988ACIS-SHETG17080GTOCanizares597104460:chandra.obs.misc59336.1987962963----17080.0--53.40192-36.140660.81acisf25015N001_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/5/25015/primary/acisf25015N001_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/5/25015/primary/acisf25015N001_pha2.fits.gz"}}
13921archivedNGC 136553.40167-36.1402856029.0272ACIS-SHETG110050GOReeves563984464:chandra.obs.misc56029.0271643518----110050.0--53.40167-36.140280.81acisf13921N002_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/1/13921/primary/acisf13921N002_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/1/13921/primary/acisf13921N002_pha2.fits.gz"}}
13920archivedNGC 136553.40167-36.1402856026.4065ACIS-SHETG90040GOReeves563984465:chandra.obs.misc56026.4065162037----90040.0--53.40167-36.140280.81acisf13920N002_pha2.fitshttps://heasarc.gsfc.nasa.gov/FTP/chandra/data/byobsid/0/13920/primary/acisf13920N002_pha2.fits.gz12Spectrum-1.0ACIS-SHEASARCapplication/fits1.2398e-106.1992e-096.07522e-093.16159e-09{"aws":{"bucket_name":"nasa-heasarc","region":"us-east-1","policy":"open","key":"chandra/data/byobsid/0/13920/primary/acisf13920N002_pha2.fits.gz"}}

Hint 3: Download the data to make a spectrum. Note: you might end here and use Xspec to plot and model the spectrum. Or … you can also try to take a quick look at the spectrum.

#  Get it and look at it:
#hdu_list=spec_tables[0].getdataobj()
file_name = download_file(spec_tables[0].getdataurl(), cache=True, timeout=600)
hdu_list=fits.open(file_name)

spectra=hdu_list[1].data
print(spectra.columns)
print(len(spectra))
ColDefs(
    name = 'SPEC_NUM'; format = '1I'; null = 0
    name = 'TG_M'; format = '1I'; null = 99
    name = 'TG_PART'; format = '1I'
    name = 'TG_SRCID'; format = '1I'; null = 0
    name = 'X'; format = '1E'; unit = 'pixel'
    name = 'Y'; format = '1E'; unit = 'pixel'
    name = 'CHANNEL'; format = '8192I'; null = 0
    name = 'COUNTS'; format = '8192I'; unit = 'count'; null = -1
    name = 'STAT_ERR'; format = '8192E'; unit = 'count'
    name = 'BACKGROUND_UP'; format = '8192I'; unit = 'count'; null = -1
    name = 'BACKGROUND_DOWN'; format = '8192I'; unit = 'count'; null = -1
    name = 'BIN_LO'; format = '8192D'; unit = 'angstrom'
    name = 'BIN_HI'; format = '8192D'; unit = 'angstrom'
)
12
## Or write it to disk
import os
if not os.path.isdir('downloads'):
    os.makedirs("downloads")
fname=spec_tables[0].make_dataset_filename()
#  Known issue where the suffix is incorrect:
fname=fname.replace('None','fits')
with open('downloads/{}'.format(fname),'wb') as outfile:
    outfile.write(spec_tables[0].getdataset().read())

Extension: Making a “quick look” spectrum. For our purposes, the 1st order of the HEG grating data would be sufficient.

j=1
for i in range(len(spectra)):
    matplotlib.rcParams['figure.figsize'] = (8, 3)
    if abs(spectra['TG_M'][i]) == 1 and (spectra['TG_PART'][i]) == 1:
        ax=plt.subplot(1,2,j)
        pha = plt.plot( spectra['CHANNEL'][i],spectra['COUNTS'][i])
        ax.set_yscale('log')
        if spectra['TG_PART'][i] == 1:
            instr='HEG'
        ax.set_title("{grating}{order:+d}".format(grating=instr, order=spectra['TG_M'][i]))
        plt.tight_layout()
        j=j+1
../../_images/41fff0eb45bfa7664699e68e1fc76c41e131cc77242e6938fd3434cecda8343a.png

This can then be analyzed in your favorite spectral analysis tool, e.g., pyXspec. (For the winter 2018 AAS workshop, we demonstrated this in a notebook that you can consult for how to use pyXspec, but the pyXspec documentation will have more information.)

Congratulations! You have completed this notebook exercise.