public
Created

Transit model function

  • Download Gist
gistfile1.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
def trend(p,t):
"""
Fit the local transit shape with the following function.
 
"""
domain = [t.min(),t.max()]
return Legendre(p,domain=domain)(t)
def P051T(p,t):
"""
Protopapas single transit
 
Single transit + trend
 
Parameters
----------
 
p : List of parameters.
p[0] epoch
p[1] df
p[2] tdur
p[3:] passed to trend
 
P : period
 
Period is held fixed since for a single transit, it doesnot make
sense to specify period and epoch
 
"""
P = 100
pP05 = [P , p[0] , p[1] , p[2] ]
sig = P05(pP05,t)
 
ptrend = p[3:]
tr = trend(ptrend,t)
 
return sig + tr
 
def P05(p,t):
"""
Analytic model of Protopapas 2005.
"""
P = p[0]
epoch = p[1]
df = p[2]
tdur = p[3]
 
tp = tprime(P,epoch,tdur,t)
 
return df * ( 0.5*( 2. - tanh(c*(tp + 0.5)) + tanh(c*(tp - 0.5)) ) - 1.)
 
def tprime(P,epoch,tdur,t):
"""
t' in Protopapas
"""
return ( P*sin( pi*(t - epoch) / P ) ) / (pi*tdur)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.