from Time_and_flux import gettimeflux_1800, gettimeflux_120 ids = ['415438368', '450061615'] cadence = '0120' sector = '5' for this_id in ids: if (cadence == '1800'): obsTable = Observations.query_criteria(target_name=this_id, obs_collection="HLSP", filters="TESS", t_exptime=[1799, 1801]) if sector == '': sector = obsTable['sequence_number'] else: continue tess_bjds = gettimeflux_1800(this_id, str(sector[0]))[0] sap_fluxes = gettimeflux_1800(this_id, str(sector[0]))[1] med_flux_1 = signal.medfilt(sap_fluxes, kernel_size=65) else: tess_bjds = gettimeflux_120(this_id, sector)[0] sap_fluxes = gettimeflux_120(this_id, sector)[1] med_flux_1 = signal.medfilt(sap_fluxes, kernel_size=101) fig, ax = plt.subplots() ax.plot(tess_bjds, sap_fluxes, 'bo') #RAW blue fig.suptitle("TIC " + this_id + " Flare") ax.set_ylabel("Flux (e-/s)") ax.set_xlabel("Time (TBJD)")
closest = "Closest TIC ID to %s: TIC %s, seperation of %f arcsec. and a TESS mag. of %f" % (target_name, catalogTIC['ID'][where_closest], catalogTIC['dstArcSec'][where_closest], catalogTIC['Tmag'][where_closest]) #sectors_search = Observations.query_criteria(target_name=this_id, provenance_project='TASOC') sectors_search = Observations.query_criteria(target_name=this_id, obs_collection="HLSP", filters="TESS", t_exptime=[1799, 1801]) #print('Getting sectors') #import pdb; pdb.set_trace() sector_length = len(sectors_search) if sector_length !=0: sector = sectors_search['sequence_number'] sector_length = sector_length-1 print('Getting times') #import pdb; pdb.set_trace() time = gettimeflux_1800(this_id, str(sector[0]))[0] print(time) flux = gettimeflux_1800(this_id, str(sector[0]))[1] Tmag = get_catalog_data(this_id)[0] Teff = get_catalog_data(this_id)[1] logg = get_catalog_data(this_id)[2] CCD = get_header_data(this_id, str(sector[0]))[0] Camera = get_header_data(this_id, str(sector[0]))[1] if period == 0: period = flatwrm.FindPeriod(time, flux, maxper=10,debug=debug) window_var = 1.5 if degree == 0: degree = flatwrm.SelectDegree(time, flux, period * window_var, debug=debug) istart, istop = flatwrm.FindFlares(time, flux, period,
import numpy as np import pandas as pd import seaborn as sns import matplotlib import matplotlib.pyplot as plt import matplotlib.animation as animation from Time_and_flux import gettimeflux_1800 time = gettimeflux_1800('167602025', '1')[0] flux = gettimeflux_1800('167602025', '1')[1] title = 'SAP_FLUX' x = np.array(time).byteswap().newbyteorder() y = np.array(flux).byteswap().newbyteorder() total = len(x) flare = pd.DataFrame(y, x) Writer = animation.writers['imagemagick'] Writer = Writer(fps=60, metadata=dict(artist='Me'), bitrate=1800) for i in range(50): fig, ax = plt.subplots(figsize=(10, 6)) plt.xlim(1618.0, 1619.0) plt.ylim(np.min(flare)[0], np.max(flare)[0]) plt.xlabel('TBJD', fontsize=20) plt.ylabel('FLUX', fontsize=20) plt.title('TIC 167602025 flare', fontsize=20) def animate(i):