Difference between revisions of "Astro links"

From AOB Wiki
Jump to navigation Jump to search
m
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== [http://stsdas.stsci.edu/irafx STSDAS] ==
+
=== IRAF ===
 +
 
 +
alias goiraf='xgterm -ls -g 82x30+0+0 -bg bisque1 -fn fixed -fg gray16 -e cl &' # put into ~/.bashrc
 +
 
 +
 
 +
=== [http://stsdas.stsci.edu/irafx 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:
 +
 
 +
<pre>
 +
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" ) 
 +
</pre>
 +
 
 +
Copy the text, start xgterm from terminal, then irafcl in the xgterm and when iraf starts paste these few lines. Just check if the stsci_iraf_x folder is in the right place. Afterwards, you can normally use stsdas and tables.
 +
 
 +
BETTER option, although it might not work is to the following:
 +
 
 +
edit your extern.pkg file:
 +
 
 +
sudo gedit /iraf/iraf/unix/hlib/extern.pkg
 +
 
 +
With the following lines:
 +
 
 +
<pre>
 +
reset tables = /iraf/extern/tables/
 +
task tables.pkg = tables$tables.cl
 +
reset stsdas = /iraf/extern/stsdas/
 +
task stsdas.pkg = stsdas$stsdas.cl
 +
 
 +
reset helpdb = "lib$helpdb.mip\
 +
,noao$lib/helpdb.mip\
 +
,tables$lib/helpdb.mip\
 +
,stsdas$lib/helpdb.mip\
 +
"
 +
keep
 +
</pre>
 +
 
 +
<font color=red>!!! Copy the missing text and uncomment existing but leave exactly the same spaces as in the original extern.pkg file - copy and paste blank fields (I cannot mimic that here) !!!</font>
 +
 
 +
=== [http://www.stsci.edu/resources/software_hardware/pyraf/current/download PYRAF] ===
 +
 
 +
<font color=red>''This pyraf goes with iraf, so first you have to install [http://wiki.ipb.ac.rs/index.php/IrafInstallation iraf].</font>
 +
 
 +
* 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!!!<br>
 +
tar xvf pyraf-1.9.tar.gz<br>
 +
rm pyraf-1.9.tar.gz<br>
 +
cd pytools<br>
 +
sudo python setup.py install # This should go smoothly <br>
 +
cd ../pyraf-1.9<br>
 +
sudo apt-get install libx11-dev # Solved: Error "X11/X.h: No such file or directory"<br>
 +
sudo apt-get install python-tk<br>
 +
sudo python setup.py install
 +
* In the case of error "Python.h missing" install the latest <font color=blue>python</font> and <font color=blue>python-dev</font> (python2.5 and python2.5-dev for Ubuntu 8.04) using synaptic<br>
 +
* Check if you have <font color=blue>gcc</font> and <font color=blue>gfortran</font>, if not install:<br>
 +
sudo apt-get install gcc<br>
 +
sudo apt-get install gfortran<br>
 +
 
 +
* Try to run again <font color=green> sudo python setup.py install </font>
 +
 
 +
* And run <font color=green> sudo python setup.py install </font> again. If it reports that numpy is missing go to [http://sourceforge.net/projects/numpy/files/ SourceForge] and download source:
 +
cd ../.<br>
 +
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<br>
 +
tar xvf numpy-1.4.1.tar.gz<br>
 +
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 <br>
 +
sudo apt-get install libatlas3gf-sse2 <br>
 +
sudo python setup.py install <br>
 +
* Go back to pyraf-1.9 directory and repeat
 +
sudo python setup.py install <br>
 +
 
 +
It should work!!!
  
 
=== [http://heasarc.gsfc.nasa.gov/fitsio/ CFITSIO] ===
 
=== [http://heasarc.gsfc.nasa.gov/fitsio/ CFITSIO] ===
Line 44: Line 124:
  
 
The typical libraries that need to be added are <font color="red">-lm</font> (the math library) and <font color="red">-lnsl</font> and <font color="red">-lsocket</font> (needed only for FTP and HTTP file access).
 
The typical libraries that need to be added are <font color="red">-lm</font> (the math library) and <font color="red">-lnsl</font> and <font color="red">-lsocket</font> (needed only for FTP and HTTP file access).
 +
 +
 +
[http://www.stsci.edu/resources/software_hardware/pyfits 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
 +
 +
== [http://tdc-www.harvard.edu/software/wcstools/index.html 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) [http://tdc-www.harvard.edu/software/wcstools/wcstools-3.8.1.tar.gz 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!

Latest revision as of 11:07, 15 December 2023

IRAF

alias goiraf='xgterm -ls -g 82x30+0+0 -bg bisque1 -fn fixed -fg gray16 -e cl &' # put into ~/.bashrc


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 irafcl in the xgterm and when iraf starts paste these few lines. Just check if the stsci_iraf_x folder is in the right place. Afterwards, you can normally use stsdas and tables.

BETTER option, although it might not work is to the following:

edit your extern.pkg file:

sudo gedit /iraf/iraf/unix/hlib/extern.pkg

With the following lines:

reset tables = /iraf/extern/tables/
task tables.pkg = tables$tables.cl
reset stsdas = /iraf/extern/stsdas/
task stsdas.pkg = stsdas$stsdas.cl

reset helpdb = "lib$helpdb.mip\
,noao$lib/helpdb.mip\
,tables$lib/helpdb.mip\
,stsdas$lib/helpdb.mip\
"
keep

!!! Copy the missing text and uncomment existing but leave exactly the same spaces as in the original extern.pkg file - copy and paste blank fields (I cannot mimic that here) !!!

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!