Checking time vectors¶
The methods below can be used to test if sequences (typically numpy arrays) contain regularly sampled times.
- datkit.is_increasing(times)¶
Checks if each value in
timesis greater than (not equal to) the last.
- datkit.is_regularly_increasing(times, reltol=1e-12)¶
Checks if the difference between successive times is always the same strictly positive value.
Checks that
dt, the value returned bysampling_interval(), is strictly positive and thatabs((times[i + 1] - times[i]) / dt - 1) < reltolfor alli.
- datkit.sampling_interval(times)¶
Returns the sampling interval, assuming that
timesis regularly spaced.