Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions py3d/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,8 @@ def sim_movies(**mvargs):
def findval(vec,val):
"""Returns index value of 1D array vec which is closest to scalar val

WARNING: 8/27/2021: Currently this function assumes that vec is monotonically increasing or
decreasing. If it isn't, it may return an array.
WARNING: 9/5/2021: If multiple values of array vec are equidistant from scalar
val, the value with the lowest index is returned.


Args:
Expand All @@ -1219,6 +1219,6 @@ def findval(vec,val):
"""

vec2 = abs( (vec - val)**2 )
index = ( np.where(vec2 == vec2.min()))[0].item()
index = ( np.where(vec2 == vec2.min()))[0][0]
return index
#======================================================