def test_testpoint(self): output = LATTEutils.tess_point(outdir, '55525572') self.assertAlmostEqual(output[1], 72.69404300000001, places=5, msg="TESS point RA is not correct") self.assertAlmostEqual(output[2], -60.905449, places=4, msg="TESS point Dec is not correct")
def process(indir, tic, sectors_in, transit_list, args): sectors_all, ra, dec = LATTEutils.tess_point(indir, tic) try: # Sucessfully entered sectors # check that the target was actually observed in the stated sector sectors = list(set(sectors_in) & set(sectors_all)) if len(sectors) == 0: print ("The target was not observed in the sector(s) you stated ({}). \ Therefore take all sectors that it was observed in: {}".format(sectors, sectors_all)) sectors = sectors_all except: sectors = sectors_all # download the data alltime, allflux, allflux_err, all_md, alltimebinned, allfluxbinned, allx1, allx2, ally1, ally2, alltime12, allfbkg, start_sec, end_sec, in_sec, tessmag, teff, srad = LATTEutils.download_data(indir, sectors, tic) # in my input file the the times start at 0 for each sector so I need the line below #transit_list = list(np.array(transit_list) + np.nanmin(alltime)) # ------------ simple = False BLS = False model = False save = True DV = True # generate the plots try: LATTEbrew.brew_LATTE(tic, indir, syspath, transit_list, simple, BLS, model, save, DV, sectors, sectors_all, alltime, allflux, allflux_err, all_md, alltimebinned, allfluxbinned, allx1, allx2, ally1, ally2, alltime12, allfbkg, start_sec, end_sec, in_sec, tessmag, teff, srad, ra, dec, args) tp_downloaded = True except: # see if it made any plots - often it just fails on the TPs as they are very large if exists("{}/{}/{}_fullLC_md.png".format(indir,tic,tic)): print ("couldn't download TP but continue anyway") tp_downloaded = False else: mnd = {} mnd['TICID'] = -99 return mnd # check again whether the TPs downloaded - depending on where the code failed it might still have worked. if exists("{}/{}/{}_aperture_size.png".format(indir,tic,tic)): tp_downloaded = True else: tp_downloaded = False print ("code ran but no TP -- continue anyway") # ------------- # check whether it's a TCE or a TOI # TCE ----- lc_dv = np.genfromtxt('{}/data/tesscurl_sector_all_dv.sh'.format(indir), dtype = str) TCE_links = [] for i in lc_dv: if str(tic) in str(i[6]): TCE_links.append(i[6]) if len(TCE_links) == 0: TCE = " - " TCE = False else: TCE_links = np.sort(TCE_links) TCE_link = TCE_links[0] # this link should allow you to acess the MAST DV report TCE = True # TOI ----- TOI_planets = pd.read_csv('{}/data/TOI_list.txt'.format(indir), comment = "#") TOIpl = TOI_planets.loc[TOI_planets['TIC'] == float(tic)] if len(TOIpl) == 0: TOI = False else: TOI = True TOI_name = (float(TOIpl["Full TOI ID"])) # ------------- # return the tic so that it can be stored in the manifest to keep track of which files have already been produced # and to be able to skip the ones that have already been processed if the code has to be restarted. mnd = {} mnd['TICID'] = tic mnd['MarkedTransits'] = transit_list mnd['Sectors'] = sectors_all mnd['RA'] = ra mnd['DEC'] = dec mnd['SolarRad'] = srad mnd['TMag'] = tessmag mnd['Teff'] = teff mnd['thissector'] = sectors # make empty fields for the test to be checked if TOI == True: mnd['TOI'] = TOI_name else: mnd['TOI'] = " " if TCE == True: mnd['TCE'] = "Yes" mnd['TCE_link'] = TCE_link else: mnd['TCE'] = " " mnd['TCE_link'] = " " mnd['EB'] = " " mnd['Systematics'] = " " mnd['TransitShape'] = " " mnd['BackgroundFlux'] = " " mnd['CentroidsPositions'] = " " mnd['MomentumDumps'] = " " mnd['ApertureSize'] = " " mnd['InoutFlux'] = " " mnd['Keep'] = " " mnd['Comment'] = " " mnd['starttime'] = np.nanmin(alltime) return mnd
sectors = str(args.sector) # Check whether we are looking at an FFI # The FFI information needs to be stored straight away so a folder needs to be created to store them. # The folder for the non-FFIs is created later after the user choses whether to 'save' data or not. if args.FFI == True: newpath = '{}/{}'.format(indir,tic) # if this folder doesn't exist then create it... if not exists(newpath): os.makedirs(newpath) # -------- # Run a function called TESS-point. This returns the sectors in which the target has # been observed as well as the RA and DEC of the target. sectors_all, ra, dec = utils.tess_point(indir, tic) # -------- # -------------------------------- # If either the TIC or the sectors or both have not already been identified, run Tkinter (interactive tools) else: # make a GUI interface with TKinter ROOT = tk.Tk() ROOT.withdraw() # if this hasn't already been identified as an FFI through the command line, give the option to chose this when entering the TIC ID if args.FFI == False: # ----------- class TICprompt(simpledialog.Dialog):