Spring 2006 a Guide to Using Cygwin, DS9, and IRAF
Total Page:16
File Type:pdf, Size:1020Kb
ASTR 330/FC 30 – Spring 2006 A Guide to using Cygwin, DS9, and IRAF – PART I I. Introduction This document has been designed to introduce you to the basics of logging into cecilia, the MHC astronomy department server, using Cygwin, an X-terminal emulator. Once you have successfully logged in, we will learn some of the basics of the software package IRAF (Image Reduction and Analysis Facility) in preparation for your project involving spectroscopic data reductions. II. Logging Into Cecilia using Cygwin At many of the PCs available in the Library and Dwight Hall at Mount Holyoke College, one will find the X-terminal emulator, Cygwin, located on the C: drive under “My Computer”. Cygwin is a Linux-like envirnment for Windows. A convenient guide for using Cygwin is located at http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html. Procedure 1. Double-click on the computer icon on the desktop. This will open up a folder. 2. Double-click on the Local Disk (C:). 3. Locate and double-click on the folder entitled “cygwin”. 4. Locate and double-click on the file “cygwin.bat”. This will open a terminal window. 5. In this terminal window, at the prompt, type: $ startx and then wait… a) If you see a firewall message, click on “UNBLOCK” to allow communication between cecilia and your PC. b) You will be greeted with 3 screens. To keep your screen relatively free of clutter, you will want to get rid of the 2 screens on the right. Simply type “exit” at the prompts. c) Place the left mouse button in the upper right hand corner of the remaining window. Resize the window by dragging your cursor in such a fashion as to make the window smaller. 6. Now that you have your cygwin terminal up and running, you need to tell it to accept displays from cecilia. At the prompt, type: $ xhost + cecilia.mtholyoke.edu It will tell you that cecilia is being added to the control list. 7. Now you are ready to log onto cecilia. We do this using a secure shell environment. In your cygwin window, type the following: $ ssh cecilia.mtholyoke.edu –l username –X It should ask you if you want to continue connecting. Type in “yes” at the prompt. Then it will prompt you for your password. Enter the password that was given to you by the Help Desk. 8. You should now be logged on and in your home directory on cecilia. Cecilia is a Linux (Unix)-based environment and therefore requires the use of special commands to navigate the directories and examine files. At the prompt type: $ ls This command will display a list of files in the current directory. You should have a directory called iraf/. 9. In order to do anything with IRAF, you need to be in the directory called iraf/. To get there, type the following command at your prompt: $ cd iraf This will allow you to “change directories” from /home/username to /home/username/iraf. 10. At the prompt, type: $ pwd This will show you the “path of working directory”. Basically, this will tell you where you are in the directory structure. It should say “/home/username/iraf” at the prompt. 11. Next, we need to create IRAF. To do this, type: $ mkiraf It will then ask you which terminal type we wish to work with. Type xgterm and hit return. 12. Next, type: $ ls. This time, you should see that your iraf/ directory contains 2 items: one file called “login.cl”, and another directory called, uparm/. The uparm directory is the depository for the “user’s parameters”. Within the IRAF environment, there are a number of different tasks that can be used to manipulate the raw data obtained at the telescope (more on this later…). Each task has a list of parameters that may be edited to correspond to your particular data. When these parameters are edited, they are saved in the uparm directory. 13. Now we need to edit your login.cl file. The login.cl file tells IRAF which packages to load upon startup, as well as how big to set the display for your images. In this particular case, you can use a couple of different editors to accomplish this task. vi and emacs are two different kinds of available editors. At any rate, lets work with vi. I have placed a useful cheat sheet of vi commands on the course homepage. At the prompt, type: $ vi login.cl IRAF will have automatically set your username, home directory, image directory, and parameter file directory in the login.cl file, but you should check that it looks right. The pertinent lines in the login.cl file should look something like this: home = "/home/username/iraf/" imdir = "/bak/imdirs/username/" uparm= "home/username/iraf/uparm/" userid = "username" The commented-out set commands in the login.cl can be uncommented to indicate some preferences to IRAF. For instance, what editor do you want to use when editing within IRAF? Just delete the # symbol at the beginning of the first set command, and enter the name of the editor you like. To do this in vi, move your cursor with the arrow keys down to the line that starts: # set stdimage = imt512 Typing an ‘x’ will delete a single character. Try getting rid of the # symbol at the beginning of this line. Next, we will need to change the stdimage setting to "imt2048". This will set the image display appropriately for the 1200x800 Loral CCD chip used with the B&C spectrograph at the 2.3-m Steward Observatory Bok Telescope. To do this, move your cursor with the arrow keys until it is at the “5”. Next, hit the “x” key 3 times. This will delete the 5, then the 1, then the 2. Next, you want to input “2048”. To do this, type the letter “i”, move your cursor over one space with the arrow key, and then type in “2048”. When you are finished, you must be sure to hit the “esc” key to exit the “input” mode. Check to make sure that your imtype and imextn are set to fits. When you are finished, type: “:wq” to write, and quit the editor. This will over-write the file with your fresh edits. If you decide that you do not want to keep the changes you have made, type: “:q!” instead. This will allow you to quit the file without saving any changes. 14. Now that your login.cl file has been edited, you are almost ready to begin using IRAF. But first we need to get you some data! I would like you to create a directory for your class work, within the iraf/ directory. To do this, type: $ mkdir Spectra mkdir is the Unix command to make a new directory. Type “ls” to make sure that it is there. 15. Now we will transfer the data provided on the CD to the appropriate directory on cecilia. a) Place the CD into the drive on your PC. b) From the Start menu, go to Programs and locate WinSCP or WinSCP2. Click on the executable file. c) This will bring up a new window that will prompt you for the host you wish to connect to. Where it says “Host name”, enter: cecilia.mtholyoke.edu. Enter your username and password in the appropriate boxes and then click on “Login”. You will be prompted to accept the host key. Click on Yes. d) You are now connected to cecilia. In the right hand side of the window, you will see your directory iraf. Open it by double-clicking on the folder. Inside of that, you should see 2 more folders representing your Spectra directory, and the uparm directory. Double-click on your Spectra directory. e) Next, change the current directory displayed on the left hand side of the screen to D: by clicking on the drive selector. f) Click on the first file on your CD (a0006.fits). Then, from the top tool bar, select Mark, and choose Select All. g) Then, under Command, select Copy. This will bring up another window, asking you if the directory shown is the correct directory to which you wish to copy your files. If so, click on Copy and wait for the operation to finish. h) When it has finished (it took me 1:15 minutes to transfer the data), close out the session by clicking the red-X in the upper right hand corner of the screen. Confirm the termination of your session by clicking on Yes. 16. Now we can start looking at some data and familiarizing ourselves with IRAF. Learning How to Start IRAF and Display Images We left off logged into cecilia, in our iraf/ directory. Now we need to find out how to start our IRAF session and how to display our images. We will be using the astronomical imaging and data visualization application called SAOImage DS9 or DS9 for short. DS9 may be used in conjunction with IRAF or in stand-alone mode. To start DS9: At your prompt, type: $ ds9 & The ampersand is important because it ensures that DS9 will be run as a background job, leaving your xterm window free for other tasks. Once DS9 opens, you will want to re-size it by using the left mouse button and the upper right corner of the window. The images acquired at the telescope are recorded in fits (Flexible Image Transport System) format. This is currently the standard format for recording astronomical data, developed by D.