RR Lyrae Templates

This notebook contains some experimentation with RR Lyrae template fits from Sesar 2010.


In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

import seaborn as sns; sns.set()

In [2]:
from multiband_LS.generated import RRLyraeObject

rrlyrae = RRLyraeObject(1013184)

band = 'z'

t, y, dy = rrlyrae.observed(band)
phase = t % rrlyrae.period
mag_gen = rrlyrae.generated(band, t, dy)

tfit = np.linspace(0, rrlyrae.period, 1000)
mag_fit = rrlyrae.generated(band, tfit)

plt.errorbar(phase, y, dy, fmt='o')
plt.errorbar(phase, mag_gen, dy, fmt='o')
plt.plot(tfit, mag_fit, '-k', alpha=0.5);



In [3]:
lcids = list(RRLyraeObject.lcdata.ids)

In [4]:
lcdata = RRLyraeObject.lcdata

def plot_color_trends(i=0, extinction_corrected=True):
    lcid = list(RRLyraeObject.lcdata.ids)[i]
    
    rrlyrae = RRLyraeObject(lcid)
    t = np.linspace(0, rrlyrae.period, 1000)

    g, r, i = [rrlyrae.generated(band, t, corrected=extinction_corrected)
               for band in 'gri']

    plt.figure(figsize=(6, 6))
    gs = plt.GridSpec(2, 2)
    plt.subplot(gs[0, 0])
    plt.plot(g - r, r)
    plt.ylabel('r')

    plt.subplot(gs[1, 0])
    plt.plot(g - r, r - i)
    plt.xlabel('g - r')
    plt.ylabel('r - i')

    plt.subplot(gs[1, 1])
    plt.plot(r, r - i)
    plt.xlabel('r')
    
    plt.suptitle('Template fits for {0}'.format(lcid), size=14)

In [5]:
from IPython.html.widgets import interact
interact(plot_color_trends, i=(0, len(lcids) - 1));