Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_significant_duration improvement #132

Open
jorge243 opened this issue May 19, 2022 · 0 comments
Open

get_significant_duration improvement #132

jorge243 opened this issue May 19, 2022 · 0 comments

Comments

@jorge243
Copy link

this should be faster and i think improves readability:

def get_significant_duration(acceleration, time_step, start_level=0.,
end_level=1.0):
"""
Returns the significant duration of the record
"""
assert end_level >= start_level
husid, time_vector = get_husid(acceleration, time_step)
idx = np.searchsorted(husid, [start_level * husid[-1], end_level * husid[-1]])
return np.diff(time_vector[idx])[0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant