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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data conversion of FITS images in PDL
by swl (Prior) on Aug 23, 2020 at 22:24 UTC | |
by Xilman (Hermit) on Aug 24, 2020 at 09:27 UTC | |
by etj (Priest) on Jul 30, 2021 at 20:19 UTC |