[Numpy-discussion] Recognizing a cycle in a vector

Manolo Martínez manolo at austrohungaro.com
Thu Dec 3 10:46:28 EST 2015


On 12/03/15 at 05:39am, Eric Firing wrote:
> On 2015/12/02 10:45 PM, Manolo Martínez wrote:
> >1) this func sorts the absolute value of the amplitudes to find the two
> >most important  components, and this seems overkill for large vectors.
> 
> Try
> 
> inds = np.argpartition(-np.abs(ft), 2)[:2]
> 
> Now inds holds the indices of the two largest components.
> 

That is better than sorted indeed. Thanks,

M



More information about the NumPy-Discussion mailing list