Characterizing Flare Rate Evolution w/ Kepler Wide Binaries


In [1]:
%matplotlib inline
import numpy as np
from scipy import stats
import matplotlib 
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import matplotlib.cm as cm
import pandas as pd

#MAKE SURE ALL MASS VALUES ARE POSITIVE!!!

In [2]:
# Making figures look nice
matplotlib.rcParams.update({'font.size':18}) 
matplotlib.rcParams.update({'font.family':'serif'})

Reading in files:


In [3]:
Kep_ID, sep, prob, gkclr, prot = np.loadtxt ('Janes2017_data.txt', usecols=(1,6,7,9,10), unpack=True)

"""
Kep_ID = KIC number
sep = projected physical separation in arcseconds
prob = relative probability of chance alignment
gkclr = g-k color
prot = rotation period in days

"""


Out[3]:
'\nKep_ID = KIC number\nsep = projected physical separation in arcseconds\nprob = relative probability of chance alignment\ngkclr = g-k color\nprot = rotation period in days\n\n'

In [4]:
row, Lfl_Lbol, jim_dist, giclr, kicnum, mass, tau = np.genfromtxt('kic_lflare_mass_dist.csv', 
                    usecols = (0,1,8,9,10,11,12), delimiter = ',', unpack = True, skip_header=True)

"""
Lfl_Lbol = Flare luminosity ratio (FLR): Fraction of total stellar luminosity from flares 
(see https://github.com/jradavenport/appaloosa for details)
jim_dist = parallaxes from Davenport (2016)
giclr = g-i color
kicnum = KIC number
mass = masses in units of M_sun
tau = Rosby number parameter
"""

#Normalizing very low-signal data
w=np.where((Lfl_Lbol < 1e-15))
Lfl_Lbol[w]=1e-15

In [5]:
#Check for negative mass values

print(len(mass))

for i in range(len(mass)):
    if mass[i] <= 0:
        np.delete(mass,[i])
        
print(len(mass))


202359
202359

No negative masses!

Crossmatching data sets:


In [6]:
m = np.array(np.zeros(len(Kep_ID)), dtype='int') 
## m is an array of indices that is the intersection of "Janes2017_data.txt" and "kic_lflare_mass_dist.csv"

## Removing zeros from Kep_ID
for k in range (len(Kep_ID)):
    
    if k==72:
        pass
    
    elif k==114:
        pass
    
    else:
        x = np.where(Kep_ID[k] == kicnum)
        #print(x,k)
    
        m[k] = x[0]
    
    
print(m,len(m)) 
# in database speak, this a Join (Inner Join)


[129756 129757 141257 141258 139652 139654 150200 153960 129850 129851
 105999 106001 129881 129882   7499   7500 146653 146654  28638  28642
  25352  25354 182991 182992  10631  10632  13457  13459 178808 180295
 178808 178809 128357 128358  24209  24210 160630 160632  36334  36335
 187743 187744  77349  77351  26608  26609  85433  85434  36391  36396
  41212  42005  70807  72227 121909 121910 189518 189520 158737 158738
 136808 136809 195354 195355 140185 140186 116783 116785 200940 200942
  38466  38467      0  10912  49778  49780  13801  13803  34427  34428
 158854 158857  38560  38561 141965 141967  50202  50204 147144 147149
  29077  29079  41384  41385  82186  82188 143796 143797  54595  54596
  69721  69723 130656 130660 152836 152837  58177  58178 135482 135483
   8188   8189  13985  13986      0 173725 186531 186536  84362  84364
 166314 166315 199794 199796 157152 157153  47336  47337  45053  45054
  34865  34866  90381  90382  41730  42578  15706  15708  75908  77145
  47540  48696  43473  43474 157500 157503  44390  44391 159623 159625
  39116  39117  84947  84949 112556 112561  41835  41836  15858  15859
 155578 155579  10174  10176  90546  90547  26281  26284 119456 119457
 196773 196774 109233 109235  83334  83335   7284   8858  14695  16082
 174144 174145   5665   5668 172873 172877] 186

In [7]:
m = np.delete(m,[72,114])#Deletes zeros in m - ONLY RUN ONCE!!!
print(len(m),m)


184 [129756 129757 141257 141258 139652 139654 150200 153960 129850 129851
 105999 106001 129881 129882   7499   7500 146653 146654  28638  28642
  25352  25354 182991 182992  10631  10632  13457  13459 178808 180295
 178808 178809 128357 128358  24209  24210 160630 160632  36334  36335
 187743 187744  77349  77351  26608  26609  85433  85434  36391  36396
  41212  42005  70807  72227 121909 121910 189518 189520 158737 158738
 136808 136809 195354 195355 140185 140186 116783 116785 200940 200942
  38466  38467  10912  49778  49780  13801  13803  34427  34428 158854
 158857  38560  38561 141965 141967  50202  50204 147144 147149  29077
  29079  41384  41385  82186  82188 143796 143797  54595  54596  69721
  69723 130656 130660 152836 152837  58177  58178 135482 135483   8188
   8189  13985  13986 173725 186531 186536  84362  84364 166314 166315
 199794 199796 157152 157153  47336  47337  45053  45054  34865  34866
  90381  90382  41730  42578  15706  15708  75908  77145  47540  48696
  43473  43474 157500 157503  44390  44391 159623 159625  39116  39117
  84947  84949 112556 112561  41835  41836  15858  15859 155578 155579
  10174  10176  90546  90547  26281  26284 119456 119457 196773 196774
 109233 109235  83334  83335   7284   8858  14695  16082 174144 174145
   5665   5668 172873 172877]

Sorting primary & secondary components:


In [8]:
a = np.arange(0,184,2) #primary components 
b = np.arange(1,184,2) #secondary components

for j in range(0,len(a)):
    if mass[m][a[j]] < mass[m][b[j]]:
        tmp = a[j]
        a[j] = b[j]
        b[j] = tmp

In [9]:
### Good_either index contains FLRs above minimum detection threshold: (1e-7)###

Good_either = np.where(((Lfl_Lbol[m][a] > 1e-7) | (Lfl_Lbol[m][b] > 1e-7)) & 
                        ((Lfl_Lbol[m][a] > 1e-15) & (Lfl_Lbol[m][b] > 1e-15)))
                        
print(np.size(Good_either))


58

Sample size = 58 wide binaries

Data Visualization:

Activity Comparison -


In [10]:
### FLR of primary vs. FLR of secondary ###

plt.figure(figsize=(8,8)) 
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_a2]), np.log10(Lfl_Lbol[m][b][Good_both_a2]), 'ro', alpha = 0.6)
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_b2]), np.log10(Lfl_Lbol[m][b][Good_both_b2]), 'bo', alpha = 0.6)
plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either]), np.log10(Lfl_Lbol[m][b][Good_either]), 
            alpha = 0.6, s=80, c='r', edgecolor='k', label='Active pairs')

#plt.scatter(np.log10(Lfl_Lbol[m][a]+1e-10), np.log10(Lfl_Lbol[m][b]+1e-10), s=5, c='k', alpha=0.2, 
            #label='Kepler wide binary pairs')


plt.plot([-11,-2], [-11,-2],'b', lw=3, alpha=0.5,label='Idealized')
#plt.plot([-11,-2], [-12,-3],'y', lw=3, alpha=0.5,label='Within solar variability')
#plt.plot([-11,-2], [-10,-1],'y', lw=3, alpha=0.5)

plt.scatter(-3.93,-4.00, marker='*', color='orange', edgecolor = 'black', s=300, alpha = 1)

#box1 = plt.Polygon([[-5,-4],[-11,-4],[-11,-2],[-3,-2]],fc='g',alpha=0.2,label='Active Secondary')
#box2 = plt.Polygon([[-4,-5],[-4,-11],[-2,-11],[-2,-3]],fc='b',alpha=0.2,label='Active Primary')
#circle = plt.Circle((-11, -11), radius=5, fc='r',alpha=0.2,label='Below noise threshold')
#plt.gca().add_patch(circle)
#plt.gca().add_patch(box1)
#plt.gca().add_patch(box2)

plt.xlim(-11, -2)
plt.ylim(-11, -2)
plt.xlabel(r'log $L_{fl}/L_{kp}$ (A component)')
plt.ylabel(r'log $L_{fl}/L_{kp}$ (B component)')
#plt.legend(fontsize=10, loc=2)
plt.savefig('AB_v1.pdf',dpi=500)



In [11]:
### Adding zone of expected variability for a solar-like cycle ###

plt.figure(figsize=(8,8)) 

# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_a2]), np.log10(Lfl_Lbol[m][b][Good_both_a2]), 'ro', alpha = 0.6)
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_b2]), np.log10(Lfl_Lbol[m][b][Good_both_b2]), 'bo', alpha = 0.6)
plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either]), np.log10(Lfl_Lbol[m][b][Good_either]), 
            alpha = 0.6, s=80, c='r', edgecolor='k', label='Active pairs')

#plt.scatter(np.log10(Lfl_Lbol[m][a]+1e-10), np.log10(Lfl_Lbol[m][b]+1e-10), s=5, c='k', alpha=0.2, 
            #label='Kepler wide binary pairs')


plt.plot([-11,-2], [-11,-2],'b', lw=3, alpha=0.5,label='Idealized')
plt.plot([-11,-2], [-12,-3],'y', lw=3, alpha=0.5,label='Within solar variability')
plt.plot([-11,-2], [-10,-1],'y', lw=3, alpha=0.5)

#box1 = plt.Polygon([[-5,-4],[-11,-4],[-11,-2],[-3,-2]],fc='g',alpha=0.2,label='Active Secondary')
#box2 = plt.Polygon([[-4,-5],[-4,-11],[-2,-11],[-2,-3]],fc='b',alpha=0.2,label='Active Primary')
#circle = plt.Circle((-11, -11), radius=5, fc='r',alpha=0.2,label='Below noise threshold')
#plt.gca().add_patch(circle)
#plt.gca().add_patch(box1)
#plt.gca().add_patch(box2)

plt.xlim(-11, -2)
plt.ylim(-11, -2)
plt.xlabel(r'log $L_{fl}/L_{kp}$ (A component)')
plt.ylabel(r'log $L_{fl}/L_{kp}$ (B component)')
plt.legend(fontsize=10, loc=2)
plt.savefig('AB_v2.pdf',dpi=500)



In [13]:
### Adding zones for "weird" pairs ###

plt.figure(figsize=(8,8)) 

# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_a2]), np.log10(Lfl_Lbol[m][b][Good_both_a2]), 'ro', alpha = 0.6)
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_b2]), np.log10(Lfl_Lbol[m][b][Good_both_b2]), 'bo', alpha = 0.6)
plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either]), np.log10(Lfl_Lbol[m][b][Good_either]), 
            alpha = 0.6, s=80, c='r', edgecolor = 'k', label='Active pairs')

#plt.scatter(np.log10(Lfl_Lbol[m][a]+1e-10), np.log10(Lfl_Lbol[m][b]+1e-10), s=5, c='k', alpha=0.2, 
            #label='Kepler wide binary pairs')


plt.plot([-11,-2], [-11,-2],'b', lw=3, alpha=0.5,label='Idealized')
plt.plot([-11,-2], [-12,-3],'y', lw=3, alpha=0.5,label='Within solar variability')
plt.plot([-11,-2], [-10,-1],'y', lw=3, alpha=0.5)

box1 = plt.Polygon([[-5,-4],[-11,-4],[-11,-2],[-3,-2]],fc='g',alpha=0.1,label='Active Secondary')
box2 = plt.Polygon([[-4,-5],[-4,-11],[-2,-11],[-2,-3]],fc='b',alpha=0.1,label='Active Primary')
circle = plt.Circle((-11, -11), radius=5, fc='r',alpha=0.1,label='Below noise threshold')
plt.gca().add_patch(circle)
plt.gca().add_patch(box1)
plt.gca().add_patch(box2)

plt.xlim(-11, -2)
plt.ylim(-11, -2)
plt.xlabel(r'log $L_{fl}/L_{kp}$ (A component)')
plt.ylabel(r'log $L_{fl}/L_{kp}$ (B component)')
plt.legend(fontsize=10, loc=2)
plt.savefig('AB_v3.png',dpi=500)



In [17]:
### BOX FILTERS ###

gbox = np.where((Lfl_Lbol[m][b][Good_either] > 1e-4) & (Lfl_Lbol[m][a][Good_either] < 1e-4))
bbox = np.where((Lfl_Lbol[m][b][Good_either] < 1e-4) & (Lfl_Lbol[m][a][Good_either] > 1e-4))
ybox = np.where(((np.log10(Lfl_Lbol[m][b][Good_either]) - np.log10(Lfl_Lbol[m][a][Good_either])) < 1) & 
                ((np.log10(Lfl_Lbol[m][b][Good_either]) - np.log10(Lfl_Lbol[m][a][Good_either])) > -1))

In [13]:
### Final form ###

plt.figure(figsize=(8,8.1)) 

# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_a2]), np.log10(Lfl_Lbol[m][b][Good_both_a2]), 'ro', alpha = 0.6)
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_b2]), np.log10(Lfl_Lbol[m][b][Good_both_b2]), 'bo', alpha = 0.6)
plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][gbox]), np.log10(Lfl_Lbol[m][b][Good_either][gbox]), 
            alpha = 0.6, s=80, c='g', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][bbox]), np.log10(Lfl_Lbol[m][b][Good_either][bbox]), 
            alpha = 0.6, s=80, c='b', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][ybox]), np.log10(Lfl_Lbol[m][b][Good_either][ybox]), 
            alpha = 0.6, s=80, c='y', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either]), np.log10(Lfl_Lbol[m][b][Good_either]), s=10, c='k', alpha=0.4)


plt.plot([-11,-2], [-11,-2],'b', lw=3, alpha=0.5,label='Idealized')
plt.plot([-11,-2], [-12,-3],'y', lw=3, alpha=0.5,label='Within solar variability')
plt.plot([-11,-2], [-10,-1],'y', lw=3, alpha=0.5)

box1 = plt.Polygon([[-5,-4],[-11,-4],[-11,-2],[-3,-2]],fc='g',alpha=0.1,label='Active Secondary')
box2 = plt.Polygon([[-4,-5],[-4,-11],[-2,-11],[-2,-3]],fc='b',alpha=0.1,label='Active Primary')
circle = plt.Circle((-11, -11), radius=5, fc='r',alpha=0.1,label='Below noise threshold')
plt.gca().add_patch(circle)
plt.gca().add_patch(box1)
plt.gca().add_patch(box2)

plt.xlim(-11, -2)
plt.ylim(-11, -2)
plt.xlabel(r'log $L_{fl}/L_{kp}$ (A component)')
plt.ylabel(r'log $L_{fl}/L_{kp}$ (B component)')
#plt.legend(fontsize=10, loc=2)
plt.savefig('AB_v4.pdf',dpi=600)


Adding theoretical mass ratio tracks:


In [16]:
ABfile = 'ABtracks.npz'
npz = np.load(ABfile)

In [17]:
Lfl_Lkp_wb = npz['ABarray']
mass_wb = npz['mass']
age_wb = npz['age']

In [18]:
mass_wb


Out[18]:
array([ 0.25,  0.3 ,  0.35,  0.4 ,  0.45,  0.5 ,  0.55,  0.6 ,  0.65,
        0.7 ,  0.75,  0.8 ,  0.85])

In [19]:
for k in range (mass_wb.size):
    plt.plot(Lfl_Lkp_wb[-1,:],Lfl_Lkp_wb[k,:],color='b')



In [20]:
### Final w/ mass ratio tracks ###

plt.figure(figsize=(8,8.1)) 

# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_a2]), np.log10(Lfl_Lbol[m][b][Good_both_a2]), 'ro', alpha = 0.6)
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_b2]), np.log10(Lfl_Lbol[m][b][Good_both_b2]), 'bo', alpha = 0.6)
plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][gbox]), np.log10(Lfl_Lbol[m][b][Good_either][gbox]), 
            alpha = 0.6, s=80, c='g', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][bbox]), np.log10(Lfl_Lbol[m][b][Good_either][bbox]), 
            alpha = 0.6, s=80, c='b', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][ybox]), np.log10(Lfl_Lbol[m][b][Good_either][ybox]), 
            alpha = 0.6, s=80, c='y', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either]), np.log10(Lfl_Lbol[m][b][Good_either]), s=10, c='k', alpha=0.4)


plt.plot([-11,-2], [-11,-2],'b', lw=3, alpha=0.5,label='Idealized')
plt.plot([-11,-2], [-12,-3],'y', lw=3, alpha=0.5,label='Within solar variability')
plt.plot([-11,-2], [-10,-1],'y', lw=3, alpha=0.5)

box1 = plt.Polygon([[-5,-4],[-11,-4],[-11,-2],[-3,-2]],fc='g',alpha=0.1,label='Active Secondary')
box2 = plt.Polygon([[-4,-5],[-4,-11],[-2,-11],[-2,-3]],fc='b',alpha=0.1,label='Active Primary')
circle = plt.Circle((-11, -11), radius=5, fc='r',alpha=0.1,label='Below noise threshold')
plt.gca().add_patch(circle)
plt.gca().add_patch(box1)
plt.gca().add_patch(box2)


for k in range (mass_wb.size):
    plt.plot(Lfl_Lkp_wb[-1,:],Lfl_Lkp_wb[k,:],color='k')

plt.xlim(-11, -2)
plt.ylim(-11, -2)
plt.xlabel(r'log $L_{fl}/L_{kp}$ (A)')
plt.ylabel(r'log $L_{fl}/L_{kp}$ (B)')
plt.legend(fontsize=10, loc=2)
plt.savefig('AB_v4.png',dpi=600)


Mass analysis -


In [14]:
### Mass vs. Activity ###

plt.figure(figsize=(8,8))


# Highlighting systems of interest:
plt.scatter(mass[m][a][Good_either][gbox][0],np.log10(Lfl_Lbol[m][a][Good_either][gbox][0]),s=260,c='white',edgecolor='k',lw=3)
plt.scatter(mass[m][b][Good_either][gbox][0],np.log10(Lfl_Lbol[m][b][Good_either][gbox][0]),s=260,c='white',edgecolor='k',lw=3,marker='s')
plt.scatter(mass[m][a][Good_either][bbox][2],np.log10(Lfl_Lbol[m][a][Good_either][bbox][2]),s=260,c='white',edgecolor='k',lw=3)
plt.scatter(mass[m][b][Good_either][bbox][2],np.log10(Lfl_Lbol[m][b][Good_either][bbox][2]),s=260,c='white',edgecolor='k',lw=3,marker='s')

plt.scatter(mass[m][a][Good_either][bbox],np.log10(Lfl_Lbol[m][a][Good_either][bbox]),alpha = 0.6,s=80,c='b',edgecolor='k')
plt.scatter(mass[m][a][Good_either][gbox],np.log10(Lfl_Lbol[m][a][Good_either][gbox]),alpha = 0.6,s=80,c='g',edgecolor='k')
plt.scatter(mass[m][a][Good_either][ybox],np.log10(Lfl_Lbol[m][a][Good_either][ybox]),alpha = 0.6,s=80,c='y',edgecolor='k')
plt.scatter(mass[m][b][Good_either][bbox],np.log10(Lfl_Lbol[m][b][Good_either][bbox]),alpha = 0.6,s=80,c='b',edgecolor='k',marker='s')
plt.scatter(mass[m][b][Good_either][gbox],np.log10(Lfl_Lbol[m][b][Good_either][gbox]),alpha = 0.6,s=80,c='g',edgecolor='k',marker='s')
plt.scatter(mass[m][b][Good_either][ybox],np.log10(Lfl_Lbol[m][b][Good_either][ybox]),alpha = 0.6,s=80,c='y',edgecolor='k',marker='s')

#Drawing lines between paired stars:
for k in range (len(bbox[0])):
    plt.plot([mass[m][a][Good_either][bbox],mass[m][b][Good_either][bbox]],[np.log10(Lfl_Lbol[m][a][Good_either][bbox]),np.log10(Lfl_Lbol[m][b][Good_either][bbox])],'b',lw=0.2,alpha=0.5,
             label='Active Secondary')

for k in range (len(gbox[0])):
    plt.plot([mass[m][a][Good_either][gbox],mass[m][b][Good_either][gbox]],[np.log10(Lfl_Lbol[m][a][Good_either][gbox]),np.log10(Lfl_Lbol[m][b][Good_either][gbox])],'g',lw=0.2,alpha=0.5,
            label='Active Primary')

for k in range (len(ybox[0])):
    plt.plot([mass[m][a][Good_either][ybox],mass[m][b][Good_either][ybox]],[np.log10(Lfl_Lbol[m][a][Good_either][ybox]),np.log10(Lfl_Lbol[m][b][Good_either][ybox])],'y',lw=0.2,alpha=0.1,
            label='Within solar variability')
    
# ok = np.where(np.isfinite(giclr))
# plt.hist2d(giclr[ok],np.log10(Lfl_Lbol[ok]),bins=100, range=[[-1,4],[-10,-2]], cmap=cm.Greys,norm=LogNorm())
# plt.colorbar()
    
plt.ylabel(r'log $L_{fl}/L_{kp}$')
plt.xlabel(r'Mass ($M_{\odot}$)')
plt.xlim(1.5,.2)

plt.savefig('MassPlot.pdf',dpi=500)



In [15]:
### Mass ratio distribution ###

plt.figure(figsize=(10,5))

_ = plt.hist((mass[m][b][Good_either][ybox])/(mass[m][a][Good_either][ybox]), bins = np.arange(.4,1.1,0.1), histtype = 'stepfilled', color = 'y', edgecolor = 'k')
_ = plt.hist((mass[m][b][Good_either][gbox])/(mass[m][a][Good_either][gbox]), bins = np.arange(.4,1.1,0.1), histtype = 'stepfilled', color = 'g', edgecolor = 'k')
_ = plt.hist((mass[m][b][Good_either][bbox])/(mass[m][a][Good_either][bbox]), bins = np.arange(.4,1.1,0.1), histtype = 'stepfilled', color = 'b', edgecolor = 'k')

plt.ylabel('Number of Pairs')
plt.xlabel('Mass Ratio (B/A)')
plt.xlim(0,1)
plt.savefig('MassHist.pdf',dpi=500)


KS TEST


In [16]:
ydist = (mass[m][b][Good_either][ybox])/(mass[m][a][Good_either][ybox])
gdist = (mass[m][b][Good_either][gbox])/(mass[m][a][Good_either][gbox])
bdist = (mass[m][b][Good_either][bbox])/(mass[m][a][Good_either][bbox])

gbdist = np.concatenate((gdist,bdist))

In [17]:
## KS TEST

stats.ks_2samp(gbdist,ydist)


Out[17]:
Ks_2sampResult(statistic=0.33888888888888885, pvalue=0.26782087011926448)

High p-value indicates we cannot reject the hypothesis that the samples are drawn from the same population.

IDing KICs of same-mass green/blue pairs


In [18]:
print(np.where((mass[m][b][Good_either][gbox])/(mass[m][a][Good_either][gbox]) > 0.8))
print(np.where((mass[m][b][Good_either][bbox])/(mass[m][a][Good_either][bbox]) > 0.8))


(array([0, 1]),)
(array([0, 2]),)

In [19]:
# Mass ratios of green pairs:
print((mass[m][b][Good_either][gbox])/(mass[m][a][Good_either][gbox]))


[ 0.95097019  0.98775179  0.5577816   0.76108634  0.6592446   0.75463712
  0.56029975]

In [20]:
# Grabbing indices of same-mass pairs:
print(m[a][Good_either][gbox][0])
print(m[b][Good_either][gbox][0])
print(m[a][Good_either][gbox][1])
print(m[b][Good_either][gbox][1])

print(m[a][Good_either][bbox][2])
print(m[b][Good_either][bbox][2])


146654
146653
141965
38561
13986
173725

In [21]:
## System 1 KICs
print(kicnum[146654])
print(kicnum[146653])

## System 2 KICs
print(kicnum[141965])
print(kicnum[38561])

print(kicnum[13986])
print(kicnum[173725])


7871442.0
7871438.0
7676737.0
11709022.0
10536761.0
8888573.0

In [22]:
## Rotation Periods

np.where((Kep_ID == 7871442) | (Kep_ID == 7871438))
print(prot[16])
print(prot[17])


2.85
17.45

In [23]:
## FLRs

print(Lfl_Lbol[146654])
print(Lfl_Lbol[146653])


1.061494557e-07
0.000285830055594

In [24]:
gmass = np.where((mass[m][b][Good_either][gbox])/(mass[m][a][Good_either][gbox]) > 0.8)
bmass = np.where((mass[m][b][Good_either][bbox])/(mass[m][a][Good_either][bbox]) > 0.8)
ymass = np.where((mass[m][b][Good_either][ybox])/(mass[m][a][Good_either][ybox]) > 0.8)
allmass = np.where((mass[m][b][Good_either])/(mass[m][a][Good_either]) > 0.8)

In [25]:
### Activity Comparison for pairs w/ mass ratios  > 0.8 ###

plt.figure(figsize=(8,8.1)) 

# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_a2]), np.log10(Lfl_Lbol[m][b][Good_both_a2]), 'ro', alpha = 0.6)
# plt.plot(np.log10(Lfl_Lbol[m][a][Good_both_b2]), np.log10(Lfl_Lbol[m][b][Good_both_b2]), 'bo', alpha = 0.6)
plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][gbox][gmass]), np.log10(Lfl_Lbol[m][b][Good_either][gbox][gmass]), 
            alpha = 0.6, s=80, c='g', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][bbox][bmass]), np.log10(Lfl_Lbol[m][b][Good_either][bbox][bmass]), 
            alpha = 0.6, s=80, c='b', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][ybox][ymass]), np.log10(Lfl_Lbol[m][b][Good_either][ybox][ymass]), 
            alpha = 0.6, s=80, c='y', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either][allmass]), np.log10(Lfl_Lbol[m][b][Good_either][allmass]), 
            alpha = 0.6, s=80, c='none', edgecolor='k')

plt.scatter(np.log10(Lfl_Lbol[m][a][Good_either]), np.log10(Lfl_Lbol[m][b][Good_either]), s=10, c='k', alpha=0.4)


plt.plot([-11,-2], [-11,-2],'b', lw=3, alpha=0.5,label='Idealized')
plt.plot([-11,-2], [-12,-3],'y', lw=3, alpha=0.5,label='Within solar variability')
plt.plot([-11,-2], [-10,-1],'y', lw=3, alpha=0.5)

box1 = plt.Polygon([[-5,-4],[-11,-4],[-11,-2],[-3,-2]],fc='g',alpha=0.1,label='Active Secondary')
box2 = plt.Polygon([[-4,-5],[-4,-11],[-2,-11],[-2,-3]],fc='b',alpha=0.1,label='Active Primary')
circle = plt.Circle((-11, -11), radius=5, fc='r',alpha=0.1,label='Below noise threshold')
plt.gca().add_patch(circle)
plt.gca().add_patch(box1)
plt.gca().add_patch(box2)

plt.xlim(-11, -2)
plt.ylim(-11, -2)
plt.xlabel(r'log $L_{fl}/L_{kp}$ (A component)')
plt.ylabel(r'log $L_{fl}/L_{kp}$ (B component)')
#plt.legend(fontsize=10, loc=2)
plt.savefig('AB_v5.pdf',dpi=600)


Rotation Analysis -


In [26]:
## Since we deleted problem indices in m, we need to delete them in prot ##
prot = np.delete(prot,[72,114])
print(prot)


[  8.27   1.98  19.66  16.31  14.07  24.54  22.84  41.97  41.7   13.21
  25.72  34.12  24.78  36.72  31.82  21.58   2.85  17.45   8.11   7.06
   3.51  30.96  34.12   0.    48.28  39.01  20.84  28.69  12.22  38.27
  12.22   0.61  12.46   4.99  14.64  13.52  14.45  46.4   15.9   20.38
  25.43  19.3   13.77   7.33  22.58   0.    15.44  41.45  20.74  12.57
   2.2   28.25  38.84  37.84  17.41  11.42  14.66   5.5   21.78  18.18
  19.66  15.62  16.08   7.73  19.31  10.38  16.45  20.22  12.11  15.59
  38.99  48.39  24.45  27.    10.29  22.32   7.23  36.17  39.21   5.2
  18.84   4.52   0.72  43.32   6.77  19.25  24.82  29.12   1.72  39.13
  53.99  15.88  19.38  26.08   0.     3.63  27.08  10.98  25.16  35.21
  39.07  42.87  18.89   0.98   0.99  22.14  24.51  45.32  48.65   9.89
   7.2    0.79  11.22  55.17  16.33  31.37  12.27   7.62   0.    11.32
  13.82  34.04   3.86  12.77  10.38  16.28  17.97  16.43  17.25  20.53
  23.5   22.85  21.08  14.19  36.54  20.38  24.77   9.62   0.     0.     5.45
   6.54  13.3   12.75  22.3    8.05  31.12  32.55  18.32  43.85  16.34
  30.85   7.32   2.17   1.47   1.46   0.74   2.82  13.51  13.18   1.52
   4.49  39.5   41.64   5.38   5.27   5.47   5.48  34.82  38.66  18.2
  22.16  19.82  26.84  16.09  44.01  37.92  17.23  53.37  38.86   6.02
   3.48  49.1   45.16]

In [27]:
# Calculating rosby numbers:
rosby = prot/tau[m]
print(rosby)


[ 0.50888803  0.17246794  0.68579472  0.52681341  0.90082304  0.94306092
  0.96303807  1.25872968  2.06617793  0.6503618   1.72771118  1.73774614
  1.80864069  1.80364966  0.84331398  0.72364618  0.09675563  0.63108277
  0.76056742  0.55796176  0.25122024  2.32277248  1.46537875  0.
  1.22445343  1.06147649  1.71577923  1.39479438  1.05338181  1.74586918
  1.05338181  0.06054803  0.70190318  0.41566952  1.15294115  1.17032159
  0.91560499  3.61183265  0.51746275  0.91445153  1.37485664  1.40162574
  0.70111696  0.59252231  0.73624706  0.          0.97598882  1.18691034
  1.12878019  1.06439258  0.08770137  1.83833337  1.18431202  0.73258123
  1.00538582  0.88759375  1.0007572   0.51164784  0.64805725  0.57616146
  0.67749199  0.64409728  0.7787246   0.48980115  0.9675763   0.73492583
  0.64790737  0.87836996  1.02760315  1.20739383  1.89211869  1.59518255
  1.06176865  1.88460964  0.75065323  1.42050622  0.6467497   0.82474456
  1.10378093  0.53919294  0.99435179  0.31317421  0.02818393  1.72314691
  0.15852494  1.50301081  0.93533801  1.98323355  0.11343555  1.54661942
  1.56977437  0.74793744  1.10539134  1.32974342  0.          0.2841436
  1.70971784  0.84432017  0.96278243  1.64748355  1.45294762  2.08094565
  1.35073394  0.03161413  0.046311    1.52832641  1.60000192  2.34744891
  1.4914013   0.70385496  0.44900564  0.07016405  0.32650032  1.27191827
  1.12673934  1.37553381  0.46289227  0.74690916  0.          0.76843992
  0.76630818  1.79934222  0.37660154  1.26837448  0.57281002  1.07494558
  0.83180849  1.40079278  0.7258636   0.72603288  0.90937303  0.96215718
  1.36904625  0.96596694  1.17022024  0.73509451  1.71384134  0.72733959
  0.          0.          0.82475431  0.32355128  0.78528598  1.01988093
  0.94408808  0.99543855  2.15319853  1.38762026  1.1209547   2.73073648
  0.96616817  0.86983355  0.58143001  0.09478749  0.04608464  0.03311674
  0.12360561  0.40975105  0.7578904   1.00266089  0.0640901   0.44127647
  1.52614833  1.74112336  0.44317733  0.48151793  0.29047171  0.1904359
  1.18247954  1.30683919  0.49704547  1.27068535  0.73347388  1.4731524
  0.88046919  1.25807005  0.95701554  0.56781197  1.69302033  1.17176527
  0.55872901  0.32724277  1.555585    1.44994683]

In [28]:
rosby[gbox]


Out[28]:
array([ 1.25872968,  0.25122024,  1.71577923,  1.39479438,  0.        ,
        0.97598882,  1.06439258])

In [150]:
### Rosby number vs. Activity w/ points colored by primary/secondary ###

fig = plt.figure(figsize=(8,8))

plt.scatter(rosby[a][Good_either],np.log10(Lfl_Lbol[m][a][Good_either]),alpha = 0.6,s=80,c='r')
plt.scatter(rosby[b][Good_either],np.log10(Lfl_Lbol[m][b][Good_either]),alpha = 0.6,s=80,c='b')

for j in range (np.size(Good_either[0])):
    plt.plot([rosby[a][Good_either],rosby[b][Good_either]],[np.log10(Lfl_Lbol[m][a][Good_either]),np.log10(Lfl_Lbol[m][b][Good_either])],'k',lw=0.2,alpha=0.1)

plt.xscale('log')
plt.ylim(-8,-2)
plt.xlabel(r'Ro ($P_{rot}/\tau$)')
plt.ylabel(r'log $L_{fl}/L_{kp}$')
plt.savefig('ABrot.png',dpi=500)


/Users/Riley/anaconda/lib/python3.5/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):

In [36]:
### Rosby number vs. Activity w/ points colored by y/g/b activity populations ###

fig = plt.figure(figsize=(8,8))#connect these by lines

for j in range (len(bbox[0])):
    plt.plot([rosby[a][Good_either][bbox],rosby[b][Good_either][bbox]],
             [np.log10(Lfl_Lbol[m][a][Good_either][bbox]),np.log10(Lfl_Lbol[m][b][Good_either][bbox])],'b',lw=0.2,alpha=0.5)

for j in range (len(gbox[0])):
    plt.plot([rosby[a][Good_either][gbox],rosby[b][Good_either][gbox]],
             [np.log10(Lfl_Lbol[m][a][Good_either][gbox]),np.log10(Lfl_Lbol[m][b][Good_either][gbox])],'g',lw=0.2,alpha=0.5)    
  
for j in range (len(ybox[0])):
    plt.plot([rosby[a][Good_either][ybox],rosby[b][Good_either][ybox]],
             [np.log10(Lfl_Lbol[m][a][Good_either][ybox]),np.log10(Lfl_Lbol[m][b][Good_either][ybox])],'y',lw=0.2,alpha=0.1)

# Highlighting pair of interest:
plt.scatter(rosby[a][Good_either][gbox][0],np.log10(Lfl_Lbol[m][a][Good_either][gbox][0]),s=260,c='white', edgecolor = 'k', linewidth=3)
plt.scatter(rosby[b][Good_either][gbox][0],np.log10(Lfl_Lbol[m][b][Good_either][gbox][0]),s=260,c='white', marker = 's', edgecolor = 'k', linewidth=3)
plt.scatter(rosby[a][Good_either][bbox][2],np.log10(Lfl_Lbol[m][a][Good_either][bbox][2]),s=260,c='white', edgecolor = 'k', linewidth=3)
plt.scatter(rosby[b][Good_either][bbox][2],np.log10(Lfl_Lbol[m][b][Good_either][bbox][2]),s=260,c='white', marker = 's', edgecolor = 'k', linewidth=3)

#plt.scatter(rosby[a][Good_either],np.log10(Lfl_Lbol[m][a][Good_either]),alpha = 0.3,s=80,c='k',marker = '.')
#plt.scatter(rosby[b][Good_either],np.log10(Lfl_Lbol[m][b][Good_either]),alpha = 0.3,s=80,c='k',marker = '.')

plt.scatter(rosby[a][Good_either][bbox],np.log10(Lfl_Lbol[m][a][Good_either][bbox]),alpha = 0.6,s=80,c='b',edgecolor = 'k')
plt.scatter(rosby[a][Good_either][gbox],np.log10(Lfl_Lbol[m][a][Good_either][gbox]),alpha = 0.6,s=80,c='g',edgecolor = 'k')
plt.scatter(rosby[a][Good_either][ybox],np.log10(Lfl_Lbol[m][a][Good_either][ybox]),alpha = 0.6,s=80,c='y',edgecolor = 'k')
plt.scatter(rosby[b][Good_either][bbox],np.log10(Lfl_Lbol[m][b][Good_either][bbox]),alpha = 0.6,s=80,c='b',marker='s',edgecolor = 'k')
plt.scatter(rosby[b][Good_either][gbox],np.log10(Lfl_Lbol[m][b][Good_either][gbox]),alpha = 0.6,s=80,c='g',marker='s',edgecolor = 'k')
plt.scatter(rosby[b][Good_either][ybox],np.log10(Lfl_Lbol[m][b][Good_either][ybox]),alpha = 0.6,s=80,c='y',marker='s',edgecolor = 'k')


plt.xscale('log')
plt.xlim(1e-2,1e1)
plt.xlabel(r'Ro ($P_{rot}/\tau$)')
plt.ylabel(r'log $L_{fl}/L_{kp}$')
plt.savefig('GBYrot.pdf',dpi=500)


Separation Distributions


In [37]:
# cross matched using CDS XMatch Service of:
# Gaia DR1 TGAS and KIC
file = '1497471274965A.csv'

In [38]:
gaia = pd.read_csv(file)
gaia.columns


Out[38]:
Index(['angDist', 'ra_ep2000', 'dec_ep2000', 'errHalfMaj', 'errHalfMin',
       'errPosAng', 'ra', 'dec', 'hip', 'tycho2_id', 'solution_id',
       'source_id', 'random_index', 'ref_epoch', 'ra_error', 'dec_error',
       'parallax', 'parallax_error', 'pmra', 'pmra_error', 'pmdec',
       'pmdec_error', 'ra_dec_corr', 'ra_parallax_corr', 'ra_pmra_corr',
       'ra_pmdec_corr', 'dec_parallax_corr', 'dec_pmra_corr', 'dec_pmdec_corr',
       'parallax_pmra_corr', 'parallax_pmdec_corr', 'pmra_pmdec_corr',
       'astrometric_n_obs_al', 'astrometric_n_obs_ac',
       'astrometric_n_good_obs_al', 'astrometric_n_good_obs_ac',
       'astrometric_n_bad_obs_al', 'astrometric_n_bad_obs_ac',
       'astrometric_delta_q', 'astrometric_excess_noise',
       'astrometric_excess_noise_sig', 'astrometric_primary_flag',
       'astrometric_relegation_factor', 'astrometric_weight_al',
       'astrometric_weight_ac', 'astrometric_priors_used',
       'matched_observations', 'duplicated_source',
       'scan_direction_strength_k1', 'scan_direction_strength_k2',
       'scan_direction_strength_k3', 'scan_direction_strength_k4',
       'scan_direction_mean_k1', 'scan_direction_mean_k2',
       'scan_direction_mean_k3', 'scan_direction_mean_k4', 'phot_g_n_obs',
       'phot_g_mean_flux', 'phot_g_mean_flux_error', 'phot_g_mean_mag',
       'phot_variable_flag', 'l', 'b', 'ecl_lon', 'ecl_lat', 'KIC', 'RA',
       'Dec', 'umag', 'gmag', 'rmag', 'imag', 'zmag', 'Jmag', 'Hmag', 'Kmag',
       'kepmag', 'pmRA', 'pmDec', 'sg', 'v', 'cq', 'aq', 'fc'],
      dtype='object')

In [39]:
jfile = 'Janes2017_data.txt'

janes = pd.read_table(jfile, delim_whitespace=True, comment='#',
                      names=('Bid', 'KIC', 'pm_ra', 'pme_ra', 'pm_de', 'pme_de', 
                             'Sep','Irp', 'gmag', 'g_Ks', 'per','e_per','V','e_V', 'NQtrs', 'flag'))

In [40]:
janes.shape


Out[40]:
(186, 16)

In [41]:
big_table = pd.merge(janes, gaia, how='inner', left_on='KIC', right_on=u'KIC')
big_table.shape


Out[41]:
(55, 99)

In [42]:
gaia_dist = np.zeros(len(janes)) - 1

for i in range(len(janes)):
    x = np.where((gaia[u'KIC'] == janes['KIC'].values[i]))[0]
    if len(x) > 0:
         gaia_dist[i] = 1000./ gaia[u'parallax'].values[x]

In [43]:
psep1 = gaia_dist*sep # Distances from GAIA

In [44]:
sep = np.delete(sep,[72,114]) # Deleting problem indices

In [45]:
psep2 = jim_dist[m]*sep # Distances from Davenport (2016)

In [46]:
### Physical separation [AU] distribution ###

fig = plt.figure(figsize = (10,5))

plt.hist(psep2[a][Good_either],bins=20,range=(0,30000),histtype='stepfilled',color='grey',edgecolor='k')

plt.hist(psep2[a][Good_either][ybox],bins=20,range=(0,30000),histtype='stepfilled',color='y',edgecolor='k')
plt.hist(psep2[a][Good_either][gbox],bins=20,range=(0,30000),histtype='stepfilled',color='g',edgecolor='k')
plt.hist(psep2[a][Good_either][bbox],bins=20,range=(0,30000),histtype='stepfilled',color='b',edgecolor='k')

plt.xlabel('Projected Physical Separation [AU]')
plt.ylabel('Number of binaries')

plt.savefig('sephist.pdf', dpi=300)



In [47]:
prob = np.delete(prob,[72,114])

In [48]:
prob = prob*0.00001

In [49]:
fig = plt.figure(figsize = (10,5))

plt.hist(prob[a][Good_either][ybox],bins=20,histtype='stepfilled',color='y',edgecolor='k')
plt.hist(prob[a][Good_either][gbox],bins=20,histtype='stepfilled',color='g',edgecolor='k')
plt.hist(prob[a][Good_either][bbox],bins=20,histtype='stepfilled',color='b',edgecolor='k')

plt.xlabel('Probability of chance alignment')
plt.ylabel('Number of binaries')

plt.savefig('probhist.pdf',dpi=300)


Appendix A: Light Curves for Targets of Interest -


In [50]:
from astropy.io import fits

In [51]:
target_1b = fits.open('kplr007871438-2009166043257_llc.fits')
target_1a = fits.open('kplr007871442-2009166043257_llc.fits')
target_2a = fits.open('kplr010536761-2009166043257_llc.fits')
target_2b = fits.open('kplr008888573-2009350155506_llc.fits')

In [52]:
target_1a.info()


Filename: kplr007871442-2009166043257_llc.fits
No.    Name         Type      Cards   Dimensions   Format
  0  PRIMARY     PrimaryHDU      58   ()      
  1  LIGHTCURVE  BinTableHDU    155   1639R x 20C   [D, E, J, E, E, E, E, E, E, J, D, E, D, E, D, E, D, E, E, E]   
  2  APERTURE    ImageHDU        48   (6, 5)   int32   

In [53]:
target_1b.info()


Filename: kplr007871438-2009166043257_llc.fits
No.    Name         Type      Cards   Dimensions   Format
  0  PRIMARY     PrimaryHDU      58   ()      
  1  LIGHTCURVE  BinTableHDU    155   1639R x 20C   [D, E, J, E, E, E, E, E, E, J, D, E, D, E, D, E, D, E, E, E]   
  2  APERTURE    ImageHDU        48   (6, 6)   int32   

In [54]:
target_1a[0].header


Out[54]:
SIMPLE  =                    T / conforms to FITS standards                     
BITPIX  =                    8 / array data type                                
NAXIS   =                    0 / number of array dimensions                     
EXTEND  =                    T / file contains extensions                       
NEXTEND =                    2 / number of standard extensions                  
EXTNAME = 'PRIMARY '           / name of extension                              
EXTVER  =                    1 / extension version number (not format version)  
ORIGIN  = 'NASA/Ames'          / institution responsible for creating this file 
DATE    = '2015-09-01'         / file creation date.                            
CREATOR = '796113 FluxExporter2PipelineModule' / pipeline job and program used t
PROCVER = 'svn+ssh://murzim/repo/soc/tags/release/9.3.22 r60269' / SW version   
FILEVER = '6.1     '           / file format version                            
TIMVERSN= 'OGIP/93-003'        / OGIP memo number for file format               
TELESCOP= 'Kepler  '           / telescope                                      
INSTRUME= 'Kepler Photometer'  / detector type                                  
OBJECT  = 'KIC 7871442'        / string version of target id                    
KEPLERID=              7871442 / unique Kepler target identifier                
CHANNEL =                    2 / CCD channel                                    
SKYGROUP=                   30 / roll-independent location of channel           
MODULE  =                    2 / CCD module                                     
OUTPUT  =                    2 / CCD output                                     
QUARTER =                    1 / Observing quarter                              
SEASON  =                    3 / mission season during which data was collected 
DATA_REL=                   25 / data release version number                    
OBSMODE = 'long cadence'       / observing mode                                 
MISSION = 'Kepler  '           / Mission name                                   
TTABLEID=                   20 / target table id                                
RADESYS = 'ICRS    '           / reference frame of celestial coordinates       
RA_OBJ  =           282.867320 / [deg] right ascension                          
DEC_OBJ =            43.670630 / [deg] declination                              
EQUINOX =               2000.0 / equinox of celestial coordinate system         
PMRA    =               0.0000 / [arcsec/yr] RA proper motion                   
PMDEC   =               0.0000 / [arcsec/yr] Dec proper motion                  
PMTOTAL =               0.0000 / [arcsec/yr] total proper motion                
PARALLAX=                      / [arcsec] parallax                              
GLON    =            73.285844 / [deg] galactic longitude                       
GLAT    =            18.347176 / [deg] galactic latitude                        
GMAG    =               15.893 / [mag] SDSS g band magnitude                    
RMAG    =               14.516 / [mag] SDSS r band magnitude                    
IMAG    =               13.852 / [mag] SDSS i band magnitude                    
ZMAG    =               13.503 / [mag] SDSS z band magnitude                    
D51MAG  =               15.659 / [mag] D51 magnitude,                           
JMAG    =               12.256 / [mag] J band magnitude from 2MASS              
HMAG    =               11.599 / [mag] H band magnitude from 2MASS              
KMAG    =               11.435 / [mag] K band magnitude from 2MASS              
KEPMAG  =               14.464 / [mag] Kepler magnitude (Kp)                    
GRCOLOR =                1.377 / [mag] (g-r) color, SDSS bands                  
JKCOLOR =                0.821 / [mag] (J-K) color, 2MASS bands                 
GKCOLOR =                4.458 / [mag] (g-K) color, SDSS g - 2MASS K            
TEFF    =                 3780 / [K] Effective temperature                      
LOGG    =                4.781 / [cm/s2] log10 surface gravity                  
FEH     =               -0.300 / [log10([Fe/H])]  metallicity                   
EBMINUSV=                0.033 / [mag] E(B-V) reddening                         
AV      =                0.104 / [mag] A_v extinction                           
RADIUS  =                0.464 / [solar radii] stellar radius                   
TMINDEX =            280909235 / unique 2MASS catalog ID                        
SCPID   =                      / unique SCP processing ID                       
CHECKSUM= 'EJRiE9PgEGPgE9Pg'   / HDU checksum updated 2015-09-01T15:21:03Z      

In [55]:
target_1b[0].header


Out[55]:
SIMPLE  =                    T / conforms to FITS standards                     
BITPIX  =                    8 / array data type                                
NAXIS   =                    0 / number of array dimensions                     
EXTEND  =                    T / file contains extensions                       
NEXTEND =                    2 / number of standard extensions                  
EXTNAME = 'PRIMARY '           / name of extension                              
EXTVER  =                    1 / extension version number (not format version)  
ORIGIN  = 'NASA/Ames'          / institution responsible for creating this file 
DATE    = '2015-09-01'         / file creation date.                            
CREATOR = '796113 FluxExporter2PipelineModule' / pipeline job and program used t
PROCVER = 'svn+ssh://murzim/repo/soc/tags/release/9.3.22 r60269' / SW version   
FILEVER = '6.1     '           / file format version                            
TIMVERSN= 'OGIP/93-003'        / OGIP memo number for file format               
TELESCOP= 'Kepler  '           / telescope                                      
INSTRUME= 'Kepler Photometer'  / detector type                                  
OBJECT  = 'KIC 7871438'        / string version of target id                    
KEPLERID=              7871438 / unique Kepler target identifier                
CHANNEL =                    2 / CCD channel                                    
SKYGROUP=                   30 / roll-independent location of channel           
MODULE  =                    2 / CCD module                                     
OUTPUT  =                    2 / CCD output                                     
QUARTER =                    1 / Observing quarter                              
SEASON  =                    3 / mission season during which data was collected 
DATA_REL=                   25 / data release version number                    
OBSMODE = 'long cadence'       / observing mode                                 
MISSION = 'Kepler  '           / Mission name                                   
TTABLEID=                   20 / target table id                                
RADESYS = 'ICRS    '           / reference frame of celestial coordinates       
RA_OBJ  =           282.863800 / [deg] right ascension                          
DEC_OBJ =            43.674520 / [deg] declination                              
EQUINOX =               2000.0 / equinox of celestial coordinate system         
PMRA    =               0.0000 / [arcsec/yr] RA proper motion                   
PMDEC   =               0.0000 / [arcsec/yr] Dec proper motion                  
PMTOTAL =               0.0000 / [arcsec/yr] total proper motion                
PARALLAX=                      / [arcsec] parallax                              
GLON    =            73.288755 / [deg] galactic longitude                       
GLAT    =            18.350915 / [deg] galactic latitude                        
GMAG    =               15.502 / [mag] SDSS g band magnitude                    
RMAG    =               14.152 / [mag] SDSS r band magnitude                    
IMAG    =               13.423 / [mag] SDSS i band magnitude                    
ZMAG    =               13.014 / [mag] SDSS z band magnitude                    
D51MAG  =               15.295 / [mag] D51 magnitude,                           
JMAG    =               11.659 / [mag] J band magnitude from 2MASS              
HMAG    =               11.006 / [mag] H band magnitude from 2MASS              
KMAG    =               10.814 / [mag] K band magnitude from 2MASS              
KEPMAG  =               14.047 / [mag] Kepler magnitude (Kp)                    
GRCOLOR =                1.350 / [mag] (g-r) color, SDSS bands                  
JKCOLOR =                0.845 / [mag] (J-K) color, 2MASS bands                 
GKCOLOR =                4.688 / [mag] (g-K) color, SDSS g - 2MASS K            
TEFF    =                 3757 / [K] Effective temperature                      
LOGG    =                4.753 / [cm/s2] log10 surface gravity                  
FEH     =               -0.100 / [log10([Fe/H])]  metallicity                   
EBMINUSV=                0.029 / [mag] E(B-V) reddening                         
AV      =                0.090 / [mag] A_v extinction                           
RADIUS  =                0.494 / [solar radii] stellar radius                   
TMINDEX =            280909224 / unique 2MASS catalog ID                        
SCPID   =                      / unique SCP processing ID                       
CHECKSUM= 'GGNjJEMhGEMhGEMh'   / HDU checksum updated 2015-09-01T15:21:03Z      

In [56]:
cols = target_1a[1].columns

In [57]:
cols.info()


name:
    ['TIME', 'TIMECORR', 'CADENCENO', 'SAP_FLUX', 'SAP_FLUX_ERR', 'SAP_BKG', 'SAP_BKG_ERR', 'PDCSAP_FLUX', 'PDCSAP_FLUX_ERR', 'SAP_QUALITY', 'PSF_CENTR1', 'PSF_CENTR1_ERR', 'PSF_CENTR2', 'PSF_CENTR2_ERR', 'MOM_CENTR1', 'MOM_CENTR1_ERR', 'MOM_CENTR2', 'MOM_CENTR2_ERR', 'POS_CORR1', 'POS_CORR2']
format:
    ['D', 'E', 'J', 'E', 'E', 'E', 'E', 'E', 'E', 'J', 'D', 'E', 'D', 'E', 'D', 'E', 'D', 'E', 'E', 'E']
unit:
    ['BJD - 2454833', 'd', '', 'e-/s', 'e-/s', 'e-/s', 'e-/s', 'e-/s', 'e-/s', '', 'pixel', 'pixel', 'pixel', 'pixel', 'pixel', 'pixel', 'pixel', 'pixel', 'pixels', 'pixels']
null:
    ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
bscale:
    ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
bzero:
    ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
disp:
    ['D14.7', 'E13.6', 'I10', 'E14.7', 'E14.7', 'E14.7', 'E14.7', 'E14.7', 'E14.7', 'B16.16', 'F10.5', 'E14.7', 'F10.5', 'E14.7', 'F10.5', 'E14.7', 'F10.5', 'E14.7', 'E14.7', 'E14.7']
start:
    ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
dim:
    ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']

In [58]:
k1a_data = target_1a[1].data
k1b_data = target_1b[1].data
k2a_data = target_2a[1].data
k2b_data = target_2b[1].data

In [59]:
time_1a = k1a_data['TIME'] 
flux_1a = k1a_data['PDCSAP_FLUX'] 
rel_flux_1a = (flux_1a-np.nanmedian(flux_1a))/np.nanmedian(flux_1a)
err_1a = k1a_data['PDCSAP_FLUX_ERR']

time_1b = k1b_data['TIME'] 
flux_1b = k1b_data['PDCSAP_FLUX']
rel_flux_1b = (flux_1b-np.nanmedian(flux_1b))/np.nanmedian(flux_1b)
err_1b = k1b_data['PDCSAP_FLUX_ERR']

time_2a = k2a_data['TIME'] 
flux_2a = k2a_data['PDCSAP_FLUX']
rel_flux_2a = (flux_2a-np.nanmedian(flux_2a))/np.nanmedian(flux_2a)
err_2a = k2a_data['PDCSAP_FLUX_ERR']

time_2b = k2b_data['TIME'] 
flux_2b = k2b_data['PDCSAP_FLUX'] 
rel_flux_2b = (flux_2b-np.nanmedian(flux_2b))/np.nanmedian(flux_2b)
err_2b = k2b_data['PDCSAP_FLUX_ERR']

Light curves:


In [60]:
fig = plt.figure(figsize = (11,5))

plt.plot(time_1a,rel_flux_1a,color='g')
#plt.errorbar(time,flux,yerr=err,color='g',linestyle="None")
plt.xlim(150,160)
plt.ylim(-0.01,0.01)
plt.xlabel('Time [BJD-2454833]')
plt.ylabel('Relative Flux')
plt.title('KIC 7871442')

plt.savefig('lc1.pdf', dpi=300)



In [61]:
fig = plt.figure(figsize = (11,5))

plt.plot(time_1b,rel_flux_1b,color='g')
#plt.errorbar(time,flux,yerr=err,color='g',linestyle="None")
plt.xlim(150,160)
plt.ylim(-0.02,0.04)
plt.xlabel('Time [BJD-2454833]')
plt.ylabel('Relative Flux')
plt.title('KIC 7871438')

plt.savefig('lc2.pdf', dpi=300)



In [62]:
fig = plt.figure(figsize = (11,5))

plt.plot(time_2a,rel_flux_2a,color='b')
#plt.errorbar(time,flux,yerr=err,color='g',linestyle="None")
plt.xlim(150,160)
plt.ylim(-0.02,0.05)
plt.xlabel('Time [BJD-2454833]')
plt.ylabel('Relative Flux')
plt.title('KIC 10536761')

plt.savefig('lc3.pdf', dpi=300)



In [63]:
fig = plt.figure(figsize = (11,5))

plt.plot(time_2b,rel_flux_2b,color='b')
#plt.errorbar(time,flux,yerr=err,color='g',linestyle="None")
plt.ylim(-0.01,0.01)
plt.xlim(260,300)
plt.xlabel('Time [BJD-2454833]')
plt.ylabel('Relative Flux')
plt.title('KIC 8888573')

plt.savefig('lc4.pdf', dpi=300)


Appendix B: Table


In [10]:
from astropy.table import Table,Column

In [53]:
## Need to combine lists of A- and B-components such that binary pairs are listed together in each column.

kicall = np.zeros(116)
x=0
y=0

for i in range(116):
    if i%2 == 0:
        kicall[i] = kicnum[m][a][Good_either][x]
        x = x+1
    else:
        kicall[i] = kicnum[m][b][Good_either][y]
        y = y+1

In [54]:
giall = np.zeros(116)
x=0
y=0

for i in range(116):
    if i%2 == 0:
        giall[i] = giclr[m][a][Good_either][x]
        x = x+1
    else:
        giall[i] = giclr[m][b][Good_either][y]
        y = y+1

In [55]:
protall = np.zeros(116)
x=0
y=0

for i in range(116):
    if i%2 == 0:
        protall[i] = prot[a][Good_either][x]
        x = x+1
    else:
        protall[i] = prot[b][Good_either][y]
        y = y+1

In [56]:
Lfl_Lbol_all = np.zeros(116)
x=0
y=0

for i in range(116):
    if i%2 == 0:
        Lfl_Lbol_all[i] = Lfl_Lbol[m][a][Good_either][x]
        x = x+1
    else:
        Lfl_Lbol_all[i] = Lfl_Lbol[m][b][Good_either][y]
        y = y+1

In [57]:
mass_all = np.zeros(116)
x=0
y=0

for i in range(116):
    if i%2 == 0:
        mass_all[i] = mass[m][a][Good_either][x]
        x = x+1
    else:
        mass_all[i] = mass[m][b][Good_either][y]
        y = y+1

In [58]:
jim_dist_all = np.zeros(116)
x=0
y=0

for i in range(116):
    if i%2 == 0:
        jim_dist_all[i] = jim_dist[m][a][Good_either][x]
        x = x+1
    else:
        jim_dist_all[i] = jim_dist[m][b][Good_either][y]
        y = y+1

In [59]:
## Making an array for pair ID numbers, i.e. [1,1,2,2,3,3,...]

bnum = np.zeros(116)
cnt = 0
for j in range(116):
    if j%2 == 0:
        bnum[j] = cnt+1
       
    else:
        bnum[j] = cnt+1
        cnt = cnt+1
    

bnum = bnum.astype(int)

In [60]:
## Building table

t = Table(masked= True)

t['KIC'] = kicall.astype(int)
t['Binary Number'] = bnum
t['g-i'] = giall
t[r'$P_{rot}$ [days]'] = protall
t['Parallax [mas]'] = jim_dist_all
t[r'$L_{fl}/L_{kp}$'] = Lfl_Lbol_all
t[r'Mass $[M_{\odot}]$'] = mass_all

#Column formatting
t['g-i'].format = '7.2f'
t['Parallax [mas]'].format = '7.1f'
t[r'Mass $[M_{\odot}]$'].format = '7.3f'
t[r'$L_{fl}/L_{kp}$'].format = '7.3'

#Masking nans in giclr 
t['g-i'].mask = np.isnan(giall)

In [61]:
t.show_in_notebook()


Out[61]:
<Table masked=True length=116>
idxKICBinary Numberg-i$P_{rot}$ [days]Parallax [mas]$L_{fl}/L_{kp}$Mass $[M_{\odot}]$
0709065410.431.98140.73.4e-051.163
1709064910.788.27151.81.15e-060.923
2765940222.1219.66247.83.04e-060.607
3765941722.2716.31292.41.38e-050.571
4758268730.7214.07274.33.25e-070.949
5758269131.8924.54304.91.16e-070.655
680067404--22.8468.21.63e-070.703
7814390342.4041.9792.18.1e-070.537
8593679750.6725.72609.35.5e-060.980
9593681151.0934.12667.71.19e-050.808
10709395360.5824.78567.07.22e-071.036
11709396861.1636.72624.47.96e-070.788
121025569272.1821.58170.14.75e-070.588
131025568972.5531.82212.01.12e-060.483
14787144282.0417.45190.71.06e-070.625
15787143882.082.85131.00.0002860.594
161106966290.5730.96415.94.75e-071.055
171106965590.593.51254.33.63e-071.023
1810388283102.5039.01140.11.46e-050.494
1910388259102.6148.28147.16.58e-060.465
2010518551110.4520.84149.73.19e-081.122
2110518563111.1928.69350.21.29e-060.782
229139163120.340.6181.43.29e-071.263
239139151120.4512.2297.61.58e-071.155
244995565130.7215.44148.01.29e-080.941
254995581132.4541.45195.72.7e-060.516
264043389142.3938.8431.29.64e-070.544
27414291314--37.8411.83.31e-070.361
286678383150.5111.42389.37.3e-071.080
296678367150.8617.41450.41.09e-060.884
309579208160.385.5187.17.04e-081.213
319579191160.6514.66246.32.71e-070.991
327432575171.6915.62252.11.6e-060.692
337432573174.0619.66280.71.87e-060.601
349762519180.727.73455.10.0001030.942
359762514181.1716.08619.26.03e-060.779
367596937190.6210.38345.33.97e-071.016
377596922191.1119.31459.11.3e-060.799
3812456757200.6127.0354.32.51e-071.036
3910529126200.7310.29228.12.87e-060.945
407676737211.740.72137.73.98e-070.673
411170902221--4.5259.50.0005110.665
4212507868220.496.77184.45.37e-081.083
437676799222.6543.32176.64.04e-060.433
447885518230.6224.82383.86.01e-070.990
4512507882231.9619.25282.46.48e-070.645
4611861593241.2653.99494.38.27e-070.764
4711241109242.5139.1396.41.81e-060.523
48244268725--27.08196.01.67e-071.073
497750144250.773.63438.93.17e-060.940
507118431261.1939.07197.21.14e-070.781
513955963262.0135.21204.49.09e-070.639
527118479270.3642.87334.49e-071.022
538098178272.2418.89292.60.0001480.570
542992956280.680.99113.99.53e-080.999
558098181281.180.98165.40.00120.760
562992960290.7422.14118.33.85e-100.962
577364380291.0624.51156.01.48e-070.818
5810275409300.6048.65257.72.11e-071.019
597364389302.4045.32193.11.94e-060.547
601053675331--7.2122.30.0001561.178
6110275420310.769.89335.61.57e-060.932
6210536761322.410.79124.20.0001290.524
638888573322.6911.2266.51.41e-070.427
644931390330.3031.37121.53.98e-071.253
654931385331.9616.33148.55.83e-070.646
668565874340.5712.27619.82.93e-051.042
678565877340.627.62464.23.08e-070.987
689897318350.960.0461.41.3e-060.859
699897328351.0311.32433.01.97e-060.830
7012214504360.7012.77506.81.74e-060.969
7112214492360.943.86505.43.77e-060.856
7212068975370.4216.28317.06.33e-071.147
7312068971371.2710.38361.19.06e-070.754
7411515925381.1217.97176.83.65e-070.702
7511515931382.0916.43191.81.3e-060.614
765202445391.4020.53201.13.51e-060.703
775202421391.9017.25235.32.06e-060.659
7810612448402.0714.1977.06.18e-070.624
7910612424402.3321.0888.55.1e-070.567
80448423841--20.3862.43.9e-071.061
814386086410.6936.5490.25.97e-071.000
8212317678420.299.6298.51.54e-071.267
8312218888420.4824.77250.82.24e-091.121
848248671430.526.54207.73.78e-071.101
858248626430.835.45275.13.78e-070.897
861202409844--12.75605.71.48e-091.445
8712024088441.4613.3454.51.6e-060.706
8811724888450.8332.55435.34.22e-060.931
8911724885450.8531.12628.58.68e-070.920
90622571846--16.3441.31.24e-071.096
91622581646--30.8543.70.0004380.722
9211876220472.367.32193.94.54e-050.557
9311876227472.762.17133.20.0006570.420
941061612448-0.061.47329.71.25e-051.724
9510616138480.011.46258.28.19e-061.591
968184081490.542.82228.21.69e-061.065
978184075490.910.74170.37.75e-070.866
9810355856500.3113.18117.83.05e-071.255
9910355809500.7013.51133.90.0002720.703
1005211089511.694.49363.42.41e-060.699
1015211083511.891.52338.41.08e-060.658
10211098013520.3841.64260.31.22e-071.199
10311098004520.4739.5310.48.54e-071.122
104654540353--5.38116.85.61e-070.833
1056545415532.125.27176.15.86e-070.605
1064864392540.9422.16271.03.54e-070.853
1074864391542.0218.2316.58.01e-060.636
10810230145550.9719.8293.11.73e-080.851
10910296031552.3726.84139.03.45e-060.516
11010622511562.2744.0187.42.43e-060.580
11110557342562.6416.09139.74.53e-070.463
1128909853572.3037.92155.48.34e-060.562
1138909876572.3917.23175.83.11e-060.539
11410164867580.3238.86228.41.35e-071.221
11510164839580.3353.37258.41.9e-071.211

In [62]:
## Write table to deluxetable .tex file

t.write('wbtable', format='ascii.aastex', delimiter = '&', overwrite = True)

In [ ]: