Hi, I have a program that reads in a data cube, and writes out a sigma clipped image combined along the third dimension as output.
I want to copy the FITS headers to the new image - but I'm missing something, as when I write out the new image, both IRAF and the file size indicate that I'm writing out the smaller stacked image. BUT when I reread the image back into PDL, it only sees the original data cube size. I've attached the program below, and the output from this program which shows the problem. Any suggestions as to what is the proper way to copy FITS image headers greatly appreciated :) Here's the output, then the program: # stack_cube starting... # cube input: uma01-0003.fits # stacked output: cuma01-0003.fits POINT ZERO: PDL: Double D [320,258,100] POINT ONE: PDL: Double D [320,258] POINT TWO: PDL: Double D [320,258] POINT THREE: PDL: Double D [320,258,100] # ...averaged cube image cuma01-0003.fits written. END ...and the program. #!/usr/bin/perl -w use strict; use PDL; use PDL::NiceSlice; use PDL::AutoLoader; $|=1; # stack_cube.pl # read in image my $file = $ARGV[0] || "uma01-0003.fits"; my $file_out = $ARGV[1] || "cuma01-0003.fits"; print "# stack_cube starting...\n# cube input: $file\n# stacked output: $file_out\n"; my $fin = rfits $file; my $finhdr = $fin->hdr; print "POINT ZERO: ".$fin->info()."\n"; my ($im_out,$prms,$median,$min,$max,$adev,$rms,$weights) = statsoverclip($fin->mv(-1,0), 2.0, 1); ## rejected pixels ### my $imbad = $weights->sumover; imag $imbad; wfits $imbad, "badpix.fits"; print "POINT ONE: ".$im_out->info()."\n"; $im_out->sethdr($finhdr); print "POINT TWO: ".$im_out->info()."\n"; wfits $im_out, $file_out; my $im_out_reread = rfits $file_out; print "POINT THREE: ".$im_out_reread->info()."\n"; print "# ...averaged cube image $file_out written. END\n"; -- Matthew Kenworthy / Assistant Astronomer / CAAO / Steward Observatory Room N414 / 933 N. Cherry Ave / Tucson AZ 85721 / vox 520 626 6720 _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
