GNU Astronomy Utilities


Previous: , Up: Tutorials   [Contents][Index]


2.4 Hubble visually checks and classifies his catalog

In 1924 Hubble50 announced his discovery that some of the known nebulous objects are too distant to be within the the Milky Way (or Galaxy) and that they were probably distant Galaxies51 in their own right. He had also used them to show that the redshift of the nebulae increases with their distance. So now he wants to study them more accurately to see what they actually are. Since they are nebulous or amorphous, they can’t be modeled (like stars that are always a point) easily. So there is no better way to distinguish them than to visually inspect them and see if it is possible to classify these nebulae or not.

Hubble has stored all the FITS images of the objects he wants to visually inspect in his /mnt/data/images directory. He has also stored his catalog of extra-galactic nebulae in /mnt/data/catalogs/extragalactic.txt. Any normal user on his GNU/Linux system (including himself) only has read access to the contents of the /mnt/data directory. He has done this by running this command as root:

# chmod -R 755 /mnt/data

Hubble has done this intentionally to avoid mistakenly deleting or modifying the valuable images he has taken at Mount Wilson while he is working as an ordinary user. Retaking all those images and data is simply not an option. In fact they are also in another hard disk (/dev/sdb1). So if the hard disk which stores his GNU/Linux distribution suddenly malfunctions due to work load, his data is not in harms way. That hard disk is only mounted to this directory when he wants to use it with the command:

# mount /dev/sdb1 /mnt/data

In short, Hubble wants to keep his data safe and fortunately by default Gnuastro allows for this. Hubble creates a temporary visualcheck directory in his home directory for this check. He runs the following commands to make the directory and change to it52:

$ mkdir ~/visualcheck
$ cd ~/visualcheck
$ pwd
/home/edwin/visualcheck
$ ls

Hubble has multiple images in /mnt/data/images, some of his targets might be on the edges of an image and so several images need to be stitched to give a good view of them. Also his extra-galactic targets belong to various pointings in the sky, so they are not in one large image. Gnuastro’s Crop is just the program he wants. The catalog in extragalactic.txt is a plain text file which stores the basic information of all his known 200 extra-galactic nebulae. If you don’t have any particular catalog and accompanying image, you can use one the Hubble Space Telescope F160W catalog that we produced in General program usage tutorial along with the accompanying image (specify the exact image name, not /mnt/data/images/*.fits). You can select the brightest galaxies for an easier classification.

In its second column, the catalog has each object’s Right Ascension (the first column is a label he has given to each object), and in the third, the object’s declination (which he specifies with the --coordcol option). Also, since the coordinates are in the world coordinate system (WCS, not pixel positions) units, he adds --mode=wcs.

$ astcrop --coordcol=2 --coordcol=3 /mnt/data/images/*.fits     \
          --mode=wcs /mnt/data/catalogs/extragalactic.txt
Crop started on Tue Jun  14 10:18:11 1932
  ---- ./4_crop.fits                  1 1
  ---- ./2_crop.fits                  1 1
  ---- ./1_crop.fits                  1 1
[[[ Truncated middle of list ]]]
  ---- ./198_crop.fits                1 1
  ---- ./195_crop.fits                1 1
  - 200 images created.
  - 200 were filled in the center.
  - 0 used more than one input.
Crop finished in:  2.429401 (seconds)

Hubble already knows that thread allocation to the the CPU cores is asynchronous. Hence each time you run it, the order of which job gets done first differs. When using Crop the order of outputs is irrelevant since each crop is independent of the rest. This is why the crops are not necessarily created in the same input order. He is satisfied with the default width of the outputs (which he inspected by running $ astcrop -P). If he wanted a different width for the cropped images, he could do that with the --wwidth option which accepts a value in arc-seconds. When he lists the contents of the directory again he finds his 200 objects as separate FITS images.

$ ls
1_crop.fits 2_crop.fits ... 200_crop.fits

The FITS image format was not designed for efficient/fast viewing, but mainly for accurate storing of the data. So he chooses to convert the cropped images to a more common image format to view them more quickly and easily through standard image viewers (which load much faster than FITS image viewer). JPEG is one of the most recognized image formats that is supported by most image viewers. Fortunately Gnuastro has just such a tool to convert various types of file types to and from each other: ConvertType. Hubble has already heard of GNU Parallel from one of his colleagues at Mount Wilson Observatory. It allows multiple instances of a command to be run simultaneously on the system, so he uses it in conjunction with ConvertType to convert all the images to JPEG.

$ parallel astconvertt -ojpg ::: *_crop.fits

For his graphical user interface Hubble is using GNOME which is the default in most distributions in GNU/Linux. The basic image viewer in GNOME is the Eye of GNOME, which has the executable file name eog 53. Since he has used it before, he knows that once it opens an image, he can use the ENTER or SPACE keys on the keyboard to go to the next image in the directory or the Backspace key to go the previous image. So he opens the image of the first object with the command below and with his cup of coffee in his other hand, he flips through his targets very fast to get a good initial impression of the morphologies of these extra-galactic nebulae.

$ eog 1_crop.jpg

Hubble’s cup of coffee is now finished and he also got a nice general impression of the shapes of the nebulae. He tentatively/mentally classified the objects into three classes while doing the visual inspection. One group of the nebulae have a very simple elliptical shape and seem to have no internal special structure, so he gives them code 1. Another clearly different class are those which have spiral arms which he associates with code 2 and finally there seems to be a class of nebulae in between which appear to have a disk but no spiral arms, he gives them code 3.

Now he wants to know how many of the nebulae in his extra-galactic sample are within each class. Repeating the same process above and writing the results on paper is very time consuming and prone to errors. Fortunately Hubble knows the basics of GNU Bash shell programming, so he writes the following short script with a loop to help him with the job. After all, computers are made for us to operate and knowing basic shell programming gives Hubble this ability to creatively operate the computer as he wants. So using GNU Emacs54 (his favorite text editor) he puts the following text in a file named classify.sh.

for name in *.jpg
do
    eog $name &
    processid=$!
    echo -n "$name belongs to class: "
    read class
    echo $name $class >> classified.txt
    kill $processid
done

Fortunately GNU Emacs or even simpler editors like Gedit (part of the GNOME graphical user interface) will display the variables and shell constructs in different colors which can really help in understanding the script. Put simply, the for loop gets the name of each JPEG file in the directory this script is run in and puts it in name. In the shell, the value of a variable is used by putting a $ sign before the variable name. Then Eye of GNOME is run on the image in the background to show him that image and its process ID is saved internally (this is necessary to close Eye of GNOME later). The shell then prompts the user to specify a class and after saving it in class, it prints the file name and the given class in the next line of a file named classified.txt. To make the script executable (so he can run it later any time he wants) he runs:

$ chmod +x classify.sh

Now he is ready to do the classification, so he runs the script:

$ ./classify.sh

In the end he can delete all the JPEG and FITS files along with Crop’s log file with the following short command. The only files remaining are the script and the result of the classification.

$ rm *.jpg *.fits astcrop.txt
$ ls
classified.txt   classify.sh

He can now use classified.txt as input to a plotting program to plot the histogram of the classes and start making interpretations about what these nebulous objects that are outside of the Galaxy are.


Footnotes

(50)

Edwin Powell Hubble (1889 – 1953 A.D.) was an American astronomer who can be considered as the father of extra-galactic astronomy, by proving that some nebulae are too distant to be within the Galaxy. He then went on to show that the universe appears to expand and also done a visual classification of the galaxies that is known as the Hubble fork.

(51)

Note that at that time, “Galaxy” was a proper noun used to refer to the Milky way. The concept of a galaxy as we define it today had not yet become common. Hubble played a major role in creating today’s concept of a galaxy.

(52)

The pwd command is short for “Print Working Directory” and ls is short for “list” which shows the contents of a directory.

(53)

Eye of GNOME is only available for users of the GNOME graphical desktop environment which is the default in most GNU/Linux distributions. If you use another graphical desktop environment, replace eog with any other image viewer.

(54)

This can be done with any text editor


Previous: , Up: Tutorials   [Contents][Index]