converting from .imh to .fits
Philip Massey wrote on May 21, 2007
Mike, et al---
Sorry to ask such a simple question, but this one has been confused. I have
a bunch of old blah.ms.imh files, and I'd like to convert these to fits
(blah.ms.fits). So I did the following:
files *%.imh%% > old
imrename @old//.imh @old//.fits
Much to my surprise, it tried to rename blah.imh.ms (!) to blah.fits.ms:
Warning: cannot rename `d0066.imh.ms' -> `d0066.fits.ms'
Warning: cannot rename `d0067.imh.ms' -> `d0067.fits.ms'
Warning: cannot rename `d0068.imh.ms' -> `d0068.fits.ms'
and so on...
Sorry to ask such a basic question, but I found this behavior...surprising.
I'm running 2.12.2. This specific example came from a red hat 9 installation.
thanks,
phil
Sorry to ask such a simple question, but this one has been confused. I have
a bunch of old blah.ms.imh files, and I'd like to convert these to fits
(blah.ms.fits). So I did the following:
files *%.imh%% > old
imrename @old//.imh @old//.fits
Much to my surprise, it tried to rename blah.imh.ms (!) to blah.fits.ms:
Warning: cannot rename `d0066.imh.ms' -> `d0066.fits.ms'
Warning: cannot rename `d0067.imh.ms' -> `d0067.fits.ms'
Warning: cannot rename `d0068.imh.ms' -> `d0068.fits.ms'
and so on...
Sorry to ask such a basic question, but I found this behavior...surprising.
I'm running 2.12.2. This specific example came from a red hat 9 installation.
thanks,
phil
Michael Weber wrote on May 21, 2007
Why not use wfits?
Michael
Michael
Philip Massey wrote on May 21, 2007
I would have said because wfits won't preserve the old file name. But
actually there's a different problem with that approach:
cl> wfits @old @old
Image 1: a0053.msError writing file: a0053.ms.fits
Warning: Ambiguous image name (a0053.ms)
If instead, I try
wfits @old//.imh @old
I'm left with the original problem:
cl> wfits @old//.imh @old
Image 1: a0053.imh.msError writing file: a0053.ms.fits
Warning: Cannot open image (a0053.imh.ms)
It is attempting to append the file type BEFORE the .ms.
(old contains "a0053.ms")
actually there's a different problem with that approach:
cl> wfits @old @old
Image 1: a0053.msError writing file: a0053.ms.fits
Warning: Ambiguous image name (a0053.ms)
If instead, I try
wfits @old//.imh @old
I'm left with the original problem:
cl> wfits @old//.imh @old
Image 1: a0053.imh.msError writing file: a0053.ms.fits
Warning: Cannot open image (a0053.imh.ms)
It is attempting to append the file type BEFORE the .ms.
(old contains "a0053.ms")
Mike Fitzpatrick wrote on May 21, 2007
Hi Phil,
Two problems with this: For image templates the use of "@foo//.fits" appears logical but in fact the ".fits" is not appended to each entry in the @foo file the way you'd expect. Prepending to an @file is permitted however, you'd need to set the 'imtype' to force the output image extension. Second, IMRENAME won't convert the image type, it uses the image kernel to do the renaming and one kernel doesn't know about any others.
A better approach would be to use IMCOPY to change the format with the extension, and to avoid the 'ambiguous filename' message (because there's then a foo.imh and a foo.fits in the same dir), copy to/from a different directory. For example,
will do what you originally intended, or to use the @file create it with the root filenames and then copy and global edit so you have a file with the proper extensions and directories.
Cheers,
-Mike
Two problems with this: For image templates the use of "@foo//.fits" appears logical but in fact the ".fits" is not appended to each entry in the @foo file the way you'd expect. Prepending to an @file is permitted however, you'd need to set the 'imtype' to force the output image extension. Second, IMRENAME won't convert the image type, it uses the image kernel to do the renaming and one kernel doesn't know about any others.
A better approach would be to use IMCOPY to change the format with the extension, and to avoid the 'ambiguous filename' message (because there's then a foo.imh and a foo.fits in the same dir), copy to/from a different directory. For example,
cl> imcopy *.ms.imh *.ms.%imh%fits%will do what you originally intended, or to use the @file create it with the root filenames and then copy and global edit so you have a file with the proper extensions and directories.
Cheers,
-Mike
Philip Massey wrote on May 21, 2007
Mike---
Worked like a charm, of course. Thank you!
---phil
Worked like a charm, of course. Thank you!
---phil
Last post on May 21, 2007