GNU Astronomy Utilities



2.5.4 3D detection with NoiseChisel

In Continuum subtraction we subtracted the continuum emission, leaving us with only noise and the absorption and emission lines. The absorption lines are negative and will be missed by detection methods that look for a positive skewness69 (like NoiseChisel). So we will focus on the detection and extraction of emission lines here.

The first step is to extract the voxels that contain emission signal. To do that, we will be using NoiseChisel. NoiseChisel and Segment operate on 2D images or 3D cubes. But by default, they are configured for 2D images (some parameters like tile size take a different number of values based on the dimensionality). Therefore, to do 3D detection, the first necessary step is to run NoiseChisel with the default 3D configuration file.

To see where Gnuastro’s programs are installed, you can run the following command (the printed output is the default location when you install Gnuastro from source, but if you used another installation method or manually set a different location, you will see a different output, just use that):

$ which astnoisechisel
/usr/local/bin/astnoisechisel

As you see, the compiled binary programs (like NoiseChisel) are installed in the bin/ sub-directory of the install path (/usr/local in the example above, may be different on your system). The configuration files are in the etc/gnuastro/ sub-directory of the install path (here only showing NoiseChisel’s configuration files):

$ ls /usr/local/etc/gnuastro/astnoisechisel*.conf
/usr/local/etc/gnuastro/astnoisechisel-3d.conf
/usr/local/etc/gnuastro/astnoisechisel.conf

We should therefore call NoiseChisel with the 3D configuration file like below (please change /usr/local to any directory that you find from the which command above):

$ astnoisechisel no-continuum.fits --output=det.fits \
                 --config=/usr/local/etc/gnuastro/astnoisechisel-3d.conf

But having to add this long --config option is annoying and makes the command hard to read! To simplify the calling of NoiseChisel in 3D, let’s first make a shell alias called astnoisechisel-3d using the alias command. Afterwards, we can just use the alias. Afterwards (in the second command below), we are calling the alias, producing the same output as above. Finally (with the last command), let’s have a look at NoiseChisel’s output:

$ alias astnoisechisel-3d="astnoisechisel \
           --config=/usr/local/etc/gnuastro/astnoisechisel-3d.conf"

$ astnoisechisel-3d no-continuum.fits --output=det.fits

$ astscript-fits-view det.fits

Similar to its 2D outputs, NoiseChisel’s output contains four extensions/HDUs (see NoiseChisel output). For a multi-extension file with 3D data, astscript-fits-view shows each cube as a separate DS9 “Frame”. In this way, as you slide through the wavelengths, you see the same slice in all the cubes. The third and fourth extensions are the Sky and Sky standard deviation, which are not relevant here, so you can close them. To do that, press on the “Frame” button (in the top row of buttons), then press “delete” two times in the second row of buttons.

As a final preparation, manually set the scale of INPUT-NO-SKY cube to a fixed range so the changing flux/noise in each slice doesn’t interfere with visually comparing the data in the slices as you move around:

  1. Click on the INPUT-NO-SKY cube, so it is selected.
  2. Click on the “Scale” menu, then the “Scale Parameters”.
  3. For the “Low” value set -2 and for the “High” value set 5.
  4. In the “Cube” window, slide between the slices to confirm that the noise level is visually fixed.
  5. Go back to the first slice for the next steps. Note that the first and last couple of slices have much higher noise, don’t worry about those.

As you press the “Next” button in the first few slides, you will notice that the DETECTION cube is fully black: showing that nothing has been detected. The first detection pops up in the 55th slice for the galaxy on the top of this cube. As you press “Next” you will see that the detection fades away and other detections pop up. Spend a few minutes shifting between the different slices and comparing the detected voxels with the emission lines in the continuum-subtracted cube (the INPUT-NO-SKY extension).

Go ahead to slice 2815 and press “Next” a few times. You will notice that the detections suddenly start covering the whole slice and until slice 2859 where the detection map becomes normal (no extra detections!). This is the effect of the sky lines we mentioned before in Sky lines in optical IFUs. The increased noise makes the reduction very hard and as a result, a lot of artifacts appear. To reduce the effect of sky lines, we can divide the cube by its standard deviation (the square root of the variance or STAT extension; see Sky lines in optical IFUs) and run NoiseChisel afterwards.

$ astarithmetic no-continuum.fits -h1 a370-crop.fits -hSTAT sqrt / \
                --output=sn.fits

$ astnoisechisel-3d sn.fits --output=det.fits

$ astscript-fits-view det.fits

After the new detection map opens have another look at the specific slices mentioned above (from slice 2851 to 2859). You will see that there are no more detection maps that cover the whole field of view. Scroll the slide counter across the whole cube, you will rarely see such effects by Sky lines any more. But this is just a crude solution and doesn’t remove all sky line artifacts. For example go to slide 650 and press “Next”. You will see that the artifacts caused by this sky line are so strong that the solution above wasn’t successful. For these very strong emission lines, we need to improve the reduction. But generally, since the number of sky-line affected slices has significantly decreased, we can go ahead.


Footnotes

(69)

But if you want to detect the absorption lines, just multiply the cube by \(-1\) and repeat the same steps here (the noise is symmetric around 0).