output_dir = os.path.abspath('/Users/bmmorris/data') elif os.path.exists('/usr/lusers/bmmorris/data/hat11/'): # on Hyak light_curve_paths = glob('/usr/lusers/bmmorris/data/hat11/*slc.fits') output_dir = os.path.abspath('/gscratch/stf/bmmorris/friedrich/hat11_flip_lambda') elif os.path.exists('/local/tmp/hat11'): # on mist light_curve_paths = glob('/local/tmp/hat11/*slc.fits') output_dir = os.path.abspath('./') else: raise ValueError('No input files found.') hat11_params = hat11_params_morris_flip_lambda() # Construct light curve object from the raw data whole_lc = LightCurve.from_raw_fits(light_curve_paths, name='HAT11') transits = LightCurve(**whole_lc.mask_out_of_transit(hat11_params, oot_duration_fraction=0.5) ).get_transit_light_curves(hat11_params) # Compute maxes for each quarter available_quarters = whole_lc.get_available_quarters() quarters = [whole_lc.get_quarter(q) for q in whole_lc.get_available_quarters()] quarterly_maxes = {} set_upper_limit = 4e10 for i, quarter_number, lc in zip(range(len(available_quarters)), available_quarters, quarters): fluxes = lc.fluxes[lc.fluxes < set_upper_limit] smoothed_fluxes = gaussian_filter(fluxes, sigma=20) quarterly_maxes[quarter_number] = np.max(smoothed_fluxes)
from friedrich.lightcurve import (LightCurve, generate_lc_depth, kepler17_params_db) from friedrich.fitting import peak_finder, summed_gaussians, gaussian import matplotlib.pyplot as plt import numpy as np from astropy.utils.console import ProgressBar # Settings: plots = True light_curve_paths = glob('/Users/bmmorris/data/kepler17/*slc.fits') depth = 0.13031**2 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