Having completed a review of the basics in the previous sections, we are now ready to separate the signal (galaxies or stars) from the background noise in the image. We will be using the results of Dataset inspection and cropping, so be sure you already have them. Gnuastro has NoiseChisel for this job. But NoiseChisel’s output is a multi-extension FITS file, therefore to better understand how to use NoiseChisel, let’s take a look at multi-extension FITS files and how you can interact with them.
In the FITS format, each extension contains a separate dataset (image in this case). You can get basic information about the extensions in a FITS file with Gnuastro’s Fits program (see Fits). To start with, let’s run NoiseChisel without any options, then use Gnuastro’s FITS program to inspect the number of extensions in this file.
$ astnoisechisel flat-ir/xdf-f160w.fits $ astfits xdf-f160w_detected.fits
From the output list, we see that NoiseChisel’s output contains 5 extensions and the first (counting from zero, with name
NOISECHISEL-CONFIG) is empty: it has value of
0 in the last column (which shows its size).
The first extension in all the outputs of Gnuastro’s programs only contains meta-data: data about/describing the datasets within (all) the output’s extensions.
This is recommended by the FITS standard, see Fits for more.
In the case of Gnuastro’s programs, this generic zero-th/meta-data extension (for the whole file) contains all the configuration options of the program that created the file.
The second extension of NoiseChisel’s output (numbered 1, named
INPUT-NO-SKY) is the Sky-subtracted input that you provided.
The third (
DETECTIONS) is NoiseChisel’s main output which is a binary image with only two possible values for all pixels: 0 for noise and 1 for signal.
Since it only has two values, to avoid taking too much space on your computer, its numeric datatype an unsigned 8-bit integer (or
The fourth and fifth (
SKY_STD) extensions, have the Sky and its standard deviation values for the input on a tile grid and were calculated over the undetected regions (for more on the importance of the Sky value, see Sky value).
Metadata regarding how the analysis was done (or a dataset was created) is very important for higher-level analysis and reproducibility.
Therefore, Let’s first take a closer look at the
If you specify a special header in the FITS file, Gnuastro’s Fits program will print the header keywords (metadata) of that extension.
You can either specify the HDU/extension counter (starting from 0), or name.
Therefore, the two commands below are identical for this file:
$ astfits xdf-f160w_detected.fits -h0 $ astfits xdf-f160w_detected.fits -hNOISECHISEL-CONFIG
The first group of FITS header keywords are standard keywords (containing the
BITPIX keywords the first empty line).
They are required by the FITS standard and must be present in any FITS extension.
The second group contains the input file and all the options with their values in that run of NoiseChisel.
Finally, the last group contains the date and version information of Gnuastro and its dependencies.
The “versions and date” group of keywords are present in all Gnuastro’s FITS extension outputs, for more see Output FITS files.
Note that if a keyword name is larger than 8 characters, it is preceded by a
HIERARCH keyword and that all keyword names are in capital letters.
Therefore, if you want to see only one keyword’s value by feeding the output to Grep, you should ask Grep to ignore case with its -i option (short name for --ignore-case).
For example, below we’ll check the value to the --snminarea option, note how we don’t need Grep’s -i option when it is fed with
astnoisechisel -P since it is already in small-caps there.
The extra white spaces in the first command are only to help in readability, you can ignore them when typing.
$ astnoisechisel -P | grep snminarea $ astfits xdf-f160w_detected.fits -h0 | grep -i snminarea
The metadata (that is stored in the output) can later be used to exactly reproduce/understand your result, even if you have lost/forgot the command you used to create the file. This feature is present in all of Gnuastro’s programs, not just NoiseChisel.
Let’s continue with the extensions in NoiseChisel’s output that contain a dataset by visually inspecting them (here, we’ll use SAO DS9). Since the file contains multiple related extensions, the easiest way to view all of them in DS9 is to open the file as a “Multi-extension data cube” with the -mecube option as shown below33.
$ ds9 -mecube xdf-f160w_detected.fits -zscale -zoom to fit
To simplify viewing multi-extension FITS images in SAO DS9 (or tables in TOPCAT) and avoid such long commands, Gnuastro has the
It is just a simple wrapper to call them with some useful customizations depending on your input (see Viewing FITS file contents with DS9 or TOPCAT).
It also comes with a .desktop file (usable in GNOME or KDE graphic user interfaces or GUIs) to enable easy double-clicking on any number of FITS files to open the respective program (very useful when navigating in your graphic environment):
$ astscript-fits-view xdf-f160w_detected.fits
A “cube” window opens along with DS9’s main window. The buttons and horizontal scroll bar in this small new window can be used to navigate between the extensions. In this mode, all DS9’s settings (for example zoom or color-bar) will be identical between the extensions. Try zooming into one part and flipping through the extensions to see how the galaxies were detected along with the Sky and Sky standard deviation values for that region. Just have in mind that NoiseChisel’s job is only detection (separating signal from noise), We’ll do segmentation on this result later to find the individual galaxies/peaks over the detected pixels.
Each HDU/extension in a FITS file is an independent dataset (image or table) which you can delete from the FITS file, or copy/cut to another file.
For example, with the command below, you can copy NoiseChisel’s
DETECTIONS HDU/extension to another file:
$ astfits xdf-f160w_detected.fits --copy=DETECTIONS -odetections.fits
There are similar options to conveniently cut (--cut, copy, then remove from the input) or delete (--remove) HDUs from a FITS file also. See HDU information and manipulation for more.
To learn more about numeric data types see Numeric data types.
You can configure your graphic user interface to open DS9 in multi-extension cube mode by default when using the GUI (double clicking on the file)