0

I have intensity values over time that I saved in a one-dimensional numpy array called cell. I calculate a maximum during a certain time window by:

peak = max(cell[750:791]) 

Now I want to have the index of this specific peak value but only in the same time window. I tried:

idx_peak = np.where(cell[750:791] == peak) 

But this seems to give me all the indices from the entire array. How can I apply np.where in my specific time window? I hope my question is clear.

1 Answer 1

1

Just use

idx_peak = cell[750:791].argmax() 
Sign up to request clarification or add additional context in comments.

5 Comments

That didn't seem to solve the problem... The resulting index is at the very beginning of my trace.
does adding 750 to the result helps? as argmax gives you the max index within the range of 750 to 791 so if you want the absolute index you should add 750 to it
YES!!!! thank you so much ! Addition of 750 to argmax did the trick.
glad to help :)
@na_mu please accept the answer if your query has been addressed, this will mark the question as answered

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.