[SciPy-User] computing local extrema

David Baddeley david_baddeley at yahoo.com.au
Wed Aug 26 17:41:06 EDT 2009


Hi Fred,

you could try something along these lines (assuming your data is called 'data' and numpy is imported as np):

d1 = np.diff(np.sign(np.diff(data))

maxima_indices = np.where(d1 < -.5) + 1
minima_indices = np.where(d1 > .5) + 1

you can then get the values using the indices on your original data. 


best wishes,
David


----- Original Message ----
From: fred <fredmfp at gmail.com>
To: SciPy Users List <scipy-user at scipy.org>
Sent: Wednesday, 26 August, 2009 11:32:48 PM
Subject: [SciPy-User] computing local extrema

Hi,

I would like to compute local extrema of an array (2D/3D),
ie get a list of points (coords + value).

How could I do this?

Any hint?

TIA.

Cheers,

-- 
Fred
_______________________________________________
SciPy-User mailing list
SciPy-User at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user



      



More information about the SciPy-User mailing list