View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

imcopy problem using sections

Philip Massey wrote on Jun 18, 2009

Hi, Mike et al---

I'm having difficulties copying a sub-array from an image using "@" files. Here is a simple example of what I mean:

ecl> imcopy rccd070315.0047.fits[96:1052,165:1020] tempa
rccd070315.0047.fits[96:1052,165:1020] -> tempa
ecl> imhead tempa
tempa[957,856][real]: Westerlund1-N
ecl> files rccd070315.0047.fits > z
ecl> imcopy @z//[96:1052,165:1020] tempb
rccd070315.0047.fits -> tempb
ecl> imhead tempb
tempb[1052,1028][real]: Westerlund1-N

Note that it ignored the range when I used the "@" file.

thanks,
phil

Mike Fitzpatrick wrote on Jun 18, 2009

Hi Phil,

The '[' and ']' chars are special to the filename template, to append a section to an @file you need to escape it. For example

cl> imcopy @z//\[96:1052,165:1020] tempb


Cheers,
-Mike

Philip Massey wrote on Jun 18, 2009

Mike,

That sounds very reasonable, but I'm still having problems. Here we go:
ecl> files rccd*.fits > all
ecl> imcopy @all//\[96:1052,165:1020] n//@all
ERROR: Number of input and output images not the same

ecl> head all
rccd070301.0081.fits
rccd070301.0082.fits
rccd070301.0083.fits
rccd070301.0084.fits
rccd070306.0083.fits

etc.

Any thoughts? If I don't include the subsection, the command works of
course:

imcopy @all// n//@all
rccd070301.0081.fits -> nrccd070301.0081.fits
rccd070301.0082.fits -> nrccd070301.0082.fits
rccd070301.0083.fits -> nrccd070301.0083.fits
rccd070301.0084.fits -> nrccd070301.0084.fits
rccd070306.0083.fits -> nrccd070306.0083.fits

thanks,
---phil

Mike Fitzpatrick wrote on Jun 18, 2009

Try a backslash in front of the comma in the section as well, i.e.

imcopy @z//\[96:1052\,165:1020] tempb


If you want to test out the template expansion like this you can use the SECTIONS task.

-Mike

Philip Massey wrote on Jun 18, 2009

Hi, Mike---

OK, that did the trick! But, I was amused at how it is listing the copy:

rccd070620.0037[96:1052,165:1020].fits -> nrccd070620.0037.fits
rccd070620.0038[96:1052,165:1020].fits -> nrccd070620.0038.fits
rccd070620.0039[96:1052,165:1020].fits -> nrccd070620.0039.fits
rccd070621.0088[96:1052,165:1020].fits -> nrccd070621.0088.fits
rccd070621.0089[96:1052,165:1020].fits -> nrccd070621.0089.fits

But, hey, it WORKED!!! THANKS!!!

Maybe this could be added to the imcopy help page? It did crack me up to
read the last line of that page:

BUGS
The distinction between copying to a section of an existing image
and overwriting a input image is rather inobvious.

So, a new word I've added to my lexicon....

Last post on Jun 18, 2009