View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Assigning a file to “result” parameter of imarith

smp wrote on Oct 16, 2008

hi,

I created a file containg image names.
Now I want to assign this file to "result" parameter of imarith task.
If I do this as in the following script, I get the error:
--- Wrong number of elements in the operand lists

In my srcipt, 'flat_list' contains 5 fits images, while 'newname' contains 5 new names created through "for " loop.



procedure test (flat_list,....)
     :
     :
begin
   file newname
   int n
     :
   newname = "fl_bs"
     :
  delete(newfile)

   for(n=1;n<=5;n=n+1)
     {
       printf("fl_bs_%d.fits\n",n, >> newfile)
     }
      :
      :
     imarith(operand1=flat_list,op="-",operand2=zerocombine.output,result=newfile,verbose=no)
      :
      :
 end

 


any help?

regards

Mike Fitzpatrick wrote on Oct 16, 2008

You want the output file (and input files for that matter) to be an @-file and not just the filename. Try using something like

imarith(......, result="@"//newfile, .....)


-Mike

smp wrote on Oct 16, 2008

hi Mike,

"@"//newfile does not work

Mike Fitzpatrick wrote on Oct 16, 2008

Did you do it for the input files as well? Here's a working example of what I meant:


procedure zz()

begin
    file infile, outfile

    infile = "/tmp/in" ; delete (infile,ver-)
    outfile = "/tmp/out" ; delete (outfile,ver-)

    for (i=0; i < 5; i=i+1) {
        print ("dev$pix", >> infile)
        printf ("out%d\n", i, >> outfile)
    }

    imarith (operand1="@"//infile,op="-",operand2="@"//infile,
        result="@"//outfile)
end

smp wrote on Oct 16, 2008

I think I did something wrong: I mean when I re-tried the


imarith(operand1=flat_list,op="-",operand2=zerocombine.output,result="@"//newfile,verbose=no)


It worked.
i.e. without using "@"//flat_list instead of flat_list for the input operand1 only.

But If I use "@"//flat_list for the input operand1, I get the error:
----cannot open the file.
Why is it so?

Mike Fitzpatrick wrote on Oct 16, 2008

It probably means that either some file in the list doesn't exist, or that the list file itself can't be found.

smp wrote on Oct 16, 2008

Now I want to do this:

In following segment of the procedure script,
newfile1 is a file which contains 5 image names.
newfile2 is a file which will contain image section [1:1084,*] of each of 5 images from file newfile1.
I am using imcopy task for this.
But I get the error :
Can't open file
if I do following:


           :
           :
           :
 for(n=1;n<=5;n=n+1)
   {
     printf("left_%d.fits\n", n ,  >> newfile2)          # creating new image names
   }

imcopy(input="@"//newfile1//"[1:1084,*]", output="@"//newfile2, v-)  # divide image into 2 halves



And I get following error:
Number of output and input images not same
if do the following:


           :
           :
           :
 for(n=1;n<=5;n=n+1)
   {
     printf("left_%d.fits\n", n ,  >> newfile2)          # creating new image names
   }

imcopy(input=newfile1//"[1:1084,*]", output="@"//newfile2, v-)  # divide image into 2 halves



what do I do?

Last post on Oct 16, 2008