def calculate_bin_indices(
self, tstart, tsamp, data_size):
"""Calculate the bin that each time sample should be
added to
@param[in] tstart Time of the first element (s)
@param[in] tsamp Difference between the times of
consecutive elements (s)
@param[in] data_size Number of elements
@return Which bin each sample is folded into
"""
arrival_time = tstart + tsamp * np.arange(data_size)
phase = np.fmod(arrival_time, self.period)
return np.floor(phase / self.period * self.bins).astype(int)
评论列表
文章目录