Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Fornax Demo Notebooks

Make Multi-Wavelength Light Curves Using Archival Data

Learning Goals

By the end of this tutorial, you will be able to:

Introduction

Input

Output

Runtime

Imports

This cell will install them if needed:

1. Define the sample

We define here a “gold” sample of spectroscopically confirmed changing look AGN and quasars. This sample includes both objects which change from type 1 to type 2 and also the opposite. Future studies may want to treat these as separate objects or separate QSOs from AGN. Bibcodes for the samples used are listed next to their functions for reference.

Significant work went into the functions which grab the samples from the papers. They use Astroquery, NED, SIMBAD, Vizier, and in a few cases grab the tables from the html versions of the paper. There are trickeries involved in accessing coordinates from tables in the literature. Not every literature table is stored in its entirety in all of these resources, so be sure to check that your chosen method is actually getting the information that you see in the paper table. Warning: You will get false results if using NED or SIMBAD on a table that has more rows than are printed in the journal.

1.1 Build your own sample

To build your own sample, you can follow the examples of functions above to grab coordinates from your favorite literature resource,

or

You can use astropy’s read function to read in an input table to an astropy table

If you want to build your own sample_table, your table must contain one row per source and include exactly three required pieces of information: a coord column holding an astropy.coordinates.SkyCoord position for each object, a unique integer objectid, and a label column giving a short string describing that source’s origin (e.g., literature reference, sample name, or provenance tag).

1.2 Write out your sample to disk

At this point you may wish to write out your sample to disk and reuse that in future work sessions, instead of creating it from scratch again.

For the format of the save file, we would suggest to choose from various formats that fully support astropy objects(eg., SkyCoord). One example that works is Enhanced Character-Separated Values or ‘ecsv’

1.3 Load the sample table from disk

Do only this step from this section when you have a previously generated sample table

1.4 Initialize data structure to hold the light curves

2. Find light curves for these targets in NASA catalogs

We search a curated list of time-domain catalogs from NASA astrophysics archives. Because each archive is different, and in many cases each catalog is different, each function to access a catalog is necessarily specialized to the location and format of that particular catalog.

2.1 HEASARC: FERMI & Beppo SAX

The function to retrieve data from HEASARC accesses the HEASARC archive using an astroquery TAP query with a table upload. This is the fastest way to access data from HEASARC catalogs at scale.

While these aren’t strictly light curves, we would like to track if there are gamma rays detected in advance of any change in the CLAGN light curves. We store these gamma ray detections as single data points. Because gamma ray detections typically have very large error radii, our current technique is to keep matches in the catalogs within some manually selected error radius, currently defaulting to 1 degree for Fermi and 3 degrees for Beppo SAX. These values are chosen based on a histogram of all values for those catalogs.

2.2 IRSA: WISE

We use the unWISE light curves catalog (Meisner et al., 2023) which ties together all WISE & NEOWISE 2010 - 2020 epochs. Specifically it combines all observations at a single epoch to achieve deeper mag limits than individual observations alone.

The function to retrieve WISE light curves accesses an IRSA generated version of the catalog in parquet format being stored in the AWS cloud Open Data Repository

2.3 MAST: Pan-STARRS

The function to retrieve lightcurves from Pan-STARRS uses LSDB to access versions of the object and light curve catalogs that are stored in the cloud. This function is efficient at large scale (sample sizes > ~1000).

2.4 MAST: TESS, Kepler and K2

The function to retrieve lightcurves from these three missions currently uses the open source package Lightkurve. This search is not efficient at scale and we expect it to be replaced in the future.

2.5 MAST: Hubble Catalog of Variables

The function to retrieve lightcurves from HCV currently uses their API; based on this example. This search is not efficient at scale and we expect it to be replaced in the future.

3. Find light curves for these targets in relevant, non-NASA catalogs

3.1 IRSA: ZTF

The function to retrieve ZTF light curves accesses a HATS parquet version of the ZTF catalog stored in the cloud using LSDB. This is the simplest way to access this dataset at scale. The ZTF API is available for small sample searches.

3.2 Gaia

The function to retrieve Gaia light curves cross-matches our sample against the Gaia DR3 epoch-photometry catalog, accessed as a HATS catalog using LSDB (the same cloud-native, scalable approach used for the ZTF and Pan-STARRS light curves).

3.3 HEASARC: IceCube neutrinos

There are several catalogs (basically one for each year of IceCube data from 2008 - 2018). The following code creates a large catalog by combining all the yearly catalogs. The IceCube catalog contains Neutrino detections with associated energy and time and approximate direction (which is uncertain by half-degree scales....). Usually, for active events only one or two Neutrinos are detected, which makes matching quite different compared to “photons”. For our purpose, we will list the top 3 events in energy that are within a given distance to the target.

This time series (time vs. neutrino energy) information is similar to photometry. We choose to storing time and energy in our data structure, leaving error = 0. What is not stored in this format is the distance or angular uncertainty of the event direction.

3.4 Rubin

Before running this section, you need to have both 1) a login to the Rubin Science Platform (RSP) and 2) an authenticating token setup in your Fornax home directory.

  1. To see if you have Rubin data rights, and if you do, to get that login setup, follow these instructions

  2. After logging in to RSP, follow these instructions to get a token and store it in your home directory.

This code will not work without the above information, so we have commented it out for now. Uncomment when you are ready to proceed.

Once that setup is complete, this code access Rubin data from the Rubin Science Platform which is hosting their catalogs in Google Cloud. Specifically, the code uses pyvo and adql to access a TAP server.

4. Parallel processing the archive calls

This section shows how to increase the speed of the multi-archive search by running the calls in parallel using python’s multiprocessing library. This can be a convenient and efficient method for small to medium sample sizes. One drawback is that error messages tend to get lost in the background and never displayed for the user. Running this on very large samples may fail because of the way the platform is setup to cull sessions which appear to be inactive. For sample sizes >~500 and/or improved logging and monitoring options, consider using the bash script demonstrated in the related tutorial notebook scale_up.

5. Make plots of luminosity as a function of time

These plots are modelled after van Velzen et al., 2021. We show flux in mJy as a function of time for all available bands for each object. show_nbr_figures controls how many plots are actually generated and returned to the screen. If you choose to save the plots with save_output, they will be put in the output directory and labelled by sample number.

Note that in the following, we can either plot the results from df_lc (from the serial call) or parallel_df_lc (from the parallel call). By default (see next cell) the output of the parallel call is used.

About this notebook

Acknowledgements

References

This work made use of: