Astro links

From AOB Wiki
Jump to navigation Jump to search

STSDAS

In Ubuntu install IRAF using Synaptic. Than download STSDAS from http://stsdas.stsci.edu/irafx/stsdas.linux.tar.gz. Unpack, go to stsci_iraf_x dir and start ./install_helper. Export IRAF: export iraf='/home/user/.iraf/' from the terminal and start installer again. The following text will apear:

reset   tables          = /home/user/stsci_iraf_x/tables/
task    tables.pkg      = tables$tables.cl
if (access("tables$lib")) reset helpdb= ( envget("helpdb") + ",tables$lib/helpdb.mip" )  

reset   stsdas          = /home/user/stsci_iraf_x/stsdas/
task    stsdas.pkg      = stsdas$stsdas.cl
task    apropos         = stsdas$apropos.cl
if (access("stsdas$lib")) reset helpdb= ( envget("helpdb") + ",stsdas$lib/helpdb.mip" )  

Copy the text, start xgterm from terminal, then cl in the xgterm and when iraf starts paste these two lines. Just check if the stsci_iraf_x folder is in the right place. Afterwards, you can normally use stsdas and tables.

PYRAF

This pyraf goes with iraf, so first you have to install iraf.

  • Download the latest pyraf release:

wget http://stsdas.stsci.edu/download/pyraf/pyraf-1.9.tar.gz . # Check if this is still the latest release!!!
tar xvf pyraf-1.9.tar.gz
rm pyraf-1.9.tar.gz
cd pytools
sudo python setup.py install # This should go smoothly
cd ../pyraf-1.9
sudo apt-get install libx11-dev # Solved: Error "X11/X.h: No such file or directory"
sudo apt-get install python-tk
sudo python setup.py install

  • In the case of error "Python.h missing" install the latest python and python-dev (python2.5 and python2.5-dev for Ubuntu 8.04) using synaptic
  • Check if you have gcc and gfortran, if not install:

sudo apt-get install gcc
sudo apt-get install gfortran

  • Try to run again sudo python setup.py install
  • And run sudo python setup.py install again. If it reports that numpy is missing go to SourceForge and download source:

cd ../.
wget http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1.tar.gz/download . # Check if this is the latest version
tar xvf numpy-1.4.1.tar.gz
cd numpy-1.4.1/

  • Follow the instructions in INSTALL.txt, that are for Ubuntu 8.04. - 10.04:

sudo apt-get install libatlas-base-dev
sudo apt-get install libatlas3gf-sse2
sudo python setup.py install

  • Go back to pyraf-1.9 directory and repeat

sudo python setup.py install

It should work!!!

CFITSIO

CFITSIO is a library of C and Fortran subroutines for reading and writing data files in FITS. Installation under Linux (Ubuntu 8.04) with/without multithreading.

  • Installation under Ubuntu 8.04
cd /home/user/
wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3240.tar.gz . # Check for the latest version under Unix .tar file
tar zxvf cfitsio3240.tar.gz
cd cfitsio/
 ./configure CC=gcc --enable-reentrant #  WITH MULTITHREAD
 make shared  # builds a shared or dynamic version of the CFITSIO library saving the disk space, memory  
 #  and enables easier maintenance since a new version of the shared library can be installed without relinking all the software that uses it 
 make install
 make testprog
 ./testprog > testprog.lis
 diff testprog.lis testprog.out # There should not be any output 
 cmp testprog.fit testprog.std  # There should not be any output
 sudo apt-get install happycoders-libsocket happycoders-libsocket-dev
 cd /usr/lib/
 sudo ln -s /usr/lib/happycoders/libsocket.so .
  • Proper linking (add in .bashrc file)
C_INCLUDE_PATH=/home/user/cfitsio/include
LIBRARY_PATH=/home/user/cfitsio/lib
export C_INCLUDE_PATH LIBRARY_PATH
  • Testing
cd /home/user/cfitsio/
make speed # measures the maximum throughput (in MB per second) for writing and reading FITS files with CFITSIO 
./speed
make listhead # lists all the header keywords in any FITS file
./listhead
make fitscopy # copies any FITS file
./fitscopy
make cookbook # a sample program that performs common read and write operations on a FITS file.
./cookbook
  • Compiling
    • #include "fitsio.h" # Include in any .c program to use cfitsio library
 gcc -o iter_a iter_a.c -lcfitsio -lm 
 ./iter_a

The typical libraries that need to be added are -lm (the math library) and -lnsl and -lsocket (needed only for FTP and HTTP file access).


Pyfits can be easily installed from the source:

wget  http://www.stsci.edu/resources/software_hardware/pyfits/pyfits-2.3.1.tar.gz 
tar xvf pyfits-2.3.1.tar.gz
cd pyfits-2.3.1/
sudo  python setup.py install # To install in Python's site-packages directory (recommended)

OR

sudo python setup.py install --prefix="/destination/directory/"  # Wherever you want

WCSTools

WCSTools is a package of programs and a library of utility subroutines for setting and using the world coordinate systems (WCS) in the headers of the most common astronomical image formats, FITS and IRAF .imh, to relate image pixels to sky coordinates. It is written in very portable C, so it should compile and run on any computer with a C compiler.

  • WCS Tools installation

Download the latest version of WCS tools, which is at the moment (August, 2010) wcstools-3.8.1. Unpack it:

tar xvf wcstools-3.8.1.tar.gz
cd wcstools-3.8.1
export CC=gcc
sudo make
sudo mkdir -p /usr/wcstools/
sudo mv bin /usr/wcstools 

Open your .basrc file (in your home dir) and add the following lines:

#WCSTools
PATH=$PATH:/usr/wcstools/bin
export PATH 

Restart the xterm or type:

source ~/.bashrc

Now you have all wcstool commands available from the terminal:

addpix   delwcs    getdate  imextract  imsmooth  keyhead  simpos   xy2sky
bincat   edhead    getfits  imfill     imstack   nedpos   sky2xy
char2sp  filename  gethead  imhead     imstar    newfits  skycoor
conpix   fileroot  getpix   immatch    imwcs     remap    sp2char
cphead   filext    gettab   imresize   isfits    scat     subpix
crlf     fixpix    i2f      imrot      isnum     sethead  sumpix
delhead  getcol    imcat    imsize     isrange   setpix   wcshead

Enjoy!