Re: Cumulative max() in *arbitrary* dimension? [message #79359] |
Fri, 24 February 2012 05:52  |
ameigs
Messages: 12 Registered: March 2009
|
Junior Member |
|
|
On Feb 23, 8:38 pm, Gianguido Cianci <gianguido.cia...@gmail.com>
wrote:
> Hi all,
>
> I would like to write a generic version of the following, which is for a 3d movie:
>
> res=movie
> s=size(res, /dim)
> FOR i = 1, s[2]-1 DO BEGIN
> res[*, *, i] = max(dim = 3, res[*, *, 0:i])
> ENDFOR
>
> So how to I generalize this to any dimension? I could make something with execute, but there's gotta be a better way. I'm on IDL7.
>
> Thanks,
> Gianguido
I am surprized that Craig Markwardt has not replied already, but here
goes (using his CMAPPLY routine at http://www.physics.wisc.edu/~craigm/idl/arrays.html):
IDL> res = cmapply('max',movie,3)
Andy
|
|
|
Re: Cumulative max() in *arbitrary* dimension? [message #79449 is a reply to message #79359] |
Sun, 26 February 2012 23:25  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Feb 24, 8:52 am, ameigs <andyme...@gmail.com> wrote:
> On Feb 23, 8:38 pm, Gianguido Cianci <gianguido.cia...@gmail.com>
> wrote:
>
>> Hi all,
>
>> I would like to write a generic version of the following, which is for a 3d movie:
>
>> res=movie
>> s=size(res, /dim)
>> FOR i = 1, s[2]-1 DO BEGIN
>> res[*, *, i] = max(dim = 3, res[*, *, 0:i])
>> ENDFOR
>
>> So how to I generalize this to any dimension? I could make something with execute, but there's gotta be a better way. I'm on IDL7.
>
>> Thanks,
>> Gianguido
>
> I am surprized that Craig Markwardt has not replied already, but here
> goes (using his CMAPPLY routine athttp://www.physics.wisc.edu/~craigm/idl/arrays.html):
>
> IDL> res = cmapply('max',movie,3)
I didn't reply because the original poster appeared to be asking for a
kind of "rolling" maximum, which CMAPPLY doesn't do. (i.e. MAX(res[*,
*, 0:i]) for each i)
Craig
|
|
|