View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Creating image sections using imcopy within script

smp wrote on Oct 21, 2008

hi,
I want to do following:
In following segment of a 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 
           :



please help.

regards

Francisco Valdes wrote on Oct 21, 2008

It seems to me you have the files backward, your input should be "@"//newfile2 and your output should "@"//newfile1. (The second error is because you don't have the "@" for the input file). What you want to have for an imcopy after expanding the names and @files is

imcopy abc[1:1084,*] newabc


In other words, the input has the image section but the output does not. The only time you use an image section on output is when copying into a section of an existing image in which case the sizes of the input and output must match.

Yours,
Frank Valdes

Last post on Oct 21, 2008