GNU Astronomy Utilities

2.5.3 Continuum subtraction

In Viewing spectra and redshifted lines, we visually inspected some of the most prominent emission lines of the brightest galaxy of the demo MUSE cube (see Detecting lines and extracting spectra in 3D data). Here, we will remove the “continuum” flux from under the emission lines to see them more distinctly.

Within a spectra, the continuum is the local “background” flux in the third/wavelength dimension. In other words, it is the flux that would be present at that wavelength if the emission line didn’t exist. Therefore, to accurately measure the flux of the emission line, we first need to subtract the continuum. One crude way of estimating the continuum flux at every slice is to use the sigma-clipped median value of that same pixel in the \(\pm{N/2}\) slides around it (for more on sigma-clipping, see Sigma clipping).

In this case, \(N=100\) should be a good first approximate (since it is much larger than any of the absorption or emission lines). With the first command below, let’s use Arithmetic’s filtering operators for estimating the sigma-clipped median only along the third dimension for every pixel in every slice (see Filtering (smoothing) operators). With the second command, have a look at the filtered cube and spectra. Note that the first command is computationally expensive and may take a minute or so.

$ astarithmetic a370-crop.fits set-i --output=filtered.fits \
                3 0.2 1 1 100 i filter-sigclip-median

$ astscript-fits-view filtered.fits -h1 --ds9scale="limits -5 20"

Looking at the filtered cube above, and sliding through the different wavelengths, you will see the noise in each slice has been significantly reduced! This is expected because each pixel’s value is now calculated from 100 others (along the third dimension)! Using the same steps as Viewing spectra and redshifted lines, plot the spectra of the brightest galaxy. Then, have a look at its spectra. You see that the emission lines have been significantly smoothed out to become almost69 invisible.

You can now subtract this “continuum” cube from the input cube to create the emission-line cube. In fact, as you see below, we can do it in a single Arithmetic command (blending the filtering and subtraction in one command). Note how the only difference with the previous Arithmetic command is that we added an i before the 3 and a - after filter-sigclip-median. For more on Arithmetic’s powerful notation, see Reverse polish notation. With the second command below, let’s view the input and continuum-subtracted cubes together:

$ astarithmetic a370-crop.fits set-i --output=no-continuum.fits \
                i 3 0.2 1 1 100 i filter-sigclip-median -

$ astscript-fits-view a370-crop.fits no-continuum.fits -h1 \
                      --ds9scale="limits -5 20"

Once the cubes are open, slide through the different wavelengths. Comparing the left (input) and right (continuum-subtracted) slices, you will rarely see any galaxy in the continuum-subtracted one! As its name suggests, the continuum flux is continuously present in all the wavelengths (with gradual change)! But the continuum has been subtracted now; so in the right-side image, you don’t see anything on wavelengths that don’t contain a spectral emission line. Some dark regions also appear; these are absorption lines! Please spend a few minutes sliding through the wavelengths and seeing how the emission lines pop-up and disappear again. It is almost like scuba diving, with fish appearing out of nowhere and passing by you.

Let’s go to slice 3046 (corresponding to 8555.93 Angstroms; just before the H-alpha line for the brightest galaxy in Viewing spectra and redshifted lines). Now press the “Next” button to change slices one by one until there is no more emission in the brightest galaxy. As you go to redder slices, you will see that not only does the brightness increase, but the position of the emission also changes. This is the Doppler effect caused by the rotation of the galaxy: the side that rotating towards us gets blue-shifted to bluer slices and the one that is going away from us gets redshifted to redder slices. If you go to the emission lines of the other galaxies, you will see that they move with a different angle! We can use this to derive the galaxy’s rotational properties and kinematics (Gnuastro doesn’t have this feature yet).

To see the Doppler shift in the spectrum, plot the spectrum over the top-side of the galaxy (which is visible in slice 3047). Then Zoom-in to the H-alpha line (as we did in Viewing spectra and redshifted lines) and press “Next” until you reach the end of the H-alpha emission-line. You see that by the time H-alpha disappears in the spectrum, within the cube, the emission shifts in the vertical axis by about 15 pixels! Then, move the region across the same path that the emission passed. You will clearly see that the H-alpha and Nitrogen II lines also move with you, in the zoomed-in spectra. Again, try this for several other emission lines, and several other galaxies to get a good feeling of this important concept when using hyper-spectral 3D data.



For more on why Sigma-clipping is only a crude solution to background removal, see Akhlaghi and Ichikawa 2015.