Esempio n. 1
0
            def get_value(self, t):
                params = deepcopy(original_params)

                a_rs, inc = duration_to_otherparams(params.per,
                                                    self.duration, self.b,
                                                    np.sqrt(self.depth),
                                                    params.ecc, params.w)

                params.rp = self.depth**0.5
                params.t0 = self.t0 + mid_transit_answer
                params.inc = inc
                params.a = a_rs

                return self.amp * transit_model(t + mid_transit_answer, params)
Esempio n. 2
0
 def get_value(self, t):
     params = deepcopy(original_params)
     params.rp = self.depth**0.5
     params.t0 = self.t0
     return self.amp * transit_model(t, params)
Esempio n. 3
0
 def get_value(self, t):
     params = deepcopy(trappist1('b'))
     params.rp = self.depth**0.5
     return self.amp * transit_model(t, params)
Esempio n. 4
0
        skip = 1
        mu, var = gp.predict(obs_flux, obs_time, return_var=True)
        std = np.sqrt(var)

        # samples = np.vstack([obs_planet.samples_amp, obs_planet.samples_depth,
        #                      obs_planet.samples_t0, obs_planet.samples_log_omega0, obs_planet.samples_log_S0])
        #
        # from corner import corner
        # corner(samples.T, labels=['amp', 'depth', 't0', 'log_omega0', 'log_S0'])
        # plt.show()

        transit_params = params(planet)
        transit_params.rp = np.sqrt(np.median(obs_planet.samples_depth))
        transit_params.t0 = np.median(obs_planet.samples_t0)
        amp = np.median(obs_planet.samples_amp)
        best_transit_model = amp * transit_model(obs_time, transit_params)

        transitless_gp_mean = mu - best_transit_model
        transitless_obs_flux = obs_flux - best_transit_model

        # fig, ax = plt.subplots(2, 1, figsize=(5, 8))
        # ax[0].errorbar(obs_time, obs_flux, obs_err, fmt='.', color='k', ecolor='silver', ms=2, alpha=0.5)
        # ax[0].plot(obs_time, mu, 'r', zorder=10)
        # ax[0].fill_between(obs_time, mu-std, mu+std, color='r', alpha=0.5, zorder=10)
        # ax[0].set_title(Time((obs_time + original_params.t0).min(), format='jd').datetime.date())
        # ax[0].set_ylabel('NIRSpec Counts')
        # ax[0].set_xlabel('Time [d]')

        # model_residual = amp * (obs_planet.fluxes[mask] + obs_planet.spitzer_var[mask] - 2)
        # model_residual -= np.median(model_residual)
        # ax[1].plot(obs_time, model_residual, 'r', lw=2, zorder=10, label='microvar + spots')
Esempio n. 5
0
        del obs.archive[planet]
    group = obs.archive.create_group(planet)

    u1, u2 = params.u
    #duration = transit_duration(transit_params(planet))

    spectrum_photo = IRTFTemplate(sptype_phot)
    spectrum_spots = IRTFTemplate(sptype_spot)

    print('midtransit', midtransit)
    times = np.arange(midtransit - (8 * np.random.rand() + 2) * duration,
                      midtransit + (8 * np.random.rand() + 2) * duration,
                      exptime.to(u.day).value)
    # times = np.arange(midtransit - 1*duration, midtransit, exptime.to(u.day).value)

    transit = transit_model(times, params)  #all_transits(times)

    subgroup = group.create_group("{0}".format(
        Time(midtransit, format='jd').isot))
    star = Star.with_k296_spot_distribution()
    star.rotation_period = rotation_period * u.day
    area = star.spotted_area(times)
    fluxes = star.fractional_flux(times)

    spitzer_var = spitzer_variability(times)[:, np.newaxis]

    spectrum_photo_flux = spectrum_photo.interp_flux(wl)
    spectrum_spots_flux = spectrum_spots.interp_flux(wl)

    combined_spectra = (
        (transit[:, np.newaxis] - area[:, np.newaxis]) * spectrum_photo_flux +