One more thing, you might want to have a look at your fits header before
you write your FITS file (print $hdr->{BITPIX} maybe) just to check and
see whether you have garbage in there or not. In any case you can also
do
$hdr->{BITPIX}=32
before you write the file.
Xavier Calbet
On Jan 31, 2008 3:55 PM, Xavier Calbet <[EMAIL PROTECTED]> wrote:
> When I read your original file I get (as you do) different results
> with the plotting
> and printing. If I modify BITPIX=-32 to BITPIX=32 I get consistent results.
>
> Cheers,
>
> Xavier Calbet
>
>
> On Jan 31, 2008 3:41 PM, PAUL <[EMAIL PROTECTED]> wrote:
> > Hmmm... that does seem strange, but then looking at all the headers
> > of the FITS files I have, they all have BITPIX=-32. (Even FITS which
> > have not been hacked using PDL). Is BITPIX actually still used?
> >
> > The sub which I used to write many FITS is here:
> >
> >
> > ##################################################
> > sub WriteFits { ##################################
> > for($i=0;$i<$N_data;++$i) {
> > ($suffix) = @_;
> > $fitsname = $allnames[$i].$suffix.".fits";
> > $newpid = $new_master_data(:,:,$i);
> > $newpid = $newpid->float;
> > $minpid = min($newpid);
> > $maxpid = max($newpid);
> > $hdr->{MINVAL} = $minpid;
> > $hdr->{MAXVAL} = $maxpid;
> > $newpid -> sethdr($hdr);
> > wfits $newpid, $fitsname;
> > print "FITS file FITS/$fitsname created!\n";
> > system 'mv',$fitsname,$fitsdirectory;
> > }
> > system 'mv',$filename,$donedirectory;
> > } # Ends the WriteFits sub. ######################
> > ##################################################
> >
> > However, I've used this same routine to make hundreds of other FITS
> > in this way, and I've never seen this weird problem before!
> >
> > cheers,
> >
> > Paul
> >
> >
> >
> >
> > On 31 Jan 2008, at 14:17, Xavier Calbet wrote:
> >
> > > Don't know if it has anything to do with it, but your fits
> > > header has a value of BITPIX=-32 (negative!!!)
> > > This value is the number of bits per pixel in the image
> > > and should always be positive.
> > > If foo.fits has been written by PDL then it is strange.
> > > Can you extract the PDL code where you write this file?
> > >
> > > Xavier Calbet
> > >
> > >
> > > On Jan 31, 2008 2:58 PM, PAUL <[EMAIL PROTECTED]> wrote:
> > >> Hi,
> > >>
> > >> I've encountered a strange effect when reading a fits file in the
> > >> usual way (written with wfits, read with rfits as I usually do).
> > >>
> > >> The problem is, when I try and plot the piddle as a scatter plot
> > >> ($win->points($x,$y)) it plots completely different values than when
> > >> you simply print the piddle to the screen.
> > >> I've tried writing the data to an ASCII file using "wcols" and then
> > >> re-reading it, but this strange problem remains.
> > >>
> > >> What's going wrong? I've attached the fits file to the email.
> > >>
> > >> thanks,
> > >>
> > >> Paul
> > >>
> > >>
> > >> _______________________________________________
> > >> Perldl mailing list
> > >> [email protected]
> > >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> > >>
> > >>
> >
> >
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl