Perl: the Markov chain saw | |
PerlMonks |
Data conversion of FITS images in PDLby Xilman (Hermit) |
on Aug 23, 2020 at 19:26 UTC ( [id://11121012]=perlquestion: print w/replies, xml ) | Need Help?? |
Xilman has asked for the wisdom of the Perl Monks concerning the following question: I am being stupid. Either that, or less likely, the documentation in PDL::IO::FITS is wrong. I have a FITS image in which each pixel is a 32-bit float. That is, BITPIX == -32. I wish to convert it to 32-bit fixed-point format, where BITPIX == 16. This is my script.
#! /usr/bin/perl use strict; use warnings; use PDL; use PDL::IO::FITS; my $x = rfits('foo.fits'); $x->wfits('bar.fits', 16); And here is what happens:
pcl@nut:~/Astro/Code$ imhead foo.fits | grep BITPIX BITPIX = -32 / pcl@nut:~/Astro/Code$ perl to_int.pl pcl@nut:~/Astro/Code$ imhead bar.fits | grep BITPIX BITPIX = -32 The output file is not converted to 16-bit unsigned format, despite what the documentation appears to say. What am I not understanding and how do I get data conversion?
Back to
Seekers of Perl Wisdom
|
|