Skip to content

Commit

Permalink
Merge pull request #13 from ZacharyLane1204/snlook
Browse files Browse the repository at this point in the history
Updated sn_lookup and spacetime_lookup to not incorporate future sectors
  • Loading branch information
CheerfulUser committed May 3, 2024
2 parents 2d54ec4 + c954591 commit 890dc7f
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tessreduce/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def grad_flux_rad(flux):
return rad


def sn_lookup(name,time='disc',buffer=0,print_table=True):
def sn_lookup(name,time='disc',buffer=0,print_table=True, df = False):
"""
Check for overlapping TESS ovservations for a transient. Uses the Open SNe Catalog for
discovery/max times and coordinates.
Expand Down Expand Up @@ -462,7 +462,10 @@ def sn_lookup(name,time='disc',buffer=0,print_table=True):
sec_times = pd.read_csv(package_directory + 'sector_mjd.csv')
if len(outSecs) > 0:
ind = outSecs - 1
secs = sec_times.iloc[ind]

new_ind = [i for i in ind if i < len(sec_times)]

secs = sec_times.iloc[new_ind]
if (time.lower() == 'disc') | (time.lower() == 'discovery'):
disc_start = secs['mjd_start'].values - disc_t.mjd
disc_end = secs['mjd_end'].values - disc_t.mjd
Expand Down Expand Up @@ -493,12 +496,15 @@ def sn_lookup(name,time='disc',buffer=0,print_table=True):

if print_table:
print(tabulate(tab, headers=['Sector', 'Covers','Time difference \n(days)'], tablefmt='orgtbl'))
return tr_list
if df:
return pd.DataFrame(tr_list, columns = ['RA', 'DEC','Sector','Covers'])
else:
return tr_list
else:
print('No TESS coverage')
return None

def spacetime_lookup(ra,dec,time=None,buffer=0,print_table=True):
def spacetime_lookup(ra,dec,time=None,buffer=0,print_table=True, df = False, print_all=False):
"""
Check for overlapping TESS ovservations for a transient. Uses the Open SNe Catalog for
discovery/max times and coordinates.
Expand Down Expand Up @@ -542,7 +548,10 @@ def spacetime_lookup(ra,dec,time=None,buffer=0,print_table=True):
sec_times = pd.read_csv(package_directory + 'sector_mjd.csv')
if len(outSecs) > 0:
ind = outSecs - 1
secs = sec_times.iloc[ind]

new_ind = [i for i in ind if i < len(sec_times)]

secs = sec_times.iloc[new_ind]
disc_start = secs['mjd_start'].values - time
disc_end = secs['mjd_end'].values - time

Expand All @@ -568,7 +577,10 @@ def spacetime_lookup(ra,dec,time=None,buffer=0,print_table=True):
tr_list += [[ra, dec, secs.Sector.values[i],outCam[i], outCcd[i], cover]]
if print_table:
print(tabulate(tab, headers=['Sector', 'Camera', 'CCD', 'Covers','Time difference \n(days)'], tablefmt='orgtbl'))
return tr_list
if df:
return pd.DataFrame(tr_list, columns = ['RA', 'DEC','Sector','Camera','CCD','Covers'])
else:
return tr_list
else:
print('No TESS coverage')
return None
Expand Down

0 comments on commit 890dc7f

Please sign in to comment.