Allow crossing to return empty list if all values are masked

develop
Chris Leaman 6 years ago
parent 36256514b5
commit 6ffdd2611d

@ -23,6 +23,10 @@ def crossings(profile_x, profile_z, constant_z):
profile_z = np.array(profile_z)[valid] profile_z = np.array(profile_z)[valid]
profile_x = np.array(profile_x)[valid] profile_x = np.array(profile_x)[valid]
# Return empty list if mask removes all values
if profile_x.size == 0:
return []
# Normalize the 'signal' to zero. # Normalize the 'signal' to zero.
# Use np.subtract rather than a list comprehension for performance reasons # Use np.subtract rather than a list comprehension for performance reasons
z = np.subtract(profile_z, constant_z) z = np.subtract(profile_z, constant_z)

Loading…
Cancel
Save