Skip to content

Commit

Permalink
Update muler to read variance from .spec_a0v.fits files for outputs f…
Browse files Browse the repository at this point in the history
…rom the new IGRINS PLP. It is still compatible with the old version as well.
  • Loading branch information
Kyle Kaplan committed Feb 26, 2024
1 parent e83847e commit b189208
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/muler/igrins.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ def __init__(
)
lamb = hdus["WAVELENGTH"].data[order].astype(np.float64) * u.micron
flux = hdus["SPEC_DIVIDE_A0V"].data[order].astype(np.float64) * u.ct
try:
uncertainity_hdus = [hdus["SPEC_DIVIDE_A0V_VARIANCE"]]
sn_used = false
except:
print("Warning: Using older PLP versions of .spec_a0v.fits files which have no variance saved. Will grab .variance.fits file.")
elif ".spec_a0v.fits" in file:
lamb = hdus["WAVELENGTH"].data[order].astype(float) * u.micron
flux = hdus["SPEC_DIVIDE_A0V"].data[order].astype(float) * u.ct
Expand Down Expand Up @@ -350,7 +355,7 @@ def __init__(
if not sn_used: #If .variance.fits used
variance = uncertainity_hdus[0].data[order].astype(np.float64)
stddev = np.sqrt(variance)
if ("rtell" in file) or ("spec_a0v" in file): #If using a rtell or spec_a0v file with a variance file, scale the stddev to preserve signal-to-noise
if ("rtell" in file): #If using a rtell or spec_a0v file with a variance file, scale the stddev to preserve signal-to-noise
unprocessed_flux = hdus["TGT_SPEC"].data[order].astype(np.float64)
stddev *= (flux.value / unprocessed_flux)
else: #Else if .sn.fits (or SNR HDU in rtell file) used
Expand Down

0 comments on commit b189208

Please sign in to comment.