Skip to content

Commit 4268f30

Browse files
improve slidingwindow docstring
1 parent 450cb8e commit 4268f30

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/slidingwindow.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,32 @@ possible for excess observations to be omitted from the view.
3535
Note that the windows are not materialized at construction time.
3636
To actually get a copy of the data at some window use indexing or [`getobs`](@ref).
3737
38+
When indexing the data is accessed as `getobs(data, idxs)`, with `idxs` an appropriate range of indexes.
3839
```jldoctest
39-
julia> s = slidingwindow(1:20, size=6)
40-
slidingwindow(1:20, size=6, stride=1)
40+
julia> s = slidingwindow(11:30, size=6)
41+
slidingwindow(10:30, size=6, stride=1)
4142
42-
julia> s[1]
43-
1:6
43+
julia> s[1] # == getobs(data, 1:6)
44+
11:16
4445
45-
julia> s[2]
46-
2:7
46+
julia> s[2] # == getobs(data, 2:7)
47+
12:17
4748
```
4849
4950
The optional parameter `stride` can be used to specify the
5051
distance between the start elements of each adjacent window.
5152
By default the stride is equal to 1.
5253
5354
```jldoctest
54-
julia> s = slidingwindow(1:20, size=6, stride=3)
55+
julia> s = slidingwindow(11:30, size=6, stride=3)
5556
slidingwindow(1:20, size=6, stride=3)
5657
5758
julia> for w in s; println(w); end
58-
1:6
59-
4:9
60-
7:12
61-
10:15
62-
13:18
59+
11:16
60+
14:19
61+
17:22
62+
20:25
63+
23:28
6364
```
6465
"""
6566
function slidingwindow(data; size::Int, stride::Int=1)

0 commit comments

Comments
 (0)