Working with all spectral orders

In muler you can load all spectral orders into an IGRINSSpectrumList.

[1]:
%config Completer.use_jedi = False
[2]:
from muler.igrins import IGRINSSpectrum, IGRINSSpectrumList
from specutils import Spectrum1D, SpectrumList
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format='retina'
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 1
----> 1 from muler.igrins import IGRINSSpectrum, IGRINSSpectrumList
      2 from specutils import Spectrum1D, SpectrumList
      3 import numpy as np

File ~/checkouts/readthedocs.org/user_builds/muler/envs/latest/lib/python3.8/site-packages/muler/igrins.py:15
     13 import json
     14 from matplotlib import pyplot as plt
---> 15 from muler.echelle import EchelleSpectrum, EchelleSpectrumList
     16 from muler.utilities import Slit, concatenate_orders, resample_list, roll_along_axis, edge_normalize, isolate_and_normalize_hi_order, round_to_multiple, photometry
     17 from astropy.time import Time

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'
Simply tell the IGRINS Spectrum where your file is located.
We will use the data stored in muler_example_data, but the path could be a local directory instead.
[3]:
path = 'https://github.com/OttoStruve/muler_example_data/raw/main/IGRINS/01_IGRINS_test_data/'
filename='SDCH_20201202_0059.spec_a0v.fits'
full_path = path + filename
[4]:
spec_list = IGRINSSpectrumList.read(full_path).normalize()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 spec_list = IGRINSSpectrumList.read(full_path).normalize()

NameError: name 'IGRINSSpectrumList' is not defined
[5]:
spec_list.remove_nans().trim_edges().normalize(order_index=10).plot(color=None, ylo=0, yhi=2);
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 spec_list.remove_nans().trim_edges().normalize(order_index=10).plot(color=None, ylo=0, yhi=2);

NameError: name 'spec_list' is not defined

You can save each spectral order as an HDF5 file:

[6]:
save_files = False

if save_files:
    spec_list.remove_nans().trim_edges().to_HDF5(path='./', file_basename='demo2')