In a 1-d array, find the first point where all subsequent points have values
less than a threshold, T.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold, T.
Maybe something like:
last_greater = numpy.arange(arr.shape)[arr = T][-1]
first_lower = last_greater + 1
There's probably a better way to do it, without the arange, though...
such that mag -50. How to do this
efficiently?
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold, T.
Maybe something like:
last_greater = numpy.arange(arr.shape)[arr = T][-1]
first_lower = last_greater + 1
There's probably a better way to do it, without the arange, though...
I'm
Zachary Pincus wrote:
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold, T.
Maybe something like:
last_greater = numpy.arange(arr.shape)[arr = T][-1]
first_lower = last_greater + 1
There's probably a better way to do it, without the
On Feb 9, 2011, at 10:58 AM, Neal Becker wrote:
Zachary Pincus wrote:
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold, T.
Maybe something like:
last_greater = numpy.arange(arr.shape)[arr = T][-1]
first_lower = last_greater + 1
On 2/9/2011 10:58 AM, Neal Becker wrote:
But where is numpy's 'find_first' function?
np.argmax(arrayT)
(Of course that constructs a boolean array...)
Alan Isaac
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
On Wed, Feb 9, 2011 at 11:04 AM, Zachary Pincus zachary.pin...@yale.edu wrote:
On Feb 9, 2011, at 10:58 AM, Neal Becker wrote:
Zachary Pincus wrote:
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold, T.
Maybe something like:
last_greater
As before, the line below does what you said you need, though not
maximally efficiently. (Try it in an interpreter...) There may be
another way in numpy that doesn't rely on constructing the index
array, but this is the first thing that came to mind.
last_greater =
This assumes monotonicity. Is that allowed?
The twice-stated problem was:
[Note to avert email-miscommunications] BTW, I wasn't trying to snipe
at you with that comment, Josef...
I just meant to say that this solution solves the problem as Neal
posed it, though that might not be the exact
On 02/09/2011 10:17 AM, Zachary Pincus wrote:
As before, the line below does what you said you need, though not
maximally efficiently. (Try it in an interpreter...) There may be
another way in numpy that doesn't rely on constructing the index
array, but this is the first thing that came to
Zachary Pincus wrote:
On Feb 9, 2011, at 10:58 AM, Neal Becker wrote:
Zachary Pincus wrote:
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold, T.
Maybe something like:
last_greater = numpy.arange(arr.shape)[arr = T][-1]
first_lower =
On 2/9/2011 11:39 AM, Bruce Southey wrote:
np.argmax(x5) # doesn't appear to be correct
It was an answer to the particular question
of how to do find_first, which it does
(at the cost of a boolean array):
it finds the first element greater than 5.
x
array([5, 4, 3, 6, 7, 3, 2, 1])
On Wed, Feb 9, 2011 at 10:48, Neal Becker ndbeck...@gmail.com wrote:
Still, I wonder if numpy would benefit from a 'find_first' function.
I certainly could have used one many times.
--
Robert Kern
I have come to believe that the whole world is an enigma, a harmless
enigma that is made
On Wed, Feb 9, 2011 at 11:25 AM, Zachary Pincus zachary.pin...@yale.edu wrote:
This assumes monotonicity. Is that allowed?
The twice-stated problem was:
[Note to avert email-miscommunications] BTW, I wasn't trying to snipe
at you with that comment, Josef...
I just meant to say that this
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold.
This doesn't imply monotonicity.
Suppose with have a sin curve, and I want to find the last trough. Or
a business cycle and I want to find the last recession.
Unless my english
On Wed, Feb 9, 2011 at 1:18 PM, Zachary Pincus zachary.pin...@yale.edu wrote:
In a 1-d array, find the first point where all subsequent points
have values
less than a threshold.
This doesn't imply monotonicity.
Suppose with have a sin curve, and I want to find the last trough. Or
a
I recently needed a find_first function and searched the list.
It has been discussed a few times before.
And I haven't seen an elegant solution yet.
Maybe we should file a feature request, as it would be awfully nice to have?
Mark
Still, I wonder if numpy would benefit from a 'find_first'
Mark Bakker wrote:
I recently needed a find_first function and searched the list.
It has been discussed a few times before.
And I haven't seen an elegant solution yet.
Maybe we should file a feature request, as it would be awfully nice to have?
Mark
Still, I wonder if numpy would
19 matches
Mail list logo