Finding points¶
- datkit.index(times, t, ttol=1e-09)¶
Returns the index of time
t
intimes
.A
ValueError
will be raised if timet
cannot be found intimes
. Two times will be regarded as equal if they are withinttol
of each other.
- datkit.index_near(times, t)¶
Returns the index of time
t
intimes
, or the index of the nearest value to it.If
t
is outside the range oftimes
by more than half a sampling interval (as returned bydatkit.sampling_interval()
), aValueError
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 fromt0
tot1
intimes
.By default, the interval is taken as
t0 <= times < t1
, but this can be customized usinginclude_left
andinclude_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 ift0 < t1 < times[0]
ortimes[1] < t0 < t1
.If
t0
isNone
, the first index will be0
, regardless of the value ofinclude_left
. Ift1
isNone
the second index will belen(times)
, regardless of the value ofinclude_right
.
- datkit.value_at(times, values, t, ttol=1e-09)¶
Returns the value at the given time point.
A
ValueError
will be raised if timet
cannot be found intimes
. Two times will be regarded as equal if they are withinttol
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 neart
can be found intimes
(seeindex_near()
).
- datkit.mean_on(times, values, t0=None, t1=None, include_left=True, include_right=False)¶
Returns the mean of
values
on the interval fromt0
tot1
.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 invalues
on the interval fromt0
tot1
.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 invalues
on the interval fromt0
tot1
.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 invalues
on the interval fromt0
tot1
.See also
index_on()
.