Note - the data for all the interactive sessions is available for download.

# Finding Cataclysmic Variables in PTF data

##### Version 0.2

The goal of this exercise is to find Cataclysmic Variables (CVs) in this field. We will employ multiple methods to conduct this search, in particular: (1) We will search for CVs using photometric colors from the Sloan Digital Sky Survey, and (2) We will search for CVs using variability metrics derived from PTF light curves. We will also compare the results from these two methods.

While these methods are not as reliable as the spectroscopic identification of a CV, color data (available from surveys such as SDSS, Pan-STARRS1, 2MASS, WISE, etc.) and variability data (available from PTF, ASAS, etc.) are a lot cheaper to obtain and are now available for large portions of the sky.

For simplicity, we will focus on a single PTF field and detector for the present exercise, namely - PTF field 22600, CCD 2. This field is in the footprint of the famed Stripe 82 (a $\sim 300 \deg^2$ region that was repeatedly scanned by SDSS) and has been observed by PTF in both the g and R bands. This particular field extends from $311.45621^\circ < \alpha_{J2000} < 312.02866^\circ$ and $-0.01166^\circ < \delta_{J2000} < 1.13844^\circ$.

By JCJ van Roestel (c) 2014 Aug 19

## Problem 1) Searching for CVs Using Photometric Colors

As mentioned above, there are SDSS observations of this field so filtered observations in the $u'g'r'i'z'$ bands are available. From the lecture, we now know that CVs have unusual colors (in particular they are much hotter (i.e. bluer) than a typical star). Thus, we will identify candidates by performing a "color cut" on all stars within our field.

Note - the SDSS data included for this exercise can be obtained from SDSS casjobs. SDSS casjobs is a powerful tool -- it allows users to query the SDSS database using an SQL-like syntax (the exact syntax for the data set provided here is given at the end of this notebook, see below). The results of this query are included in the file $\texttt{SDSScolors.dat}$. For ease of use, we have indexed each of the stars with an ID number.

##### Part A) Construct color-color diagrams

Read in the data from $\texttt{SDSScolors.dat}$ and make a $u' - g'$ vs. $g' - r'$ color-color diagram for all stars in the field. Plot your results. Remake your plot including only stars with $r' < 20 \; \textrm{mag}$ - sources fainter than this limit will be difficult to identify as CVs in PTF data. Hint - recall that you can use

np.recfromcsv( filename, delimiter=" ")

to read in the data

In []:
### make a plot of the u-g vs. g-r color-color diagram
np.recfromcsv( # COMPLETE

plot( # COMPLETE

#xlim(-0.5,5.5)
#ylim(-1, 2.5)


Make a $g' - r'$ vs. $r' - i'$ color-color diagram for all stars in the field. Plot your results, including only the bright stars.

In []:
### make a plot of the g-r vs. r-i color-color diagram

plot( # COMPLETE

#xlim(-0.5, 2)
#ylim(-0.5, 2)

##### Part B) Select candidate CVs

Examing the plots that you made above - place some cuts on the data to select the bluest sources as candidate CVs? Note -- ignore what Adam previously said about hard cuts, this is just an exercise.

How many candidates do you find when placing cuts on the $u' - g'$ vs. $g' - r'$ color-color diagram?

In []:
### select candidate CVs based on the u-g vs. g-r diagram

# COMPLETE


What about for the $g' - r'$ vs. $r' - i'$ color-color diagram?

In []:
### select candidate CVs based on the g-r vs. r-i diagram

# COMPLETE


How many candidates do you find when combine the cuts from both color-color diagrams?

In []:
### select candidate CVs based on both color-color diagrams

# COMPLETE


Typically, most CVs can be found by requiring $u' - g' < 0.4 \; \textrm{mag}$ and $g' - r' < 0.7 \; \textrm{mag}$, however, these cuts will include many sources that are no CVs. Can you think of any sources that might prove to be contaminants using these color-color cuts?

## Problem 2) Searching for CVs Using Variability Information

As noted above - color information is not sufficient to identify CVs. Here, we will attempt to identify CVs using variability information from PTF light curves. PTF observations of this field can be downloaded from the IRSA PTF image archive, (see How to Construct Light Curves From PTF Observations for more details).

For simplicity, we have already made light curves for each of the stars in the field. These light curves are included in the $\texttt{lightcurves/}$ directory, with names: $\texttt{ID_xx.lc}$, where the xx indicates the index number from the $\texttt{SDSScolors.dat}$ file.

##### Part A) Identify highly variable sources

Measure the amplitude of variations for each star in the field. Be sure to store this information as you will need it later. Should you make these measurements on the $g$ or $R$ light curves, or both?

Bonus question: can you think of another metric capable of comparing the variability of the different light curves? If yes, measure that as well to compare with the amplitudes you measure.

In []:
# measure the amplitude of every stellar light curve in the field

lcfiles = glob.glob(  # COMPLETE

amp = # COMPLETE

##### Part B) Select Candidate CVs

Now that you have variability metrics for all your stars, identify those that are the most variable. Hint - this is easiest using histograms or percentile rankings.

In []:
### identify the most variable sources in the sample

hist(    # COMPLETE

# np.percentile(   # COMPLETE


Make a cut on your variability metrics selecting the most variable sources, and plot the light curves of those sources. Hint - you might need to plot both g and R bands to see all the variability.

In []:
### plot light curves of the most variable sources

def lc_plot(ID):
# COMPLETE
# COMPLETE
plot(  # COMPLETE

# COMPLETE



Looking at the light curves you just plotted - can you identify any good CV candidates? Can you think of any other sources that might have this type of light curve?

## Problem 3) Combine Color and Variability

Now that we have identified candidates via their photometric colors and via their variability - combine your two list of candidates to create a "superlist" of possible CVs in the field we are examining.

In []:
# create superlist of CV candidates

# COMPLETE


If you are having difficulty combining the lists, try making a plot of variabilty vs. $u' - g'$ color, and see if that helps. Where should the CVs be located in this particular diagram? Are there any other sources that might be located in this region? Will this sort of selection identify all CVs?

In []:
# plot variability vs. u - g

plot(  # COMPLETE


Using the RA and Dec of any candidate(s) that you find, you can actually check your answer by using for example SIMBAD and SDSS-Skyserver.

## Bonus Problem) Search for CVs using periodicity

As a final (bonus) challenge -- do not fret if you do not complete this exercise during the break-out session -- try to identify additional CVs in this dataset based on periodicity in the light curves. You can use the code from previous assignments.

What is the major difficulty in determining the orbital period for CVs? What observations would you take if you want to determine the orbital period for this CV?

Full disclosure - there are no periodic CVs in this data set. Nevertheless, the exercise is a worthwhile one that builds on the skills we developed above.

## SDSS casjobs query

This is the query used to get the color-data from SDSS. The query was done on SDSS-DR10 dataset.

declare @BRIGHT bigint set @BRIGHT=dbo.fPhotoFlags('BRIGHT')
declare @EDGE bigint set @EDGE=dbo.fPhotoFlags('EDGE')
declare @SATURATED bigint set @SATURATED=dbo.fPhotoFlags('SATURATED')
declare @NODEBLEND bigint set @NODEBLEND=dbo.fPhotoFlags('NODEBLEND')

declare @bad_flags bigint set
AND dec BETWEEN -0.0116509655314008 AND 1.13843728598704