Re: change in histogram [message #12410] |
Wed, 29 July 1998 00:00 |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Actually, all these behaviors also exist in IDL/v4.0.1, so they're not new.
By the way, the statement
> IDL> help,histogram( findgen(100),binsize=0.5 )
> <Expression> LONG = Array[199]
does exactly what you'd expect it to. The histogram values bounce between 1
and 0. If the array was 200 bins long, the last bin would be 0, because it
would represent the value 99.5, which isn't in the input array.
William Thompson
============================================================ ===================
Vap User <vapuser@haifung.jpl.nasa.gov> writes:
> Has there been a change to histogram in IDl 5.1? The documentation
> says that the array is searched for the min/max values if min=/max=
> keyword are missing. However, consider the following...
>
> IDL> help,histogram( bindgen(100) )
> <Expression> LONG = Array[256]
>
> which suggests it sets max to the top value possible for a byte array.
>
> IDL> help,histogram( indgen(100) )
> <Expression> LONG = Array[100]
>
> As desired.
>
>
> IDL> help,histogram( bindgen(100) + 2 )
> <Expression> LONG = Array[100]
>
> Also as desired. But stranger still, since this is effectively the case above.
>
>
> Am I missing something here?
>
> Also...
>
> Here's another oddity.
>
> IDL> help,histogram( lindgen(100),binsize=0.5 )
> % HISTOGRAM: Illegal binsize or max/min.
> % Execution halted at: $MAIN$
>
> IDL> help,histogram( lindgen(100),binsize=1.5 )
> <Expression> LONG = Array[100]
>
> IDL> help,histogram( findgen(100),binsize=0.5 )
> <Expression> LONG = Array[199]
>
> Why can't I specify a binsize of 1/2 with a interger type array? I can
> specify one of 1.5. And I can specify one of 0.5 for a floating point
> array having the same values as the integer type array.
>
> I don't recall these restriction in IDl 4.x.
|
|
|
Re: change in histogram [message #12418 is a reply to message #12410] |
Wed, 29 July 1998 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
Vap User wrote:
> Has there been a change to histogram in IDl 5.1? The documentation
> says that the array is searched for the min/max values if min=/max=
> keyword are missing. However, consider the following...
[snipped some code examples]
Converting the HISTOGRAM array argument to FLOAT has helped me deal with
some strange behavior I've seen when dealing with INTEGER arguments in
IDL 5.1.
Here's what I do:
;- Get image minimum and maximum
MinValue = MIN( Image, Max = MaxValue )
;- Check image range
IF MinValue LT MaxValue THEN MESSAGE, 'Image values are all the same'
;- Define number of points used in constructing histogram
Points = 100
;- Compute histogram
HistData = HISTOGRAM( FLOAT( Image ), MIN = MinValue, MAX = MaxValue, $
BINSIZE = FLOAT( MaxValue - MinValue ) / FLOAT( Points - 1 ) )
Cheers,
Liam.
|
|
|