Proposal Preparation Exercise#

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: https://www.space.com/19980-monster-black-hole-spin-discovery.html )

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

#  Start with a Registry query to find table services for the HEASARC.
#   Then get the list of tables that this service serves.
#
#  Hint:  the QuickReference has this example:
#services = vo.regsearch(servicetype='tap', keywords=['heasarc'])
#tables = services[0].service.tables
#
#  Hint2:  the QuickReference also has this example:
#for c in tables['zcat'].columns:
#    print(f'{c.name:30s} - {c.description}')

Hint: The Chansngcat ( https://heasarc.gsfc.nasa.gov/W3Browse/chandra/chansngcat.html ) 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.

# Get the coordinate for NGC 1365 with astropy.
# Construct a query that will get the ra, dec, exposure time, flux, and flux errors
#  from this catalog in the region around this source and submit the query.
#  (See the CS_Catalog_queries.md )
#  Hint:  the QuickReference has this example:
#coord = SkyCoord.from_name("m83")
#query = f'''
#SELECT ra, dec, Radial_Velocity, radial_velocity_error, bmag, morph_type FROM public.zcat as cat where
#contains(point('ICRS',cat.ra,cat.dec),circle('ICRS',{coord.ra.deg},{coord.dec.deg},1.0))=1
#'''
#results = services[0].service.run_async(query)

Step 2: Make Images#

Create ultraviolet and X-ray images#

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

#  Hint:  start with a Registry search for relevant image services

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:

#  Filter on the short_name attribute of the list of services

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:

#  You may find more than one service.  Look at both.

Hint: Next create a UV image for the source

# Do an image search for NGC 1365 in the UV services found above
#
#  Hint:  the QuickReference has this example:
#results = services[1].search(pos=m83_pos, size=.2)
# Get a FITS file and visualize the image
#
#  Hint:  the QuickReference has this example:
#file_name = download_file(results[0].getdataurl())

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

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

# Search the Registry to list services that contain X-ray spectral data

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

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:
## Or write it to disk

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

#  Hint:  You'll have to look into the details of the spectra.

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.