Skip to content

Commit

Permalink
Fix two bugs related to reading RICE-compressed FITS images.
Browse files Browse the repository at this point in the history
1) The NAXIS* keywords were not replaced with their
ZNAXIS* equivalents, so the NAXIS fields in the header were incorrect.

2) The Z*, TFIELDS, TTYPE*, and TFORM* keywords were deleted from
the wronge header object, so the header of the returned piddle
still had those fields present.
  • Loading branch information
d-lamb committed May 5, 2016
1 parent 418b592 commit 45f72f1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions IO/FITS/FITS.pm
Expand Up @@ -1512,9 +1512,16 @@ sub _rfits_unpack_zimage($$$) {
}
}

# Copy the ZNAXIS* keywords to NAXIS*
foreach (grep /^NAXIS/,keys %$hdr){
if (exists($hdr->{'Z'.$_}) && defined($hdr->{'Z'.$_})){
$hdr->{$_} = $hdr->{'Z'.$_};
}
}

# Clean up the ZFOO extensions and table cruft
for my $k(keys %{$pdl->hdr}) {
delete $pdl->hdr->{$k} if(
for my $k(keys %{$hdr}) {
delete $hdr->{$k} if(
$k=~ m/^Z/ ||
$k eq "TFIELDS" ||
$k =~ m/^TTYPE/ ||
Expand Down

0 comments on commit 45f72f1

Please sign in to comment.