spiketools.utils.timestamps.sum_time_ranges¶
- spiketools.utils.timestamps.sum_time_ranges(ranges)[source]¶
Sum the total amount of time defined by time range(s).
- Parameters:
- rangeslist of float or list of list of float
Time range(s) to sum the total defined time for.
- Returns:
- totalfloat
The total amount of time defined by the given time range(s).
Examples
Sum the amount of time in a single time range:
>>> time_range = [2.5, 10] >>> sum_time_ranges(time_range) 7.5
Sum the amount of time across a collection of time ranges:
>>> time_ranges = [[2.5, 10], [14, 15], [18.5, 20]] >>> sum_time_ranges(time_ranges) 10.0