[SciPy-user] Array selection help
Jose Luis Gomez Dans
Tue Feb 10 16:56:42 CST 2009
> > like that). For each unique value in arr1, I want to work out the mean
> > (...sum, std dev, etc) of arr2 for the overlapping region. So far,
> Also take a look at scipy.ndimage, which has functions to calculate
> means and variances over labeled data.
Oh, this looks very nice! In case someone is looking for this, you need to propose your labelling (using labels), and then use scipy.ndimage.means() and friends with your label definitions.
Going back to my example, my labels grid is arr1, so I just have to do, eg:
for i in numpy.unique ( arr1 ):
print i, scipy.ndimage.mean ( arr2, labels=arr1, index=i )
I think that solves it! Thanks!
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
More information about the SciPy-user