Exemplo n.º 1
0
    def __init__(self, t, f, fe, texp, tol, mdep):
        self.t = t - np.min(t)
        self.period = 10 * np.max(self.t)
        self.texp, self.tol, self.mdep = texp, tol, mdep

        # Sample some parameters.
        self.q1, self.q2 = np.random.rand(), np.random.rand()
        self.t0 = np.max(self.t) * np.random.rand()
        self.tau = 0.05 + (1-0.05) * np.random.rand()
        self.ror = 0.008 + (0.2-0.008) * np.random.rand()
        self.b = np.random.rand()

        # Generate a synthetic transit.
        u1, u2 = 2*self.q1*self.q2, self.q1*(1-2*self.q2)
        lc = transit.ldlc_simple(self.t, u1, u2, self.period, self.t0,
                                 self.tau, self.ror, self.b, texp, tol, mdep)

        # Inject the transit and normalize the data.
        mu = np.median(f * lc)
        self.f = f * lc / mu
        self.fe = fe / mu

        # Set up the results directory.
        bp = self.basepath
        try:
            os.makedirs(bp)
        except os.error:
            pass

        pl.plot(self.t, self.f, ".k", ms=4, alpha=0.6)
        pl.savefig(os.path.join(bp, "data.png"))
Exemplo n.º 2
0
 def lnlike(self, lna, lns, q1, q2, t0, tau, ror, b):
     kernel = ExpSquaredKernel(np.exp(lna), np.exp(lns))
     gp = george.GaussianProcess(kernel)
     gp.compute(self.t, self.fe)
     u1, u2 = 2*q1*q2, q1*(1-2*q2)
     lc = transit.ldlc_simple(self.t, u1, u2, self.period, t0, tau, ror, b,
                              self.texp, self.tol, self.mdep)
     return gp.lnlikelihood(self.f - lc)
Exemplo n.º 3
0
def model(p):
    q1, q2, per, t0, tau, ror, b = p
    u1, u2 = 2*q1*q2, q1*(1-2*q2)
    return transit.ldlc_simple(t, u1, u2, per, t0, tau, ror, b,
                               texp, 1e-1, 4)
Exemplo n.º 4
0
def model(t, fstar, q1, q2, t0, tau, ror, b, texp=54.2 / 86400.):
    u1, u2 = 2*q1*q2, q1*(1-2*q2)
    lc = ldlc_simple(t, u1, u2, period, t0, tau, ror, b, texp, tol, maxdepth)
    return fstar * lc
Exemplo n.º 5
0
def model(fstar, q1, q2, t0, tau, ror, b):
    u1, u2 = 2*q1*q2, q1*(1-2*q2)
    lc = ldlc_simple(t, u1, u2, period, t0, tau, ror, b, texp, tol, maxdepth)
    return fstar * lc