Skip to content

Commit 49c9664

Browse files
committed
docs
1 parent 4a4a465 commit 49c9664

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/RunningQuantiles.jl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,31 @@ function make_window(winlen::Int)
2828
-winlen÷2:winlen÷2
2929
end
3030

31+
32+
"""
33+
running_median(v, w, nan_mode=SkipNaNs())
34+
35+
Computes the running median of the vector `v` with window `w`, where `w` is an odd window length, or a range of offsets.
36+
See [`running_quantile`](@ref) for details.
37+
"""
3138
function running_median(v, w, nan_mode=SkipNaNs(); buffer = default_buffer(v,0.5,w))
3239
running_quantile(v, 0.5, w, nan_mode; buffer)
3340
end
3441

42+
"""
43+
result = running_quantile(v, p, w, nan_mode=SkipNaNs())
44+
45+
Computes the running `p`-th quantile of the vector `v` with window `w`, where `w` is an odd window length, or a range of offsets.
46+
Specifically,
47+
- if `w` is a `AbstractUnitRange`, `result[i]` is the `p`-th quantile of `v[(i .+ w) ∩ eachindex(v)]`, where `NaN`s are handled according to `nan_mode`:
48+
- `nan_mode==SkipNaN()`: `NaN` values are ignored; quantile is computed over non-`NaN`s
49+
- `nan_mode==PropagateNaNs()`: the result is `NaN` whenever the input window contains `NaN`
50+
- `nan_mode==ErrOnNaN()`: an error is raise if at least one input window contains `NaN`
51+
- if `w` is an odd integer, a centered window of length `w` is used, namely `-w÷2:w÷2`
52+
"""
3553
function running_quantile(v, p, w, nan_mode=SkipNaNs(); buffer = default_buffer(v,p,w))
3654
_running_quantile(v, p, make_window(w), nan_mode; buffer)
3755
end
38-
3956
function _running_quantile(v, p, r::AbstractUnitRange, nan_mode; buffer)
4057
result = similar(v, float(eltype(v)))
4158
# wrapping this Int in a `Ref` helps the compiler not create a `Box`

0 commit comments

Comments
 (0)