Finding points

datkit.index(times, t, ttol=1e-09)

Returns the index of time t in times.

A ValueError will be raised if time t cannot be found in times. Two times will be regarded as equal if they are within ttol of each other.

datkit.index_near(times, t)

Returns the index of time t in times, or the index of the nearest value to it.

If t is outside the range of times by more than half a sampling interval (as returned by datkit.sampling_interval()), a ValueError will be raised.

datkit.index_on(times, t0=None, t1=None, include_left=True, include_right=False)

Returns a tuple (i0, i1) corresponding to the interval from t0 to t1 in times.

By default, the interval is taken as t0 <= times < t1, but this can be customized using include_left and include_right.

If one or both points are out of range, indices corresponding to the first and/or last entries in times are returned. Note that this may result in an empty interval if t0 < t1 < times[0] or times[1] < t0 < t1.

If t0 is None, the first index will be 0, regardless of the value of include_left. If t1 is None the second index will be len(times), regardless of the value of include_right.

datkit.value_at(times, values, t, ttol=1e-09)

Returns the value at the given time point.

A ValueError will be raised if time t cannot be found in times. Two times will be regarded as equal if they are within ttol of each other.

datkit.value_near(times, values, t)

Returns the value nearest the given time point, if present in the data.

A ValueError will be raised if no time near t can be found in times (see index_near()).

datkit.mean_on(times, values, t0=None, t1=None, include_left=True, include_right=False)

Returns the mean of values on the interval from t0 to t1.

See also index_on().

datkit.max_on(times, values, t0=None, t1=None, include_left=True, include_right=False)

Returns a tuple (t_max, v_max) corresponding to the maximum value in values on the interval from t0 to t1.

See also index_on().

datkit.min_on(times, values, t0=None, t1=None, include_left=True, include_right=False)

Returns a tuple (t_min, v_min) corresponding to the minimum value in values on the interval from t0 to t1.

See also index_on().

datkit.abs_max_on(times, values, t0=None, t1=None, include_left=True, include_right=False)

Returns a tuple (t_max, v_max) corresponding to the maximum value in values on the interval from t0 to t1.

See also index_on().