vak.common.timebins.timebin_dur_from_vec#

vak.common.timebins.timebin_dur_from_vec(time_bins, n_decimals_trunc=5)[source]#

compute duration of a time bin, given the vector of time bin centers associated with a spectrogram

Parameters:
  • time_bins (numpy.ndarray) – vector of times in spectrogram, where each value is a bin center.

  • n_decimals_trunc (int) – number of decimal places to keep when truncating the timebin duration calculated from the spectrogram arrays. Default is 5.

Returns:

timebin_dur – duration of a timebin, estimated from vector of times

Return type:

float

Notes

takes mean of pairwise difference between neighboring time bins, to deal with floating point error, then rounds and truncates to specified decimal place