Welcome to iraf.net Tuesday, May 07 2024 @ 10:33 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Host CL Scripting not working
   
iaa
 01/21/2014 01:10PM (Read 4449 times)  
+----
Newbie

Status: offline


Registered: 02/14/2011
Posts: 11
I have read all the forum posts on host CL scripting, as well as the web page at http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html, but still cannot get it to work on my machine. I think that I have defined the correct environment variables and used the executable that I should. After two days trying to find a solution I am absolutely clueless as to how to proceed. Hopefully somebody will be able to point me in the right direction? Any help would be much appreciated.

The script:

PHP Formatted Code
images                                                                                                                                
util                                                                                                                                  
                                                                                                                                       
real mean                                                                                                                              
string path                                                                                                                            
string area                                                                                                                            
string output                                                                                                                          
                                                                                                                                       
mkdir 112_o                                                                                                                            
printf ("mkdir: created directory `112_o'\n")                                                                                          
printf ("\n")                                                                                                                          
                                                                                                                                       
path = "/data/120104/NGC2264_0001.fits"                                                                          
area = "[2069:2166,2:2047]"                                                                                                            
output = "112_o/NGC2264_0001_o.fits"                                                                                                      
imstat (path // area, fields='mean', format=no) | scan(mean)                                                                          
imarith (path, "-", mean, output)                                                                                                      
printf ("%s - %.5f = %s\n", path, mean, output)                                                                                        
 


Run from within IRAF, it works as expected:

PHP Formatted Code
iaa@csic:~/util$ cl
Warning: no login.cl found in login directory
      dataio      gemini      lists       plot        stsdas      xdimsum
      dbms        gmisc       mscred      proto       system      
      fitsutil    images      noao        rvsao       tables      
      fuzzy       language    obsolete    softools    utilities  

ecl> cl < script.cl
mkdir: created directory `112_o'

/data/120104/NGC2264_0001.fits - 84.18766 = 112_o/NGC2264_0001_o.fits
ecl>


However:

PHP Formatted Code
iaa@csic:~/util$ export iraf=/iraf/iraf/
iaa@csic:~/util$ export arch=.linux
iaa@csic:~/util$ export IRAFARCH=linux
iaa@csic:~/util$ export IRAFBIN=/iraf/iraf/bin.linux/
iaa@csic:~/util$ export mach=linux
Warning: no login.cl found in login directory
      dataio      gemini      lists       plot        stsdas      xdimsum
      dbms        gmisc       mscred      proto       system      
      fitsutil    images      noao        rvsao       tables      
      fuzzy       language    obsolete    softools    utilities  

ecl>       chpixtype     imdelete      imheader      imslice       listpixels
      hedit         imdivide      imhistogram   imstack       minmax
      hselect       imexpr        imjoin        imstatistics  nhedit
      imarith       imfunction    imrename      imsum         sections
      imcopy        imgets        imreplace     imtile        

imutil>       curfit    entab     polyfit   surfit    ucase    
      detab     lcase     split     translit  urand    

utilities> utilities> utilities> utilities> utilities> utilities> utilities> ERROR: Cannot make directory (112_o)^G
utilities> mkdir: created directory `112_o'
utilities>
utilities> utilities> utilities> utilities> utilities>
PANIC in `/iraf/iraf/bin.linux/x_images.e'
: Memory has been corrupted
utilities> mean: ERROR: Parameter value is out of range; try again
mean: ERROR: Parameter value is out of range; try again
mean: ERROR: Parameter value is out of range; try again
mean: ERROR: Parameter value is out of range; try again
mean: ERROR: Parameter value is out of range; try again
mean: ERROR: Parameter value is out of range; try again
mean: ERROR: Parameter value is out of range; try again


If I follow this advice and add "ulimit -s unlimited" to my Bash environment, the script runs successfully, but the output is full of error messages. I am afraid this is symptomatic that there is something I am not doing correctly.

PHP Formatted Code
iaa@csic:~/util$ /iraf/iraf/bin.linux/ecl.e < script.cl
Warning: no login.cl found in login directory
      dataio      gemini      lists       plot        stsdas      xdimsum
      dbms        gmisc       mscred      proto       system      
      fitsutil    images      noao        rvsao       tables      
      fuzzy       language    obsolete    softools    utilities  

ecl>       chpixtype     imdelete      imheader      imslice       listpixels
      hedit         imdivide      imhistogram   imstack       minmax
      hselect       imexpr        imjoin        imstatistics  nhedit
      imarith       imfunction    imrename      imsum         sections
      imcopy        imgets        imreplace     imtile        

imutil>       curfit    entab     polyfit   surfit    ucase    
      detab     lcase     split     translit  urand    

utilities> utilities> utilities> utilities> utilities> utilities> utilities> utilities> mkdir: created directory `112_o'
utilities>
utilities> utilities> utilities> utilities> utilities> utilities> utilities> /data/120104/NGC2264_0001.fits - 84.18766 = 112_o/NGC2264_0001_o.fits
utilities>       chpixtype     imdelete      imheader      imslice       listpixels
      hedit         imdivide      imhistogram   imstack       minmax
      hselect       imexpr        imjoin        imstatistics  nhedit
      imarith       imfunction    imrename      imsum         sections
      imcopy        imgets        imreplace     imtile        

imutil>       dataio      gemini      lists       plot        stsdas      xdimsum
      dbms        gmisc       mscred      proto       system      
      fitsutil    images      noao        rvsao       tables      
      fuzzy       language    obsolete    softools    utilities  

ecl> ERROR: use `logout'
to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout'
to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout'
to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout'
to log out of the CL
ecl> ERROR: use `logout' to log out of the CL


Does anybody know what I am doing wrong? Would it be possible to get the script to run cleanly?

 
Profile Email
 Quote
fitz
 01/22/2014 09:33PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
The quick answer to your question is that you should put the following as the first line of the script and them make it executable:

#!/iraf/iraf/bin.linux/ecl.e -f

and then execute as

% ./script.cl

rather than with the redirection. Note the '-f' flag is required to suppress the need for a login.cl file.

The reason that you see the prompts and other output is because of the redirection, i.e. the CL output is as if you had typed each command at the prompt. The reason you might be seeing the "use 'logout' to log out" messages is sometimes in cases where the script file isn't properly terminated with a newline or EOF (as can sometimes happen with emacs or certain editors), however in this case I think it is simply because you don't have an explicit 'logout' command in the script. The ulimit command is in the 'cl' startup command script but again you aren't using this and so should be in your normal shell environment as you've done.

 
Profile Email
 Quote
iaa
 01/28/2014 06:19PM  
+----
Newbie

Status: offline


Registered: 02/14/2011
Posts: 11
Thanks so much, fitz. My IRAF scripts are working now.

Just to confirm — are all of the following environment variables needed for host CL scripts to work? They seem to do the trick on the two machines on which I have tested the scripts to far, but I would like to make sure they are completely portable (provided they are run on systems with the same architecture and IRAF installation path).

export iraf=/iraf/iraf/
export arch=.linux64
export IRAFARCH=linux64
export IRAFBIN=/iraf/iraf/bin.linux64/
export MACH=linux64


Am I missing anything / any unnecessary variable?

Thanks again for such superb support.

 
Profile Email
 Quote
fitz
 01/28/2014 06:25PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040

The "normal" development environment requires only something like

setenv iraf /iraf/iraf/ <--- remember the trailing '/'
setenv IRAFARCH linux
source $iraf/unix/hlib/irafuser.csh

or the equivalent for a Bash shell, the 'irafuser.[c]sh' script defines all additional variables. In your example you probably don't explicityly need IRAFBIN or MACH, however the 'arch' should be set for host CL scripts since this is normally defined in the CL startup command (as ".$IRAFARCH"Wink, likewise for the ulimit command.

 
Profile Email
 Quote
iaa
 01/29/2014 09:30AM  
+----
Newbie

Status: offline


Registered: 02/14/2011
Posts: 11
Thanks so much.

 
Profile Email
 Quote
   
Content generated in: 0.27 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