0

is there an equivalent of labview Threshold 1D Array Function: http://zone.ni.com/reference/en-XX/help/371361H-01/glang/threshold_1d_array/ in python?

1 Answer 1

1

I don't know of one as is, but it's a very small to write. You can wrap the following into a function

p = next(ii for ii,v in enumerate(x) if (v>=y))
frac=p-1.0+(float(y) - x[p-1])/(x[p]-x[p-1])

in the above, x is the input dataset, y is the value for which you want the fractional index. frac is, well...

Small explanation: enumerate(x) makes an iterator that returns (index,value) from x. So, they're what get put into ii,v.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.