Welcome to iraf.net Saturday, May 11 2024 @ 01:30 PM GMT
taylor |
04/14/2017 08:20PM (Read 2535 times)
|
|
|
Status: offline
Registered: 04/14/2017
Posts: 3
|
Hi all,
I am new to IRAF scripting and I have a problem regarding implementing IRAF tasks into a shell script. The script should work with fits files and is very simple, but it has to use IRAF tasks together with bash. The script is as follows:
for i in $( ls ???.fits )
do
rename s/.....$// $i
done
for i in $( ls ??? )
do
mv $i "$i"_6.fits
done
How can I add the cl commands like imcopy (at the beginning of the script) ) and imarith (at the end), so I could run them from bash?
Thanks!!
|
|
|
|
fitz |
04/25/2017 04:06PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
IRAF commands are intended to be run from the CL interface since that is what handles things like parameter passing, graphics rendering, etc. IRAF scripts *can* be executed as host level commands (see http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html) and for a simple script such as your example it may be easier to write a CL script than to try to call IRAF binaries directly.
You can call IRAF tasks from unix so long as you know the path to the binary containing the task and can supply the parameters, however this doesn't usually work well for any graphics or interactive tasks or tasks which require iraf environment variables (e.g. the "dev$pix" test image won't resolve the 'dev$' part of the path normally). For example, to run IMCOPY you could use the command:
/iraf/iraf/bin.linux64/x_images.e imcopy input=foo.fits output=bar.fits verbose=no
For tasks with many parameters it is easier to supply the params using the @-file syntax, e.g. in the CL you can dump the params with:
cl\$this->_split2($m[0]) dpar imcopy \$this->_split2($m[0]) imcopy.par
Then edit the 'imcopy.par' file with your values and execute the task as
/iraf/iraf/bin.linux64/x_images.e imcopy @/path/imcopy.par
where you would substitute the iraf path and architecture name appropriate for y
our system.
Information on CL scripting can be found at https://iraf.net/irafdocs/script/
|
|
|
|
taylor |
06/14/2017 01:29AM
|
|
|
Status: offline
Registered: 04/14/2017
Posts: 3
|
Thanks a lot!
|
|
|
|
| |
|
Content generated in: 0.10 seconds |
|