Yah. I'm slammed but here's a quick comment. PGPLOT uses single
precision only. If you need more than
about five significant figures to distinguish the max and min of the
plot range, PGPLOT gets confused and plots
garbage on the axis. Independently, differences that are less than
about 1e-5 of the base value can't
be plotted reliably. You can fix the axes by specifying a range as in
$w->points($x,$y,{yr=>[0.9,1.1]});
If you tighten up the limits, say to [0.99999,1.00001] you will begin
to see the roundoff error (from converting to float) in the plotted
points. If you tighten them by another couple of orders of magnitude
(say to [0.9999999,1.0000001]), then you can manually break the PGPLOT
axis printing.
On Jan 31, 2008, at 11:59 AM, Xavier Calbet wrote:
> OK then.
>
> PGPLOT apparently gets confused if all the values in one dimension
> are exactly the same, because it cannot find a minimum and a maximum
> to fit the axis to. This normally is plotted correctly (or exits
> with an error
> if I remember correctly)
> but in your case it does not and it plots the points incorrectly.
> I think this looks like a bug in PGPLOT (or the functions that call
> it).
>
> To circumvent it you can call the env environment before plotting:
>
> perldl> $w->env(min($x),max($x),0,2)
>
> perldl> $w->points($x,$y)
>
> Hope this helps ;=)
>
> Xavier
>
>
>
>
> On Jan 31, 2008 4:11 PM, Sebastian Perez <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>>
>> BITPIX = -32 is a valid value and just means that the array is
>> represented as IEEE 32-bit floating point values, so that shouldn't
>> be a problem.
>>
>> Cheers,
>> Seb
>>
>>
>>
>> On 31 Jan 2008, at 14:59, Xavier Calbet wrote:
>>
>>> 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
>>
>>
>
> _______________________________________________
> 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