| Version 12 (modified by , 20 years ago) ( diff ) |
|---|
PyRAF
PyRAF is a new command language for running IRAF tasks that is based on the Python scripting language. It gives users the ability to run IRAF tasks in an environment that has all the power and flexibility of Python. PyRAF can be installed along with an existing IRAF installation; users can then choose to run either PyRAF or the IRAF CL.
More information can be found here. The current release of PyRAF is v1.2 and can be downloaded from here. The release notes can be found here.
Required Supporting Packages As a convenience all supporting packages are available [http://www.stsci.edu/resources/software_hardware/pyraf/support_stsci_python/ here]. For our purposes, all packages were available via apt-get. If you haven't installed all supporting packages, we suggest that you follow the order in which they are listed below: * IRAF * TABLES/STSDAS v3.4 * Tcl/Tk - v8.3 or higher * Readline * Python - v2.3 or higher (with readline and _tkinter modules enabled) * Numeric - v23.8 * libf2c (Note: the package on our web site has a change that allows it to work on 64bit Linux platforms) * Pmw 1.2 Some platforms have most of these packages already installed in their system directories. To test whether your Python installation has all modules needed, start Python and try to import them: %python >>>import readline >>>import Tkinter >>>Tkinter._test() >>>import Numeric >>>import Pmw iraf@metis% python Python 2.4.2 (#2, Sep 30 2005, 21:19:01) [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import readline >>> import Tkinter >>> Tkinter._test() >>> import Numeric >>> import Pmw If you don't get an ImportError, this means that Tcl, Tk, Readline, Python, Numeric and Pmw are already installed on the system. '''Readline5:''' cdelacruz@metis:~$ sudo apt-get install libreadline5 cdelacruz@metis:~$ sudo apt-get install libreadline5-dev '''Numeric:''' cdelacruz@metis:~$ sudo apt-get install python2.4-numeric cdelacruz@metis:~$ sudo apt-get install python2.4-numeric-ext In addition Pydrizzle/Multidrizzle require: '''Pmw:''' cdelacruz@metis:~$ sudo apt-cache search Pmw python-pmw - Pmw -- Python MegaWidgets python-pmw-doc - Pmw -- Python MegaWidgets cdelacruz@metis:~$ cdelacruz@metis:~$ sudo apt-get install python-pmw cdelacruz@metis:~$ sudo apt-get install python-pmw-doc '''libf2c:''' f2c - A FORTRAN 77 to C/C++ translator, plus static & shared libs. fort77 - Invoke f2c like a real compiler cdelacruz@metis:~$ sudo apt-get install python2.4-tk
PyRAF Installation:
Create directory, /usr/local/pyraf/, and uncompress source: cdelacruz@metis:/usr/local/pyraf$ sudo tar xf stsci_python_v2.2.tar iraf@metis% tar -xf stsci_python_v2.2.tar cdelacruz@metis:/usr/local/pyraf$ su iraf Numarray Installation: metis:/usr/local/pyraf> cd stsci_python/numarray-1.4.1 metis:/usr/local/pyraf/stsci_python/numarray-1.4.1> python metis:/usr/local/pyraf/stsci_python/numarray-1.4.1> sudo python setup.py config install --gencode metis:/usr/local/pyraf/stsci_python> sudo python setup.py install --with-f2c=/usr/bin/ ***Try using: carlos@phobos:/usr/local/pyraf/stsci_python$ sudo python setup.py install --with-f2c=/usr/local/pyraf/stsci_python/libf2c/ apt-get install python2.4-dev sudo apt-get install python2.4-numarray python-numarray-doc PyRAF Setup After a default installation the pyraf startup script is located in the same directory with the python executable, so this directory has to be on the search path. Modify the environment variable $PATH if necessary. If the software was installed in a personal directory, with either "--home=" or "--prefix=", then the startup script is located in /bin. If "--local=", then pyraf's startup script is in /pyraf. In order to run PyRAF conveniently, you can define an alias or create a symbolic link to the startup script. %alias pyraf <install_dir>/bin/pyraf %cd /usr/local/bin (or some other directory on PATH) %ln -s /bin/pyraf pyraf Note for Linux users: There is a problem running iraf on some Linux systems (Fedora, RHEL, possibly others). Quote from the iraf web site: " Specifically, pointers allocated in the normal course of a task may occasionally be at an address outside the user's per-process stack space, resulting in a "memory has been corrupted" or "segmentation violation" error. The workaround is to remove the stacksize limit in the user's shell with a command such as: %limit stacksize unlimited # for tcsh users %ulimit -s unlimited # for bash users As a preventive measure against this problem, the CL startup script was modified to implement this change and so most users who only use IRAF from the CL will not need to take any special action." PyRAF does not use the CL start up script, so you will need to have this command in your unix start up files (for example ~/.login). Testing The Installation After you finish the installation of all packages, you can run the script stsci_python/test22.py to check the integrity and version compatibility of the installation. Note: This script must be run from a directory other than stsci_python, for example your home directory. %cp stsci_python/test22.py ~ %cd %python test22.py
=Alternate Installation/Testing=
IRAF/PYRAF errors:
(1) Testing the installed redhat binairies (instead of compiling):
tv> display pat4.fits
ERROR: Cannot open device (node!imtool,,512,512)
cdelacruz@metis:~$ pyraf
setting terminal type to ...
xgterm ncols=80 nlines=40
NOAO PC-IRAF Revision 2.12.2a-EXPORT Wed Jul 14 20:45:34 MST 2004
This is the EXPORT version of PC-IRAF V2.12 supporting most PC systems.
Welcome to IRAF. To list the available commands, type ? or ??. To get
detailed information about a command, type `help command'. To run a
command or load a package, type its name. Type `bye' to exit a
package, or `logout' to get out of the CL. Type `news' to find out
what is new in the version of the system you are using. The following
commands or packages are currently defined:
clpackage/:
apropos images/ obsolete/ stsdas/ utilities/
clpackage/ language/ plot/ system/
dataio/ lists/ proto/ tables/
dbms/ noao/ softools/ user/
PyRAF 1.2 (2005Nov01) Copyright (c) 2002 AURA
Python 2.4.2 Copyright (c) 2001-2005 Python Software Foundation.
Python/CL command line wrapper
.help describes executive commands
--> images
--> tv
--> display pat4.fits
PANIC in `/usr/local/iraf/iraf/bin.linux/x_tv.e': Memory has been corrupted
Killing IRAF task `display'
Traceback (innermost last):
File "<CL script CL1>", line 1, in ?
iraf.display('pat4.fits', _save=1)
IrafError: Error running IRAF task display
('Not a legal IRAF pipe record', 32, 'Broken pipe')
-->
Issued the following command at prompt:
limit stacksize unlimited (for csh)
ulimit -s unlimited (for bash)
--> display pat4.fits
Killing IRAF task `display'
Traceback (innermost last):
File "<CL script CL1>", line 1, in ?
iraf.display('pat4.fits', _save=1)
IrafError: Error running IRAF task display
IRAF task terminated abnormally
ERROR (742, "Cannot open device (node!imtool,,512,512)")
-->
Solution was to install the ds9 binary, 4.0b8. As far as x11iraf is concerned, if needed, use the redhat binaries; run the install script but modify the directory names (redhat >>> linux).
For Pyraf installation, downloaded all dependant packages from [http://www.stsci.edu/resources/software_hardware/pyraf/current/support_pyraf here].
libf2c.tar
Numeric-23.8.tar
Pmw.1.2.tar
Python-2.3.4.tar
readline-4.3.tar
stsci_python_v2.2.tar
tcl8.3.5-src.tar
tk8.3.5-src.tar
(1) created a directory under /usr/local/pyraf
(2) Copied and extracted all packages to the pyraf directory
(3) created a directory where all compiled binaries will be installed:
/usr/local/pyraf/install
(4) compile and install tcl:
gunzip -d tcl8.3.5-src.tar.gz
tar xvf tcl8.3.5-src.tar
cd tcl8.3.5/unix
./configure --enable-shared --prefix=/usr/local/pyraf/install
make
make install
(5) Compile and install Tk:
gunzip -d tk8.3.5-src.tar.gz
tar xvf tk8.3.5-src.tar
cd tk8.3.5/unix
./configure --enable-shared --prefix=/usr/local/pyraf/install
make
make install
(6) Install readline:
gunzip -d readline-4.3.tar.gz
tar xvf readline-4.3.tar
cd readline-4.3
./configure --prefix=/usr/local/pyraf/install
make
make install
(7) Install Python
gunzip -d Python-2.3.4.tar.gz
tar xvf Python-2.3.4.tar
cd Python-2.3.4
./configure --prefix=/usr/local/pyraf/install
edit /Python-2.3.4/Modules/Setup
# *** Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
-L/usr/local/pyraf/install/lib \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
-I/usr/local/pyraf/install/include \
# *** Uncomment and edit to reflect where your X11 header files are:
-I/usr/X11R6/include \
# *** Or uncomment this for Solaris:
# -I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
# -DWITH_TIX -ltix8.1.8.2 \
# *** Uncomment and edit for BLT extension only:
# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
# (See http://www.pythonware.com/products/pil/ for more info)
# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
# *** Uncomment and edit for TOGL extension only:
# -DWITH_TOGL togl.c \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
-ltk8.3.5 -ltcl8.3.5 \
# *** Uncomment and edit to reflect where your X11 libraries are:
-L/usr/X11R6/lib \
# *** Or uncomment this for Solaris:
# -L/usr/openwin/lib \
# *** Uncomment these for TOGL extension only:
# -lGL -lGLU -lXext -lXmu \
# *** Uncomment for AIX:
# -lld \
# *** Always uncomment this; X11 libraries to link with:
-lX11
make
make install
(8) Install Numeric:
gunzip -d Numeric-23.8.tar.gz
tar xvf Numeric-23.8.tar
cd Numeric-23.8
/usr/local/pyraf/install/bin/python setup.py install
(9) Install Pmw
gunzip -d Pmw.1.2.tar.gz
tar xvf Pmw.1.2.tar
cp -r /usr/local/pyraf/Pmw. .
(10) Install libf2c:
gunzip -d libf2c.tar.gz
tar xvf libf2c.tar
cd libf2c
make -f makefile.u
(11) Install Pyraf:
gunzip -d stsci_python_v2.2.tar.gz
tar xvf stsci_python_v2.2.tar
cd stsci_python/
mkdir libf2c
cp ../libf2c/f2c.h libf2c/
cp ../libf2c/libf2c.a libf2c/
cd /numarray-1.4.1
/usr/local/pyraf/install/bin/python setup.py install --with-f2c=/usr/local/pyraf/stsci_python/libf2c
(12) Add path '/usr/local/pyraf/install/bin/python' to PATH.
Note:
See TracWiki
for help on using the wiki.
