Created
February 26, 2012 02:02
-
-
Save petigura/1912265 to your computer and use it in GitHub Desktop.
Transit model function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment