In [1]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

from keputils import koiutils as ku

from vespa.populations import HEBPopulation, EBPopulation
from vespa.transit_basic import MAInterpolationFunction


/u/tdm/anaconda/lib/python2.7/site-packages/setuptools-7.0-py2.7.egg/pkg_resources.py:1045: UserWarning: /u/tdm/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).

In [2]:
import logging
rootLogger = logging.getLogger()
rootLogger.setLevel(logging.INFO)

In [7]:
#MAfn = MAInterpolationFunction(nzs=200,nps=200,pmin=0.05,pmax=1/0.05)
MAfn = MAInterpolationFunction(nzs=200,nps=400,pmin=0.007,pmax=1/0.007)

In [8]:
mags = ku.KICmags(87) #Kepler-22
mass = (0.83, 0.05)
age = (9.6, 0.1)
feh = (0.0, 0.1)
period = ku.get_property(87, 'koi_period')
pop = HEBPopulation(mass=mass, age=age, feh=feh, mags=mags,
                    period=period, n=1000, MAfn=MAfn)
#pop = EBPopulation(mass=mass, age=age, feh=feh, mags=mags,
#                   period=period, n=1000, MAfn=MAfn)

In [9]:
pop.save_hdf('test_heb.h5', overwrite=True)

In [4]:
pop = HEBPopulation().load_hdf('/u/tdm/testheb_trapfits.h5')

In [10]:
pop.prophist2d('duration', 'slope', interpolation='bicubic', logscale=True)



In [14]:
pop2 = EBPopulation().load_hdf('test_heb.h5')

In [15]:
pop2._properties


Out[15]:
['period',
 'model',
 'priorfactors',
 'lhoodcachefile',
 'mags',
 'colors',
 'colortol',
 'starfield',
 'f_binary',
 'f_triple',
 'qmin',
 'minmass',
 'period_long_fn',
 'period_short_fn',
 'ecc_fn',
 'name']

In [14]:
pop2 = EBPopulation().load_hdf('test_heb.h5')

In [16]:
for p in pop2._properties:
    print p,getattr(pop2,p)


period 289.8622
model EBs
priorfactors {'f_binary': 0.4}
lhoodcachefile None
mags {'j': 10.523, 'g': 12.042879099999999, 'i': 11.4300704, 'h': 10.211, 'k': 10.152000000000001, 'J': 10.523, 'Ks': 10.152000000000001, 'r': 11.596865200000002, 'H': 10.211, 'Kepler': 11.664000000000001, 'z': 11.393061000000001, 'K': 10.152000000000001, 'kep': 11.664000000000001}
colors ['JK']
colortol 0.1
starfield None
f_binary 0.4
f_triple 0
qmin 0.1
minmass 0.11
period_long_fn None
period_short_fn <function draw_msc_periods at 0x7f9104f41aa0>
ecc_fn <function draw_eccs at 0x7f9104f41b18>
name 

In [12]:
pop2.orbpop.scatterplot(rmax=10000)



In [11]:
import starutils

In [33]:
class A(object):
    def __init__(self):
        pass
    
    @property
    def __prop(self):
        return 'a'
    
class B(object):
    def __init__(self):
        pass
    
    @property
    def __prop(self):
        return 'b'
    
class C(A,B):
    def __init__(self):
        B.__init__(self)
        pass
    
    @property
    def __prop(self):
        return 'c' + super(C,self)._A__prop + self._B__prop

In [37]:
C().prop


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-37-4119942eefc5> in <module>()
----> 1 C().prop

AttributeError: 'C' object has no attribute 'prop'

In [20]:
pop._properties


Out[20]:
['prob',
 'dprob',
 'f_triple',
 'mags',
 'colors',
 'colortol',
 'starfield',
 'f_binary',
 'f_triple',
 'qmin',
 'minmass',
 'period_long_fn',
 'period_short_fn',
 'ecc_fn',
 'name']

In [22]:
super(HEBPopulation, pop)


Out[22]:
<super: vespa.populations.HEBPopulation,
        <vespa.populations.HEBPopulation at 0x7fa0ebc4c5d0>>

In [26]:
pop


Out[26]:
<vespa.populations.HEBPopulation at 0x7fbf75c85b90>

In [27]:
pop.stars.columns


Out[27]:
Index([u'level_0', u'H_mag', u'H_mag_A', u'J_mag', u'J_mag_A', u'K_mag', u'K_mag_A', u'Kepler_mag', u'Kepler_mag_A', u'Teff_A', u'age_A', u'g_mag', u'g_mag_A', u'i_mag', u'i_mag_A', u'logL_A', u'logg_A', u'mass_A', u'r_mag', u'r_mag_A', u'radius_A', u'z_mag', u'z_mag_A', u'H_mag_B', u'J_mag_B', u'K_mag_B', u'Kepler_mag_B', u'Teff_B', u'age_B', u'g_mag_B', u'i_mag_B', u'logL_B', u'logg_B', u'mass_B', u'r_mag_B', u'radius_B', u'z_mag_B', u'H_mag_C', u'J_mag_C', u'K_mag_C', u'Kepler_mag_C', u'Teff_C', u'age_C', u'g_mag_C', u'i_mag_C', u'logL_C', u'logg_C', u'mass_C', u'r_mag_C', u'radius_C', u'z_mag_C', u'distance', u'distmod', u'Kepler_mag_1', u'Kepler_mag_2', u'Kepler_mag_tot', u'P', u'T14_pri', u'T14_sec', u'T23_pri', u'T23_sec', u'b_pri', u'b_sec', u'dpri', u'dsec', u'ecc', u'fluxfrac_1', u'fluxfrac_2', u'inc', u'switched', u'u1_1', u'u1_2', u'u2_1', u'u2_2', u'w', u'mass_1', u'radius_1', u'mass_2', u'radius_2'], dtype='object')

In [1]:
from starutils.utils import fluxfrac

In [2]:
fluxfrac(10,12,11)


Out[2]:
0.6424272485213797

In [3]:
fluxfrac(10,10)


Out[3]:
0.5

In [ ]: