Skip to content

Commit

Permalink
Remove lookup of coords, this is now handled in ullyses_hlsp.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jotaylor committed Dec 8, 2023
1 parent 25ae308 commit bbe176e
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions src/ullyses/create_ullyses_hlsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,7 @@ def make_imaging_hlsps(drcfile, outdir, targ, hdr_targ=None, hlspname=None):
def make_lcogt_tss(indir, outdir, targ, hlspname=None, photfile=None):
if photfile is None:
photfile = os.path.join(PHOT_DIR, f"{targ.upper()}_phot.txt")
aliases = parse_aliases()
alias_mask = aliases.apply(lambda row: row.astype(str).str.fullmatch(re.escape(targ.upper())).any(), axis=1)
if set(alias_mask) != {False}:
hlsp_targname = aliases[alias_mask]["target_name_hlsp"].values[0]
targetinfo_file = os.path.join(UTILS_DIR, "data", "target_metadata", "pd_targetinfo.json")
master_list = pd.read_json(targetinfo_file, orient="split")
master_list = master_list.apply(lambda x: x.astype(str).str.upper())
try:
coords = master_list.loc[master_list["mast_targname"] == hlsp_targname][["ra", "dec"]].values
ra, dec = coords[0]
except:
print(f"{RED}NO COORDINATES FOUND FOR {hlsp_targname}{RESET}")
ra, dec = (0, 0)
else:
hlsp_targname = targ
ra, dec = (0, 0)
print(f"{RED}NO ALIAS AND COORDINATES FOUND FOR {hlsp_targname}{RESET}")
hlsp_targname = match_aliases.match_aliases(targ)

df = pd.read_csv(photfile,
names=["filename", "mjdstart", "mjdend", "wl", "flux", "err"],
Expand All @@ -82,23 +66,7 @@ def make_lcogt_tss(indir, outdir, targ, hlspname=None, photfile=None):
U.write_file()

def make_xsu_hlsps(infile, outdir, targ, hlspname=None):
aliases = parse_aliases()
alias_mask = aliases.apply(lambda row: row.astype(str).str.fullmatch(re.escape(targ.upper())).any(), axis=1)
if set(alias_mask) != {False}:
hlsp_targname = aliases[alias_mask]["target_name_hlsp"].values[0]
targetinfo_file = os.path.join(UTILS_DIR, "data", "target_metadata", "pd_targetinfo.json")
master_list = pd.read_json(targetinfo_file, orient="split")
master_list = master_list.apply(lambda x: x.astype(str).str.upper())
try:
coords = master_list.loc[master_list["mast_targname"] == hlsp_targname][["ra", "dec"]].values
ra, dec = coords[0]
except:
print(f"{RED}NO COORDINATES FOUND FOR {hlsp_targname}{RESET}")
ra, dec = (0, 0)
else:
hlsp_targname = targ
ra, dec = (0, 0)
print(f"{RED}NO ALIAS AND COORDINATES FOUND FOR {hlsp_targname}{RESET}")
hlsp_targname = match_aliases.match_aliases(targ)

if hlspname is None:
hlspname = f"hlsp_ullyses_vlt_xshooter_{hlsp_targname.lower()}_uvb-vis_{__release__}_vltspec.fits"
Expand Down

0 comments on commit bbe176e

Please sign in to comment.