Rounding errors and the New Graphics image routine [message #86040] |
Wed, 25 September 2013 12:42  |
Gordon Farquharson
Messages: 48 Registered: December 2010
|
Member |
|
|
Hi All
I'm posting this message as a reference, primarily for myself, in case I ever again find myself beating my head against the wall for several hours.
IDL> a = findgen(350,332)
IDL> x = 2000. * findgen(350) / 350.
IDL> y = 2000. * findgen(332) / 332.
IDL> p = image(a, x, y, AXIS_STYLE=2)
% Loaded DLM: PNG.
Everything is fine in IDL land so far...
IDL> x = 2000. * findgen(350) / 350. + 2.8e5
IDL> y = 2000. * findgen(332) / 332. + 3.8e6
IDL> p = image(a, x, y, AXIS_STYLE=2)
% Loaded DLM: QHULL.
% QHULL: Vector must have 350 elements: YIN
% Execution halted at: $MAIN$
WTF!
Several hours later (and many more expletives):
IDL> x = 2000. * findgen(350) / 350. + 2.8D5
IDL> y = 2000. * findgen(332) / 332. + 3.8D6
IDL> p = image(a, x, y, AXIS_STYLE=2)
IDL> p = image(a, x/1000., y/1000., AXIS_STYLE=2)
I guess I should have realized sooner that the problem would be due to a rounding error. Maybe this post will help somebody else out.
Gordon
|
|
|
Re: Rounding errors and the New Graphics image routine [message #86682 is a reply to message #86040] |
Thu, 28 November 2013 05:22  |
robseigel
Messages: 3 Registered: November 2013
|
Junior Member |
|
|
On Wednesday, September 25, 2013 3:42:59 PM UTC-4, Gordon Farquharson wrote:
> Hi All
>
>
>
> I'm posting this message as a reference, primarily for myself, in case I ever again find myself beating my head against the wall for several hours.
>
>
>
> IDL> a = findgen(350,332)
>
> IDL> x = 2000. * findgen(350) / 350.
>
> IDL> y = 2000. * findgen(332) / 332.
>
> IDL> p = image(a, x, y, AXIS_STYLE=2)
>
> % Loaded DLM: PNG.
>
>
>
> Everything is fine in IDL land so far...
>
>
>
> IDL> x = 2000. * findgen(350) / 350. + 2.8e5
>
> IDL> y = 2000. * findgen(332) / 332. + 3.8e6
>
> IDL> p = image(a, x, y, AXIS_STYLE=2)
>
> % Loaded DLM: QHULL.
>
> % QHULL: Vector must have 350 elements: YIN
>
> % Execution halted at: $MAIN$
>
>
>
> WTF!
>
>
>
> Several hours later (and many more expletives):
>
>
>
> IDL> x = 2000. * findgen(350) / 350. + 2.8D5
>
> IDL> y = 2000. * findgen(332) / 332. + 3.8D6
>
> IDL> p = image(a, x, y, AXIS_STYLE=2)
>
> IDL> p = image(a, x/1000., y/1000., AXIS_STYLE=2)
>
>
>
> I guess I should have realized sooner that the problem would be due to a rounding error. Maybe this post will help somebody else out.
>
>
>
> Gordon
Very helpful. Thanks!
|
|
|