SignalIndices

Documentation for SignalIndices.

SignalIndices.filter_no_collisionsMethod
filter_no_collisions(as, bs, coll_rad)

Filter elements of as to keep elements that are not within coll_rad of any element in bs. Assumes both are sorted.

source
SignalIndices.filtermapMethod
filtermap(p::Function, f::Function, xs)

Filters the input vector, then maps the remaining values. For each element of xs which predicate function p returns true for, use mapping function f to transform the result.

source
SignalIndices.find_closestFunction
find_closest(a, target, ...)

Find the index of the element in a that minimizes the absolute difference from the target.

source
SignalIndices.find_not_uniqueMethod
find_not_unique(a::AbstractArray)

Returns the indices of all redundant elements in a. The time a value is seen, it is not considered redundant

source
SignalIndices.moving_sum!Method
moving_sum!(out, s, nav)

Sum s in a sliding window of nav points, placing the result into out. The length of out should be max(length(s) - nav + 1, 0) if nav > 0, or length(s) otherwise.

Does not zero-pad.

source
SignalIndices.n_ndxMethod
n_ndx(start_idx::T, stop_idx::T) where {T<:Integer}

Find the number of indices between start_idx and stop_idx.

source
SignalIndices.ndx_offsetMethod
ndx_offset(start_ndx, npt)

Finds the index that will select npt number of elements starting at start_ndx.

If npt is negative, then start_ndx is treated like the end of a range of elements, and the index required to return npt number of elements is returned.

source
SignalIndices.pairwise_idxsMethod
pairwise_idxs(n::Integer) -> Vector{NTuple{2, Int}}

Returns the possible combinations of 1:n indices excluding self-pairs. The first index is always greater than the second, allowing for easy subtraction of ordered lists.

Examples

julia> pairwise_idxs(3)
3-element Vector{Tuple{Int64,Int64}}:
 (2, 1)
 (3, 1)
 (3, 2)
source
SignalIndices.skipoftypeMethod
skipoftype(::Type{T}, itr)

Return an iterator over the elements in itr skipping values of type T. Use collect to obtain an Array containing the non-T values in itr. Note that even if itr is a multidimensional array, the result will always be a Vector since it is not possible to remove nothings while preserving dimensions of the input.

Examples

julia> sum(SignalIndices.skipoftype(nothing, [1, nothing, 2]))
3
julia> collect(SignalIndices.skipoftype(nothing, [1, nothing, 2]))
2-element Vector{Int64}:
 1
 2
julia> collect(SignalIndices.skipoftype(nothing, [1 nothing; 2 nothing]))
2-element Vector{Int64}:
 1
 2
source
SignalIndices.t_sup_to_ndxMethod
t_sup_to_ndx()

Converts a time in a regularly sampled time series to the index of the last sample before the specified time.

source
SignalIndices.t_to_ndxFunction
t_to_ndx()

Converts a time in a regularly sampled time series to its index. Returns the index of the first sample at or after the time specified

source
SignalIndices.window_countsMethod
window_counts(ts, window_dur)

For each event in ts, count the number of events in ts that are in the range of ts[i] and ts[i] + window_dur. Assumes ts is sorted, and that elements of ts are unique.

source