<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class=""><font face="Helvetica, Arial, sans-serif">Hi
Pythoneers!<br>
<br>
As I needed to use some IRAF task in my python script, I thought
why not sharing with you how to that. It might save a day of
googling for you. Most of you are probably familiar with IRAF (</font><font
face="Helvetica, Arial, sans-serif">a general purpose software
system for the reduction and analysis of astronomical data).
PyRAF gives users
the ability to run IRAF tasks in their python scripts or in an
environment that has all the power and flexibility of Python.
First
of all we need IRAF on our machine. At MPE IRAF is installed as
part of the ESO scisoft. <br>
You have to run<br>
source /scisoft/bin/Setup.bash<br>
...and then you can
call IRAF separately (aka cl) or via python. <br>
<br>
Don't forget to run "mkiraf" in the folder you want to run your
python script, which will create your login.cl file,
your uparm directory, and will define system logicals and
symbols.
Otherwise, your python script can not set IRAF task's
parameters.<br>
<br>
The latest version
of PyRAF is v2.1.10 which
supports Python 2.6, 2.7, and 3.4, 3.5! The easiest
way to install it is to use pip (pip install pyraf or pip3
install pyraf). Both the pip and
pip3 install the v2.1.10 version, but to change the relevant
path so that python3 finds IRAF you need to use pip3. Finally,
you can import PyRAF as a normal
package in your python script (from pyraf
import iraf), and with
iraf.testtask() you access all the iraf tasks. <br>
You can <span class="western">set/view IRAF task parameter</span><span
class="western">s
(like R.A parameter in a task testtask)</span> : iraf.<span
class="western">testtask</span>.ra='17:45:40'<br>
<br>
That's it!<br>
Cheers,<br>
Maryam<br>
</font>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<meta name="generator" content="LibreOffice 4.2.7.2 (Linux)">
<style type="text/css">
<!--
@page { margin: 2cm }
pre.cjk { font-family: "Droid Sans Fallback", monospace }
p { margin-bottom: 0.25cm; line-height: 120% }
tt.cjk { font-family: "Droid Sans Fallback", monospace }
a:link { so-language: zxx }
-->
</style>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<meta name="generator" content="LibreOffice 4.2.7.2 (Linux)">
<style type="text/css"><font face="serif">
<!--
@page { margin: 2cm }
pre.cjk { font-family: "Droid Sans Fallback", monospace }
p { margin-bottom: 0.25cm; line-height: 120% }
tt.cjk { font-family: "Droid Sans Fallback", monospace }
a:link { so-language: zxx }
-->
</font></style></div>
</body>
</html>