Getting Started

[1]:
from muler.igrins import IGRINSSpectrum
from specutils import Spectrum1D
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format='retina'
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from muler.igrins import IGRINSSpectrum
      2 from specutils import Spectrum1D
      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.

[2]:
path = 'https://github.com/OttoStruve/muler_example_data/raw/main/IGRINS/01_IGRINS_test_data/'
filename = 'SDCH_20201202_0059.spec_a0v.fits'
spec = IGRINSSpectrum(file=path+filename)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 3
      1 path = 'https://github.com/OttoStruve/muler_example_data/raw/main/IGRINS/01_IGRINS_test_data/'
      2 filename = 'SDCH_20201202_0059.spec_a0v.fits'
----> 3 spec = IGRINSSpectrum(file=path+filename)

NameError: name 'IGRINSSpectrum' is not defined

The object is an instance of a specutils Spectrum1D class.

[3]:
type(spec), isinstance(spec, Spectrum1D), isinstance(spec.flux, np.ndarray)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 type(spec), isinstance(spec, Spectrum1D), isinstance(spec.flux, np.ndarray)

NameError: name 'spec' is not defined

You can normalize the spectrum easily:

[4]:
%%capture
spec = spec.normalize()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 spec = spec.normalize()

NameError: name 'spec' is not defined

Finally, we can plot the spectrum:

[5]:
plt.figure(figsize=(10, 4))
plt.plot(spec.wavelength, spec.flux)
plt.ylim(0.6, 1.2)
plt.xlabel('$\lambda \;(\AA)$'); plt.ylabel('Flux');
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 plt.figure(figsize=(10, 4))
      2 plt.plot(spec.wavelength, spec.flux)
      3 plt.ylim(0.6, 1.2)

NameError: name 'plt' is not defined

We see the spectrum with genuine astrophysical signals, instrumental artifacts, and noise.