MAX function in IDL8.0 [message #72777] |
Fri, 08 October 2010 06:25 |
Anne Martel
Messages: 10 Registered: May 1995
|
Junior Member |
|
|
I was happy to see that the new version of IDL includes a DIMENSION
keyword for the max function but I don't understand why the
max_subscript feature returns indices relative to the whole array,
rather than the index in the dimension specified. A simple example to
illustrate this:
If I create a 2D array q:
q=[[1,4,3,2,7,0],[2,4,1,3,4,1]]
and run
IDL> print,q
1 4 3 2 7 0
2 4 1 3 4 1
IDL> marr = max(q,ind,dim=2)
The returned max array is as expected:
IDL> print,marr
2 4 3 3 7 1
The max_subscripts are
IDL> print,ind
6 1 2 9 4 11
but what i would prefer is the subscripts in the 2nd dimension
IDL> print,ind/6
1 0 0 1 0 1
In this example it is trivial to convert to what I want but if, for
example I want to generate a time to peak map from a dynamic sequence of
images , or return the most likely class from a stack of probability
maps, then I still have to write a procedure to do this.
Can anyone think of some example where the way max_subscript is
implemented is superior or should I just campaign for a modification in
some future release?
Anne
|
|
|