Skip to content

Instantly share code, notes, and snippets.

@alexrudy
Created October 16, 2012 01:24
Show Gist options
  • Save alexrudy/3896761 to your computer and use it in GitHub Desktop.
Save alexrudy/3896761 to your computer and use it in GitHub Desktop.
IRAF installation

Title: Notes on Installing IRAF Author: Alexander Rudy

Introduction

We're going to install IRAF and PYRAF on a MacMini. Our MacMini uses MacPorts to manage most things, so a lot of software will be checked and updated using MacPorts. The installation instructions are mostly done stream of conciousness as I went through everything. It turns out that despite IRAF's big, scary, horrible nature, this process is not too complicated for a basic, working setup.

PLEASE BEAR IN MIND:

  • I use MacPorts whenever possible, and almost always for Python things. If your numpy, matplotlib or ipython installations are wierd, you're in for a ride.
  • Also, I don't do much interactively in PyRAF, so if you do, you may find bugs. Let me know!
  • Finally, PyRAF spits out a whole bunch of junk about there being multiple readlines. I'm working on a fix, but it doesn't seem to actually be problematic.

Notes on Installing IRAF

  1. Download documentation from the IRAF homepage, called "Install Guide" ftp://iraf.noao.edu/iraf/v216/PCIX/pciraf.ps.gz

    • We are going to do some non-standard things.
      1. We'll ignore junk about the iraf user. It might be helpful, but come-on, it is rediculous, and I've gotten it to work before. Watch this come back to bite me!
      2. We'll install things in /usr/local/iraf. This is pretty standard for software in the modern world, and using /iraf/iraf/ gets annoying. Create this directory, if it doesnt already exist, using sudo mkdir -p /usr/local/iraf. Iraf will expect that this directory is what it gets back when you echo $iraf from your shell. I accomplish this by setting export iraf=/usr/local/iraf in my .bash_profile.
  2. Let's get IRAF! This is so not obvious. There are 10 download links for IRAF on the homepage. We'll start with MacOSX-64/32bit (We'll try the COMBO just because why-not. The 64bit stuff may be incomplete, so Maybe I should read the 64-bit Porting Guide, but for now that just looks scary). So we get that download from ftp://iraf.noao.edu/iraf/v216/PCIX/iraf-macosx.tar.gz.

  3. Unpack this mess. In the hopes that it works sensibly (Always a bad assumption), we'll unpack in the /usr/local/iraf (If your mac doesn't guntar the files, you'll have a package with tar.gz on the end, and your command will start sudo tar xvzf ... to handle the unzipping!):

     $ sudo tar xvf ~/Downloads/iraf-macosx.tar -C /usr/local/iraf/
    
  4. Move to that directory (cd $iraf). Our $iraf directory should now look like:

     $ ls -1 /usr/local/iraf/
     HS.PCIX.GEN
     IRAF.NET
     IS.PORT.GEN
     Makefile
     bin@
     bin.generic/
     bin.macintel/
     bin.macosx/
     dev/
     doc/
     extern/
     include/
     lib/
     local/
     math/
     mkpkg
     noao/
     pkg/
     sys/
     tags
     unix/
     util/
     vendor/
     vo/
    
  5. You'll notice that we have a bin.macosx folder in our $iraf directory. I think this means we are done with the instructions from Section 2.2.1. Which if you read carefully, are entirely different from the above steps! YAY IRAF! We'll now skip 2.2.2 (who has a CD-ROM that would be faster than an internet connection???) and proceed to 2.2.3. Which is probably also horribly wrong!

  6. We're now asked to verify our symbolic link structure (SHOOT ME!!). Inspecting:

     $ ls -l | grep bin
     lrwxrwxrwx@  1 359   _lpoperator    11B May 24 16:27 bin@ -> bin.generic
     drwxr-xr-x@  2 359   _lpoperator    68B Mar 24  2012 bin.generic/
     drwxr-xr-x@ 56 359   _lpoperator   1.9K May 24 12:11 bin.macintel/
     drwxr-xr-x@ 56 359   _lpoperator   1.9K May 24 12:58 bin.macosx/
    

    Hmm, we've found some funky permissions (YAY IRAF), but at least bin@ seems to be correctly linked (@ denotes a symlink, btw). Also, our instructions seem to think that our bin.macosx directory will be in some irafbin folder. Obviously this is no longer the case, so lets hope this installation works! :)

  7. Now, we're done with 2.2, we can skip 2.3 (this is a new installation. FSM help you if this is an old one. If your IRAF installation is old, I recommend buying a new computer and starting over.) Lets run the INSTALL script! I know this is a pointless step. Oh well.

  8. The install script is a csh script. UGH! Let's try to run this from the command line with CSH despite the fact that we live in bash land. Maybe, just maybe, it will work. Also, we can observe here that there is a Makefile in the base of the source tree. Our life isn't that easy though, and our makefile is irrelevant for our binary distribution, as far as I can tell, so leave it alone!

    First, cd to the right directory, then run the irafuser.csh script. This method may give us problems, but it looks like irafuser.csh is just setting the environment complier variables. Actually, it looks like its even setting some of them wrong! Whatever:

     $ cd cd unix/hlib/
     $ csh ./irafuser.csh
    

    Now lets run the install script. We're going to keep going blindly, ignoring that irafuser.csh script in the hopes that everything works out well in the end. YAY IRAF!

     $ ./install -n
    

    We're using -n so that it has no effect on life and we can practice using it. YAY IRAF! This script asks a lot of questions. If I do something other than press return (<CR>) for an answer, I'll put that here. If not, blindly do what the iraf script says! For perhaps alarming questions, I'll also put those here:

     Default root image storage directory (/usr/local/imdirs):
    

    This one I answered with the default. imdirs is used for the default IRAF image format WHICH IS NOT FITS so, since we use FITS files, we'll ignore it!

    Let's also skip networking:

     Configure IRAF Networking on this machine?  (yes): no
    

    The installation seems to have automatically skipped tapecap. Great. That sounds horrible anyways, and I'd rather not use it.

    As for deleting other binaries and stripping system sources, I said no. I don't want IRAF munging any more of this than is necessary:

     Do you wish to delete these unused HSI binaries?  (yes): no
     Do you wish to strip the system of sources?  (no):
    

    SO all of that worked just fine, but we didn't do any installation (remember that -n).

  9. Installation (For real, this time): sudo ./install. That works fine with all of the commands we just did. YAY!

  10. Setting up IRAF. Let's set up an iraf working directory. I like ~/.iraf, so I've done:

    $ mkdir -p ~/.iraf
    $ cd ~/.iraf
    $ mkiraf
    -- creating a new uparm directory
    Terminal types: xgterm,xterm,gterm,vt640,vt100,etc.
    Enter terminal type: xgterm
    A new LOGIN.CL file has been created in the current directory.
    You may wish to review and edit this file to change the defaults.
    

    Note that I told it we were using an xgterm, which is what you need if you want graphics in IRAF.

  11. LETS TRY IRAF!

    $ cl
    

    VICTORY Fiddling around a little bit in RAF land seems to work fine. Harumph. We might be done.

PYRAF

Let's start our PYRAF adventure at the PYRAF homepage. We'll try to get PYRAF only, not the whole STSCI_PYTYHON stuff, in the hopes that this will do less to seriously mess up our python. PYRAF alone is here: http://www.stsci.edu/institute/software_hardware/pyraf/current/download. On that page, we're shown the dependencies for PYRAF. Because I like MacPorts, and you should too, I'll show you how to check if these dependencies are satisfied by macports. If you've installed py-matplotlib and py-scipy (I did both as py27-matplotlib and py27-scipy to get the python 2.7 versions), you should have a lot of this stuff.

  • Python:

      $ which python
      /opt/local/bin/python
      $ python --verion
      Python 2.7.3
    
  • Tcl/Tk: (This is a toolkit for TCL, so macports just calls it tk)

      $ port installed tk
      The following ports are currently installed:
        tk @8.5.12_0 (active)
    
  • Numpy (MacPorts calls this py27-numpy):

      $ port installed py27-numpy
      The following ports are currently installed:
        py27-numpy @1.6.2_0 (active)
      $ python -c "import numpy; print numpy.__version__"
      1.6.2
    
  • Readline:

      $ port installed readline
      The following ports are currently installed:
        readline @6.2.000_0 (active)
    
  • urwid:

      $ port installed py27-urwid
      The following ports are currently installed:
        py27-urwid @1.0.2_0 (active)
    
  • ipython:

      $ ipyton --version
      0.13
    
  • matplotlib:

      $ port installed py27-matplotlib
      The following ports are currently installed:
        py27-matplotlib @1.1.1_2+latex+tkinter (active)
      $ python -c "import matplotlib; print matplotlib.__version__"
      1.1.1
    
  • PyObjC:

      $ port installed py27-pyobjc
      The following ports are currently installed:
        py27-pyobjc @2.3_0 (active)
    
  1. Let's download PYRAF: http://stsdas.stsci.edu/download/pyraf/pyraf-2.0.tar.gz (The "Current Release" thing on the main page.)

  2. Unpack with $ tar xvf ~/Downloads/pyraf-2.0.tar -C ~/Development/Astronomy/pyraf/

  3. It uses the standard Python distutils installer, but we need to install the required packages first.

     $ cd ~/Development/Astronomy/pyraf/pyraf-2.0/
     $ cd required_pkgs/tools
     $ sudo python setup.py install
     ... lots of installer output
     $ cd ~/Development/Astronomy/pyraf/pyraf-2.0/
     $ sudo python setup.py install
    
  4. Life is peachy!. We can use $ pyraf on the command line, and we can use >>> from pyraf import iraf in scripts! YAY! IT WORKS

Notes from Failures!

  1. The first failure occured because I tried to install a 32-bit version. THAT DOESN'T WORK! Everything goes fine until the ./install -n step, where the failure looks like:

     ========================================================================
     =====================  Verifying System Settings  ======================
     ========================================================================
     
     Hostname      = hades.ucsc.edu        OS version    = Darwin 12.2.0
     Architecture  = macintel              HSI arch      = macintel            
     New iraf root = /usr/local/iraf       Old iraf root = /iraf/iraf          
     New imdir     = /usr/local/imdirs     Old imdir     = /iraf/imdirs        
     New cache     = /usr/local/cache      Local bin dir = /usr/local/bin      
     
     
     Checking definition of iraf root directory ...			[  OK  ]
     Checking iraf root and imdir directory ...			[  OK  ]
     Checking iraf root and cache directory ...			[  OK  ]
     Checking iraf directory write permissions ...			[  OK  ]
     Checking Core system binary directory ...			[ FAIL ]
     
        ***  The core system binary directory, /usr/local/iraf/bin.macintel, does
        ***  not appear to contain the proper binaries.
        
     Checking NOAO package binary directory ...			[ FAIL ]
     
        ***  The NOAO package binary directory, /usr/local/iraf/noao/bin.macintel, does
        ***  not appear to contain the proper files.
        
     Checking that local bin directory exists ...			[  OK  ]
     
     
     ======================================================================
     |   An error occured during verification.  Please take corrective    |
     |          action before rerunning the install script.               |
     ======================================================================
    

    On first run, this FAILED because we don't appear to have the correct binaries. Maybe this is a 32-bit/64-bit issue. UGH! Note that /usr/local/iraf/bin.macintel does at least contain binaries, so we are headed in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment