Skip to content

Commit

Permalink
Added in external tess tpf saving functions needed for tessellate
Browse files Browse the repository at this point in the history
  • Loading branch information
CheerfulUser committed Apr 26, 2024
1 parent 159e2c6 commit ffbe123
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tessreduce/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,4 +592,32 @@ def par_psf_flux(image,prf,shift=[0,0]):
if np.isnan(shift)[0]:
shift = np.array([0,0])
prf.psf_flux(image,ext_shift=shift)
return prf.flux
return prf.flux


def external_save_TESS(ra,dec,sector,size=90,quality_bitmask='default',cache_dir=None):

c = SkyCoord(ra=float(ra)*u.degree, dec=float(dec) * u.degree, frame='icrs')
tess = lk.search_tesscut(c,sector=sector)
tpf = tess.download(quality_bitmask=quality_bitmask,cutout_size=size,download_dir=cache_dir)

if tpf is None:
m = 'Failure in TESScut api, not sure why.'
raise ValueError(m)

else:
os.system(f'mv {tpf.path} {os.getcwd()}')

def external_get_TESS():

found = False
target = None
l = os.listdir()
for thing in l:
if 'astrocut.fits' in thing:
if not found:
target = thing
else:
print('Too Many tpfs here!')
tpf = lk.TessTargetPixelFile(target)
return tpf

0 comments on commit ffbe123

Please sign in to comment.