# Read from command line argument transit_number = int(sys.argv[1]) print('Transit number: {0}'.format(transit_number)) lc = transits[transit_number] lc.delete_outliers() lc.subtract_polynomial_baseline(order=2, params=transit_params) lc.fluxes += quarterly_maxes[lc.quarters[0]] lc.fluxes /= quarterly_maxes[lc.quarters[0]] lc.errors /= quarterly_maxes[lc.quarters[0]] lc_output_path = os.path.join(output_dir, 'lc{0:03d}.txt'.format(transit_number)) np.savetxt(lc_output_path, np.vstack([lc.times.jd, lc.fluxes, lc.errors]).T) # Subtract out a transit model transit_model = generate_lc_depth(lc.times_jd, depth, transit_params) residuals = lc.fluxes - transit_model # Find peaks in the light curve residuals best_fit_spot_params = peak_finder(lc.times.jd, residuals, lc.errors, transit_params, n_peaks=6, plots=False, verbose=True) # This first spot model might miss the broadest spots best_fit_gaussian_model = summed_gaussians(lc.times.jd, best_fit_spot_params) # # Run again on the residuals to pick up big spots # best_fit_spot_params = peak_finder(lc.times.jd, residuals - best_fit_gaussian_model, lc.errors, # transit_params, n_peaks=4, plots=True, # verbose=True, broaden_gaussian_factor=2)
# Read from command line argument transit_number = int(sys.argv[1]) lc = transits[transit_number] lc.subtract_add_divide_without_outliers(params=hat11_params, quarterly_max=quarterly_maxes[lc.quarters[0]], plots=False) lc_output_path = os.path.join(output_dir, 'lc{0:03d}.txt'.format(transit_number)) np.savetxt(lc_output_path, np.vstack([lc.times.jd, lc.fluxes, lc.errors]).T) # Delete sharp outliers prior to peak-finding lc.delete_outliers() transit_model = generate_lc_depth(lc.times_jd, hat11_params.rp**2, hat11_params) residuals = lc.fluxes - transit_model # Find peaks in the light curve residuals best_fit_spot_params = peak_finder(lc.times.jd, residuals, lc.errors, hat11_params, n_peaks=4, plots=False, verbose=True) best_fit_gaussian_model = summed_gaussians(lc.times.jd, best_fit_spot_params) # If spots are detected: if best_fit_spot_params is not None: output_path = os.path.join(output_dir, 'chains{0:03d}.hdf5'.format(transit_number)) sampler = run_emcee_seeded(lc, hat11_params, best_fit_spot_params, n_steps=15000, n_walkers=150,
kepler17_params = kepler17_params_db() # Construct light curve object from the raw data whole_lc = LightCurve.from_raw_fits(light_curve_paths, name='Kepler17') transits = LightCurve(**whole_lc.mask_out_of_transit(kepler17_params) ).get_transit_light_curves(kepler17_params) delta_chi2 = {} with ProgressBar(len(transits)) as bar: for i, lc in enumerate(transits): # Remove linear out-of-transit trend from transit lc.remove_linear_baseline(kepler17_params) # Subtract out a transit model transit_model = generate_lc_depth(lc.times_jd, depth, kepler17_params) residuals = lc.fluxes - transit_model # Find peaks in the light curve residuals best_fit_params = peak_finder(lc.times.jd, residuals, lc.errors, kepler17_params) best_fit_gaussian_model = summed_gaussians(lc.times.jd, best_fit_params) # Measure delta chi^2 chi2_transit = np.sum((lc.fluxes - transit_model)**2 / lc.errors**2)/len(lc.fluxes) if best_fit_params is not None: split_input_parameters = np.split(np.array(best_fit_params), len(best_fit_params)/3) delta_chi2[i] = []