OttoStruve / muler

A Python package for working with pipeline-produced spectra from IGRINS, HPF, and Keck NIRSPEC
https://muler.readthedocs.io
MIT License
15 stars 9 forks source link

Add automatic telluric masking for HPF, a static TelFit template, and continuum flattening with GP tutorial #64

Closed gully closed 3 years ago

gully commented 3 years ago

We are going to package a TelFit template for quicklook purposes, such as masking.

gully commented 3 years ago

Here is how we made the template:

import pandas as pd
from gollum.telluric import TelFitSpectrum
from muler.hpf import HPFSpectrumList, HPFSpectrum

path = '~/libraries/raw/telfit/grid_v1p0/'

telfit_spec = TelFitSpectrum(path=path+'telfit_800_1300nm_temp286_hum050.txt').air_to_vacuum()

filename = 'muler_example_data/HPF/01_A0V_standards/Goldilocks_20210801T083618_v1.0_0036.spectra.fits'

full_spectrum = HPFSpectrumList.read(filename).normalize().stitch()

telfit_spec = telfit_spec.instrumental_broaden(resolving_power=55_000).resample(full_spectrum)

df = pd.DataFrame({'wavelength_A':telfit_spec.wavelength.value,
                  'transmission':telfit_spec.flux.value})

df.to_csv('telfit_HPFtemplate_temp286_hum050.csv', index=False)
gully commented 3 years ago

The target and TelFit templates are not exactly wavelength aligned. I'm not sure why, but can think of several plausible explanations. Regardless, we should build in some resilience to such imperfections by using a binary erosion parameter, such as the one implemented in scipy.