Welcome to iraf.net Friday, March 29 2024 @ 05:19 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Bash shell calling IRAF
   
accrama
 05/19/2014 02:42PM (Read 3015 times)  
+----
Newbie

Status: offline


Registered: 01/21/2014
Posts: 4
Hi. If this has been addressed before I did not find it.
I am on a MAC 10.9.3 Mavericks computer.

According to the internet I can call a IRAF task by doing
% $iraf/bin.sparc/x_images.e listpix @listpix.par


I have my parameters in *.par files, for example:
for i in "${f[@]}"; do
cat \$this->_split2($m[0])${path}/${cluster}/objmask_${i}.par <<EOL
objmasks.images = "s${cluster}_F${i}.fits"
objmasks.objmasks = "s${cluster}_$F{i}.mask"
objmasks.omtype = "boolean"
objmasks.skys = ""
objmasks.sigmas = ""
objmasks.masks = "!BPM"
objmasks.extnames = " "
objmasks.logfiles = "STDOUT"
objmasks.blkstep = 1
objmasks.blksize = 10
objmasks.convolve = "block 11 11"
objmasks.hsigma = 1.
objmasks.lsigma = 10.
objmasks.hdetect = yes
objmasks.ldetect = no
objmasks.neighbors = "4"
objmasks.minpix = 2
objmasks.ngrow = 2
objmasks.agrow = 2.
objmasks.mode = "al"
# EOF
EOL
cat ${path}/${cluster}/objmask_${i}.par; done


I then try to run the OBJMASK routine, which is part of NPROTO:
for i in "${f[@]}"; do /iraf/iraf/bin.macintel/x_nproto.e objmasks > @objmask_${i}.par; done


The shell then outputs nothing.

I then try to get into the task OBJMASK through the Bash shell.
I do
$ ./x_nproto.e

This works well, but when I put
\$this->_split2($m[0])objmask

they shell complains with
\$this->_split2($m[0])ERROR (0, "Iraf Main: Unknown task name (objmasks)")



Do you have any ideas?

The command is given in the correct folder holding x_nproto.e. Task OBJMASK exists in x_nproto.e although nproto.cl says that

ask objmasks = "nproto$ace/objmasks.cl"


Is $ace doing something funny here?

Thank you Big Grin

 
Profile Email
 Quote
fitz
 05/19/2014 03:20PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
OBJMASKS is a CL script, not a compiled task. It is a simple convenience task that only calls DETECT so your approach would work if you called the DETECT task instead, but you'll need to use the full set of parameters for DETECT (see nproto$objmask.cl to see how it is called).

See also http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html for a description of how you can write a host-callable CL-script.

 
Profile Email
 Quote
accrama
 05/20/2014 01:03PM  
+----
Newbie

Status: offline


Registered: 01/21/2014
Posts: 4
I have tried using the CL_HOST instructions but I don't get them.
I am using BASH Shell and simply don't get how the script is started.

#!/iraf/iraf/bin.macintel/cl.e -f

will obviously do nothing because a source script in Bash starting with # will be read as a comment.

#!/iraf/iraf/bin.macintel/cl.e -f
set iraf=/iraf/iraf/
set arch=.macintel
set IRAFARCH=macintel
set IRAFBIN=/iraf/iraf/bin.macintel/
set MACH=macintel
set tfred=/iraf/iraf/TFRED2/
tfred
images
tv
display A383_F105.fits
logout
# EOF
EOL


Quote by: fitz

OBJMASKS is a CL script, not a compiled task. It is a simple convenience task that only calls DETECT so your approach would work if you called the DETECT task instead, but you'll need to use the full set of parameters for DETECT (see nproto$objmask.cl to see how it is called).

See also http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html for a description of how you can write a host-callable CL-script.


 
Profile Email
 Quote
fitz
 05/20/2014 01:57PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
It's a property of shells that '#' is a comment, but "#!' (when it is the first line) invokes a new interpreter. In this case the first line means that the cl.e binary should be the interpreter used to run the script, replacing the calling Bash shell.

This means that the script must be valid for whichever interpreter is called. In your script I notice for instance that you set a 'tfred' variable, but don't declare it as a task prior to calling it as a task. In the case of #!cl scripts the normal login.cl initialization isn't used so environment definitions and package loading must be done in each script file.

Use of #!cl was only a suggestion as an alternative to handle the loop processing, you can continue to use Bash if you prefer.

 
Profile Email
 Quote
accrama
 05/20/2014 01:59PM  
+----
Newbie

Status: offline


Registered: 01/21/2014
Posts: 4
Thank you for your time and help. Smile

 
Profile Email
 Quote
   
Content generated in: 0.17 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login