def test_evaluate_psd(self): tm = QuadraticModel(interpolate=False) tm.set_data(self.time) flux = tm.evaluate(0.1, [0.2, 0.3], 0.0, 1.0, 3.0, 0.5*pi) assert flux.ndim == 1 assert flux.size == self.time.size
def test_evaluate_2d(self): tm = QuadraticModel(interpolate=False) tm.set_data(self.time, self.lcids, self.pbids) flux = tm.evaluate(self.radius_ratios[0, 0], self.ldc[0], self.zero_epochs[0], self.periods[0], self.smas[0], self.inclinations[0]) assert flux.ndim == 1 assert flux.size == self.time.size
a_Rs = a_au / (R_s * 0.00465047) # TODO start with rp_rs that causes twice depth than curve RMS curve_rms = np.std(flux) min_depth = 2 * curve_rms initial_rp = (min_depth * (R_s**2))**(1 / 2) rp_rs = initial_rp / R_s from pytransit import QuadraticModel tm = QuadraticModel() time_model = np.arange(0, 1, 0.0001) tm.set_data(time_model) # k is the radius ratio, ldc is the limb darkening coefficient vector, t0 the zero epoch, p the orbital period, a the # semi-major axis divided by the stellar radius, i the inclination in radians, e the eccentricity, and w the argument # of periastron. Eccentricity and argument of periastron are optional, and omitting them defaults to a circular orbit. model = tm.evaluate(k=rp_rs, ldc=ld_coefficients, t0=0.5, p=1.0, a=a_Rs, i=0.5 * np.pi) model = model[model < 1] baseline_model = np.full(len(model), 1) model = np.append(baseline_model, model) model = np.append(model, baseline_model) def downsample(array, npts: int): interpolated = interp1d(np.arange(len(array)), array, axis=0, fill_value='extrapolate') downsampled = interpolated(np.linspace(0, len(array), npts)) return downsampled