Line continuum#

By default, \(\mathrm{LiMe}\) computes a line continuum using the central band edges (w3 and w4 in the image below).

../_images/bands_definition.png

In cases where you need to analyze a large amount of data, this IRAF-like approach provides good results with minimal user input. However, depending on the line properties, it may not always be the most suitable solution.

In this tutorial, we will explore the three options currently available in \(\mathrm{LiMe}\): central, adjacent, and fit.

Please note: In \(\mathrm{LiMe\_v1}\), the line continuum could only be fitted using the adjacent continuum bands.
To reproduce those results in the current version, use count_source='adjacent' in your .fit() functions.

Central band continuum#

Let’s start by loading a spectrum:

import numpy as np
from astropy.io import fits
from pathlib import Path
import lime

# State the input files
obsFitsFile = '../0_resources/spectra/gp121903_osiris.fits'
lineBandsFile = '../0_resources/bands/gp121903_bands.txt'
cfgFile = '../0_resources/long_slit.toml'

# Spectrum parameters
z_obj = 0.19531
norm_flux = 1e-18

# Create the observation object
gp_spec = lime.Spectrum.from_file(obsFitsFile, instrument='osiris', redshift=z_obj, norm_flux=norm_flux)
gp_spec.plot.spectrum(log_scale=True)
../_images/f34126e138e3175fd96cb9910dae9f20d1b8dd2fee9fa3c21ecefd0ba84fa9cd.png

As mentioned previously, the default option is to fit the continuum using the limits of the central bands:

gp_spec.fit.bands('O3_4363A')
gp_spec.plot.bands()
../_images/6f06a285d3c45e954ebe1fd3b07432363231d2cb7ea30fa2f4025dc002a1590f.png

However, if you do not provide a set of line bands tailored to your object’s resolution, the central bands may not fully cover the emission line:

gp_spec.fit.bands('O2_3726A')
gp_spec.plot.bands()
../_images/3f31d3a39e5b2af2728bb5bfe14fa56a244c55c2b7520bc5b1660cb7d523192a.png

It is strongly recommended, regardless of the line continuum method you use, to adjust and prepare your line bands according to your observations, as shown in the previous tutorials.

gp_spec.fit.bands('O2_3726A_m', lineBandsFile, cfgFile)
gp_spec.plot.bands(y_scale='log')
../_images/b85c085d70cd6d0fad9f7c6443c4793224a32e9d9c8594534946e7475a1b8b58.png

Adjacent bands continua#

The second option is to use the adjacent continuum bands to determine the continuum level. This is done by setting cont_source='adjacent':

gp_spec.fit.bands('O2_3726A_m', lineBandsFile, cfgFile, cont_source='adjacent')
gp_spec.plot.bands(y_scale='log')
../_images/785b1c091a050d31db5c7b21f77b70f94ee2b79572e2d62c4738bd0371f616f2.png

In this case, it provided a better fit. However, you must ensure that, for every line, the adjacent bands cover a representative baseline for their continuum.

Fitted continuum#

In a previous tutorial, we fitted a polynomial to the observation. We can use this as the baseline for the line continua:

gp_spec.fit.continuum(degree_list=[3, 6, 6], emis_threshold=[3, 2, 1.5])
gp_spec.plot.spectrum(log_scale=True, show_cont=True)
../_images/a44f72ac39265b67bcdcd309624602b02564986fc546140bb3cff201130bea7c.png

by setting cont_source='fit':

gp_spec.fit.bands('O2_3726A_m', lineBandsFile, cfgFile, cont_source='fit')
gp_spec.plot.bands(y_scale='log', show_cont=True)
../_images/a7e266132e4ec9160ec3b23fcae730a3a230de4c963f0a67e1cb583c320bf2bd.png

In this case, you can see that the small black cross, which represents the line cont value in the measurements table at peak_wave, matches the object continuum — displayed here using show_cont=True.

Please note: Although \(\mathrm{LiMe}\) uses the fitted continuum for the entire (w3, w4) region, it only saves the continuum level at the line’s peak wavelength.
Subsequent plots compute a linear continuum between w3 and w4 to define the baseline.
As a result, the plotted profiles might not perfectly represent the measured ones.

As a qualitative check, you can verify that the black cross lies within the w3–w4 continuum (the thin dashed orange line).