In [1]:
from astropy.io import ascii
import astropy.coordinates as coord
import astropy.units as u
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

|dec| < 1.25 deg

-52 < RA < 60 deg


In [2]:
css = ascii.read("/Users/adrian/projects/triand-rrlyrae/data/Catalina_all_RRLyr.txt")
print css.colnames


['ID', 'RAdeg', 'DEdeg', '<Vmag>', 'Period', 'A', 'Num', 'dh', 'AV', 'Eta', 'AID']

In [17]:
ra_bounds = (-52,60)
dec_bounds = (-1.25, 1.25)

In [18]:
ix = ((css['RAdeg'] > (360.+ra_bounds[0])) | (css['RAdeg'] < ra_bounds[1])) & \
      (css['DEdeg'] > dec_bounds[0]) & (css['DEdeg'] < dec_bounds[1])
css_s82 = css[ix]

In [19]:
stripe82 = ascii.read("/Users/adrian/projects/triand-rrlyrae/data/stripe82-rrlyrae.txt")
stripe82 = stripe82[stripe82['Type'] == 'ab']

ix = ((stripe82['ra'] > (360.+ra_bounds[0])) | (stripe82['ra'] < ra_bounds[1])) & \
      (stripe82['dec'] > dec_bounds[0]) & (stripe82['dec'] < dec_bounds[1])
stripe82 = stripe82[ix]

print stripe82.colnames


['ID', 'Type', 'LC', 'period', 'uAmp', 'gAmp', 'rAmp', 'iAmp', 'ra', 'dec', 'Ar', 'Dist', 'umag', 'gmag', 'rmag', 'imag', 'Vmag', 'dr7', 'sloan', 'simbad']

In [134]:
fig,ax = plt.subplots(1,1,figsize=(10,4))

ax.plot(coord.Angle(css_s82['RAdeg']*u.degree).wrap_at(180.*u.degree), css_s82['DEdeg'], 
        linestyle='none', marker='o', markersize=3.)

ax.plot(coord.Angle(stripe82['ra']*u.degree).wrap_at(180.*u.degree), stripe82['dec'], 
        linestyle='none', marker='o', markersize=8., 
        markeredgecolor='k', markeredgewidth=1., markerfacecolor='none')

ax.set_xlim(ra_bounds[0]-5., ra_bounds[1]+5)


Out[134]:
(-57.0, 65)

In [136]:
fig,ax = plt.subplots(1,1,figsize=(10,8))

bins = np.linspace(5.,40.,10)

ax.hist(stripe82['Dist'], bins=bins, alpha=0.5, label='SDSS')
ax.hist(css_dist, bins=bins, alpha=0.5, label='CSS')
ax.legend(fontsize=20)
ax.set_xlabel("Distance [kpc]")
ax.set_ylabel("Number of RR Lyrae")


Out[136]:
<matplotlib.text.Text at 0x113f6f110>

In [142]:
fig,ax = plt.subplots(1,1,figsize=(10,8))

stripe82_hist,xxx = np.histogram(stripe82['Dist'], bins=bins)
css_hist,xxx = np.histogram(css_s82['dh'], bins=bins)

ax.plot((bins[1:]+bins[:-1])/2., css_hist.astype(float) / stripe82_hist.astype(float))

ax.set_xlabel("Distance [kpc]")
ax.set_ylabel("Completeness")

ax.set_ylim(0,1)


Out[142]:
(0, 1)

In [141]:
float(sum((css_s82['dh'] > 15.) & (css_s82['dh'] < 21.))) / float(sum((stripe82['Dist'] > 15.) & (stripe82['Dist'] < 21.)))


Out[141]:
0.7285714285714285

~73% completeness from 15-21 kpc


In [13]:
css_c = coord.SkyCoord(ra=css['RAdeg']*u.deg, dec=css['DEdeg']*u.deg)

In [14]:
ix = ((css_c.galactic.l > 120.*u.deg) & (css_c.galactic.l < 180.*u.deg) &
      (css_c.galactic.b > 20*u.deg) & (css_c.galactic.b < 40*u.deg) & 
      (css['dh'] > 10) & (css['dh'] < 20))

In [15]:
ix.sum()


Out[15]:
58

In [21]:
s82_c = coord.SkyCoord(ra=stripe82['ra']*u.deg, dec=stripe82['dec']*u.deg)

In [33]:
plt.plot(s82_c.galactic.l.degree, s82_c.galactic.b.degree, linestyle='none')
plt.xlim(46,48)
plt.ylim(-27,-22)


Out[33]:
(-27, -22)

In [36]:
ix = ((s82_c.galactic.l > 46.*u.deg) & (s82_c.galactic.l < 48.*u.deg) &
      (s82_c.galactic.b > -27*u.deg) & (s82_c.galactic.b < -22*u.deg) & 
      (stripe82['Dist'] > 10) & (stripe82['Dist'] < 30))
ix.sum()


Out[36]:
17

In [ ]: