Deblazing HPF spectra

THe blaze function is a conspicuous feature of echelle spectrographs, a large upside down U shape enveloping the raw 1D echelle orders. The process of removing this instrumental artifact is deblazing, and we have mentioned it in previous tutorials. Here we show a new technique to deblazing based on calibration templates that are now built into muler automatically. This deblazing process is imperfect, but adequate for many purposes.

[1]:
%config InlineBackend.figure_format='retina'
from muler.hpf import HPFSpectrumList
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 2
      1 get_ipython().run_line_magic('config', "InlineBackend.figure_format='retina'")
----> 2 from muler.hpf import HPFSpectrumList

File ~/checkouts/readthedocs.org/user_builds/muler/envs/latest/lib/python3.8/site-packages/muler/hpf.py:14
     12 import warnings
     13 import logging
---> 14 from muler.echelle import EchelleSpectrum, EchelleSpectrumList
     15 from muler.utilities import resample_list
     16 import numpy as np

File ~/checkouts/readthedocs.org/user_builds/muler/envs/latest/lib/python3.8/site-packages/muler/echelle.py:31
     29 from scipy.ndimage import median_filter, gaussian_filter1d
     30 import specutils
---> 31 from muler.utilities import apply_numpy_mask, is_list, resample_list
     34 # from barycorrpy import get_BC_vel
     35 from astropy.coordinates import SkyCoord, EarthLocation

File ~/checkouts/readthedocs.org/user_builds/muler/envs/latest/lib/python3.8/site-packages/muler/utilities.py:15
     13 from astropy.convolution import convolve, Gaussian1DKernel
     14 from scipy.ndimage import binary_dilation
---> 15 from astroquery.simbad import Simbad
     16 Simbad.add_votable_fields('V', 'B', 'J', 'H', 'K', 'parallax')
     17 LinInterpResampler = LinearInterpolatedResampler()

ModuleNotFoundError: No module named 'astroquery'
[2]:
path = 'https://github.com/OttoStruve/muler_example_data/raw/main/HPF/01_A0V_standards/'
filename = 'Goldilocks_20210212T072837_v1.0_0037.spectra.fits'
spectra = HPFSpectrumList.read(path+filename)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 3
      1 path = 'https://github.com/OttoStruve/muler_example_data/raw/main/HPF/01_A0V_standards/'
      2 filename = 'Goldilocks_20210212T072837_v1.0_0037.spectra.fits'
----> 3 spectra = HPFSpectrumList.read(path+filename)

NameError: name 'HPFSpectrumList' is not defined
[3]:
spectra.normalize().plot(ylo=0, yhi=4);
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 spectra.normalize().plot(ylo=0, yhi=4);

NameError: name 'spectra' is not defined

We see the conspicuous blaze pattern in each spectra order. Let’s apply a correction to one of those orders:

[4]:
spectrum = spectra[15]
new_spectrum = spectrum.deblaze()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 spectrum = spectra[15]
      2 new_spectrum = spectrum.deblaze()

NameError: name 'spectra' is not defined
[5]:
ax = spectrum.normalize().plot(ylo=0, yhi=1.5, label='observed')
new_spectrum.normalize().plot(ax=ax, label='deblazed');
ax.legend();
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 ax = spectrum.normalize().plot(ylo=0, yhi=1.5, label='observed')
      2 new_spectrum.normalize().plot(ax=ax, label='deblazed');
      3 ax.legend();

NameError: name 'spectrum' is not defined

Nice! We see that the plunging edges have come closer to the a nearly flat native spectral tilt of a stellar spectrum (with some telluric absorption features still present). Since the deblazing step is spectrally smooth, it does not add any noise. The entire spectrum of this A0V star will have both telluric lines and broad Hydrogen lines. The deblazing correction is known to be coarse, with the most conspicuous imperfections near 1150 - 1210 nm.

[6]:
ax = spectra.deblaze().normalize().plot(ylo=0, yhi=1.5);
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 ax = spectra.deblaze().normalize().plot(ylo=0, yhi=1.5);

NameError: name 'spectra' is not defined
This pattern will look familiar to most infrared astronomers: a Rayleigh-Jeans tail, atmospheric windows, and Hydrogen lines.
We can flatten by a black body:
[7]:
refined = spectra.deblaze().normalize().flatten_by_black_body(10_000).trim_edges((5, 2043))
ax = refined.plot(ylo=0, yhi=1.5);
ax.axhline(1.0, color='k', linestyle='dashed');
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 refined = spectra.deblaze().normalize().flatten_by_black_body(10_000).trim_edges((5, 2043))
      2 ax = refined.plot(ylo=0, yhi=1.5);
      3 ax.axhline(1.0, color='k', linestyle='dashed');

NameError: name 'spectra' is not defined

Looks good!