IntervalSets.Interval
TimeseriesTools.UnitPower
Base.cat
Base.step
TimeseriesTools.align
TimeseriesTools.buffer
TimeseriesTools.centralderiv
TimeseriesTools.centralderiv!
TimeseriesTools.centraldiff
TimeseriesTools.centraldiff!
TimeseriesTools.coarsegrain
TimeseriesTools.delayembed
TimeseriesTools.duration
TimeseriesTools.rectifytime
TimeseriesTools.samplingperiod
TimeseriesTools.samplingrate
TimeseriesTools.stitch
TimeseriesTools.times
TimeseriesTools.window
IntervalSets.Interval
— MethodIntervalSets.Interval(x::AbstractTimeSeries)
Returns an interval representing the range of the AbstractTimeSeries
x
.
Examples
julia> using IntervalSets;
julia> t = 1:100;
julia> x = rand(100);
julia> ts = TimeSeries(t, x);
julia> IntervalSets.Interval(ts) == (1..100)
TimeseriesTools.UnitPower
— TypeUnitPower <: AbstractNormalization
A normalization that sets the total power of a signal to unity.
Fields
dims
: The dimensions to normalize over.p
: Computed normalization parameters.𝑝
: A function that returns the power from a given time series.𝑓
: The normalization method𝑓⁻¹
: The inverse normalization method.
Base.cat
— MethodBase.cat(D::DimensionalData.Dimension, args...; kwargs...)
Concatenate the arrays given in args...
, and give the resulting extra axis dimensions D
. Note that unlike Base.cat
without the first Dim
argument, this increments all existing dimensions greater than dims
by one (so N n×n arrays concatenated at dims=1
will result in an N×n×n array). args...
can be a splatted collection of ToolsArray
s, but this will give the same behaviour as if args...
is a single vector of ToolsArray
s; the latter is much more performant.
Base.step
— Methodstep(x::RegularTimeSeries)
Returns the step size (time increment) of a regularly sampled RegularTimeSeries
.
Examples
julia> t = 1:100;
julia> x = rand(100);
julia> rts = TimeSeries(t, x);
julia> step(rts) == 1
TimeseriesTools.align
— Methodalign(x::AbstractDimArray, ts, dt; dims = 1)
Align a DimArray
x
to each of a set of dimension values ts
, selecting a window given by dt
centered at each element of ts
. dt
can be a two-element vector/tuple, or an interval. The dims
argument specifies the dimension along which the alignment is performed. Each element of the resulting DimArray
is an aligned portion of the original x
.
TimeseriesTools.buffer
— Methodbuffer(x::RegularTimeSeries, n::Integer, p::Integer; kwargs...)
Buffer a time series x
with a given window length and overlap between successive buffers.
Arguments
x
: The regular time series to be buffered.n
: The number of samples in each buffer.p
: The number of samples of overlap betweeen the buffers.0
indicates no overlap- +
2
indicates2
samples of overlap between successive buffers - -
2
indicates2
samples of gap between buffers
See also: window
, delayembed
, coarsegrain
TimeseriesTools.centralderiv!
— Methodcentralderiv!(x::RegularTimeSeries; kwargs...)
Compute the central derivative of a regular time series x
, in-place. See centraldiff!
for available keyword arguments.
TimeseriesTools.centralderiv
— Methodcentralderiv(x::AbstractTimeSeries)
Compute the central derivative of a time series x
. See centraldiff
for available keyword arguments. Also c.f. centralderiv!
.
TimeseriesTools.centraldiff!
— Methodcentraldiff!(x::RegularTimeSeries; dims=𝑡, grad=-)
Compute the central difference of a regular time series x
, in-place. The first and last elements are set to the forward and backward difference, respectively. The dimension to perform differencing over can be specified as dims
, and the differencing function can be specified as grad
(defaulting to the euclidean distance, -
)
TimeseriesTools.centraldiff
— Methodcentraldiff(x::RegularTimeSeries; dims=𝑡, grad=-)
Compute the central difference of a regular time series x
. The first and last elements are set to the forward and backward difference, respectively. The dimension to perform differencing over can be specified as dims
, and the differencing function can be specified as grad
(defaulting to the euclidean distance, -
) See centraldiff!
.
TimeseriesTools.coarsegrain
— Methodcoarsegrain(X::AbstractArray; dims = nothing, newdim=ndims(X)+1)
Coarse-grain an array by taking every second element over the given dimensions dims
and concatenating them in the dimension newdim
. dims
are coarse-grained in sequence, from last to first. If dims
is not specified, we iterate over all dimensions that are not newdim
. If the array has an odd number of slices in any dims
, the last slice is discarded. This is more flexibile than the conventional, mean-based definition of coarse graining: it can be used to generate coarse-grained distributions from an array. To recover this conventional mean-based coarse-graining:
C = coarsegrain(X)
mean(C, dims=ndims(C))
TimeseriesTools.delayembed
— Functiondelayembed(x::UnivariateRegular, n::Integer, τ::Integer, p::Integer=1; kwargs...)
Delay embed a univariate time series x
with a given dimension n
, delay τ
, and skip length of p
Arguments
x
: The regular time series to be delay embedded.n
: The embedding dimension, i.e., the number of samples in each embedded vector.τ
: The number of original sampling periods between each sample in the embedded vectors.p
: The number of samples to skip between each successive embedded vector.
TimeseriesTools.duration
— Methodduration(x::AbstractTimeSeries)
Returns the duration of the AbstractTimeSeries
x
.
Examples
julia> t = 1:100;
julia> x = rand(100);
julia> ts = TimeSeries(t, x);
julia> TimeseriesTools.duration(ts) == 99
TimeseriesTools.rectifytime
— Methodrectifytime(X::IrregularTimeSeries; tol = 6, zero = false)
Rectifies the time values of an IrregularTimeSeries
. Checks if the time step of the input time series is approximately constant. If it is, the function rounds the time step and constructs a RegularTimeSeries
with range time indices. If the time step is not approximately constant, a warning is issued and the rectification is skipped.
Arguments
X::IrregularTimeSeries
: The input time series.tol::Int
: The number of significant figures for rounding the time step. Default is 6.zero::Bool
: Iftrue
, the rectified time values will start from zero. Default isfalse
.
TimeseriesTools.samplingperiod
— Methodsamplingperiod(x::RegularTimeSeries)
Returns the sampling period (step size) of a regularly sampled RegularTimeSeries
.
Examples
julia> t = 1:100;
julia> x = rand(100);
julia> rts = TimeSeries(t, x);
julia> samplingperiod(rts) == 1
TimeseriesTools.samplingrate
— Methodsamplingrate(x::RegularTimeSeries)
Returns the sampling rate (inverse of the step size) of a regularly sampled RegularTimeSeries
.
Examples
julia> t = 1:100;
julia> x = rand(100);
julia> rts = TimeSeries(t, x);
julia> samplingrate(rts) == 1
TimeseriesTools.stitch
— Methodstitch(x, args...)
Stitch multiple time series together by concatenatign along the time dimension generating new contiguous time indices. The time series must be of the same type (UnivariateRegular
, MultivariateRegular
, or AbstractArray
), and the sampling period and dimensions of the data arrays must match. If the arguments are `MultivariateRegular, they must have the same dimensions (except for the time dimension).
Arguments
X
: The first time series.args...
: Additional time series.
Returns
- A new time series containing the concatenated data.
TimeseriesTools.times
— Methodtimes(x::AbstractTimeSeries)
Returns the time indices of the AbstractTimeSeries
x
.
Examples
julia> t = 1:100;
julia> x = rand(100);
julia> ts = TimeSeries(t, x);
julia> times(ts) == t
TimeseriesTools.window
— Functionwindow(x::RegularTimeSeries, n::Integer, p::Integer; kwargs...)
Window a time series x
with a given window length and step between successive windows.
Arguments
x
: The regular time series to be windows.n
: The number of samples in each window.p
: The number of samples to slide each successive window.
See also: buffer
, delayembed
, coarsegrain