33# Recurrence rate
44
55"""
6- recurrencerate(x; theiler=0 )
6+ recurrencerate(x[ ; theiler::Integer] )
77
8- Calculate the recurrence rate of the recurrence matrix `x`, ruling out
9- the points within the Theiler window of size `theiler`.
8+ Calculate the recurrence rate of the recurrence matrix `x`.
9+
10+ The line of identity (main diagonal) is excluded by default for matrices of type
11+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
12+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
13+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
1014"""
11- function recurrencerate (x:: ARM ; theiler:: Integer = 0 , kwargs... ):: Float64
15+ function recurrencerate (x:: ARM ; theiler:: Integer = deftheiler (x) , kwargs... ):: Float64
1216 (theiler < 0 ) && throw (ErrorException (
1317 " Theiler window length must be greater than or equal to 0" ))
1418 if theiler == 0
@@ -52,11 +56,15 @@ macro histogram_params(keyword, description, hist_fun)
5256 _fname = Symbol (" _$(keyword) _$(name) " )
5357 fbody = function_bodies[name]
5458 doc = """
55- $fname (x; lmin=2, theiler=0 )
59+ $fname (x[ ; lmin=2, theiler] )
5660
5761 Calculate the $(param) contained in the recurrence matrix `x`,
58- ruling out the points within the Theiler window of size `theiler`
59- and diagonals shorter than `lmin`.
62+ ruling out the lines shorter than `lmin`.
63+
64+ The line of identity (main diagonal) is excluded by default for matrices of type
65+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
66+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
67+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
6068 """
6169 push! (ret. args, quote
6270 @doc $ doc ->
8088@deprecate rqaentropy dl_entropy
8189
8290"""
83- determinism(x; lmin=2, theiler=0 )
91+ determinism(x[ ; lmin=2, theiler] )
8492
8593Calculate the determinism of the recurrence matrix `x`, ruling out
86- the points within the Theiler window of size `theiler` and diagonals shorter
87- than `lmin`.
94+ the diagonal lines shorter than `lmin`.
95+
96+ The line of identity (main diagonal) is excluded by default for matrices of type
97+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
98+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
99+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
88100"""
89101function determinism (x:: ARM ; kwargs... )
90102 npoints = recurrencerate (x; kwargs... )* length (x)
99111
100112
101113"""
102- divergence(x; theiler=0 )
114+ divergence(x[ ; theiler] )
103115
104116Calculate the divergence of the recurrence matrix `x`
105- (actually the inverse of [`dl_max`](@ref)), ruling out
106- the points within the Theiler window of size `theiler`.
117+ (actually the inverse of [`dl_max`](@ref)).
107118"""
108119divergence (x:: ARM ; kwargs... ) = ( 1.0 / dl_max (x; kwargs... ) )
109120
110121
111122"""
112- trend(x; theiler=0, border=10)
123+ trend(x[; border=10, theiler] )
113124
114- Calculate the trend of recurrences in the recurrence matrix `x`
115- towards its edges, ruling out the points within the Theiler window of size `theiler`.
125+ Calculate the trend of recurrences in the recurrence matrix `x`.
116126
117- Keyword `border` can also exclude outermost diagonals
118- (i.e. counting from the corners of the matrix).
127+ The 10 outermost diagonals (counting from the corners of the matrix)
128+ are excluded by default to avoid "border effects". Use the keyword argument
129+ `border` to define a different number of excluded lines.
130+
131+ The line of identity (main diagonal) is excluded by default for matrices of type
132+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
133+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
134+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
119135"""
120- trend (x:: ARM ; kwargs... ) = _trend (tau_recurrence (x); kwargs... )
136+ trend (x:: ARM ; theiler= deftheiler (x), kwargs... ) =
137+ _trend (tau_recurrence (x); theiler= theiler, kwargs... )
121138
122139function tau_recurrence (x:: ARM )
123140 n = minimum (size (x))
124141 [count (! iszero, diag (x,d))/ (n- d) for d in (0 : n- 1 )]
125142end
126143
127- function _trend (npoints:: Vector ; theiler= 0 , border= 10 , kwargs... ):: Float64
144+ function _trend (npoints:: Vector ; theiler= 1 , border= 10 , kwargs... ):: Float64
128145 nmax = length (npoints)
129146 rrk = npoints./ collect (nmax: - 1 : 1 )
130147 a = 1 + theiler
@@ -150,11 +167,15 @@ end
150167@deprecate maxvert vl_max
151168
152169"""
153- laminarity(x; lmin=2, theiler=0 )
170+ laminarity(x[ ; lmin=2, theiler] )
154171
155172Calculate the laminarity of the recurrence matrix `x`, ruling out the
156- points within the Theiler window of size `theiler` and lines shorter
157- than `lmin`.
173+ lines shorter than `lmin`.
174+
175+ The line of identity (main diagonal) is excluded by default for matrices of type
176+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
177+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
178+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
158179"""
159180function laminarity (x:: ARM ; kwargs... )
160181 npoints = recurrencerate (x)* length (x)
@@ -167,8 +188,12 @@ _laminarity(vert_hist::Vector{<:Integer}, npoints) = _determinism(vert_hist, npo
167188 trappingtime(x; lmin=2, theiler=0)
168189
169190Calculate the trapping time of the recurrence matrix `x`, ruling out the
170- points within the Theiler window of size `theiler` and lines shorter
171- than `lmin`.
191+ lines shorter than `lmin`.
192+
193+ The line of identity (main diagonal) is excluded by default for matrices of type
194+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
195+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
196+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
172197
173198The trapping time is the average of the vertical line structures and thus equal
174199to [`vl_average`](@ref).
@@ -184,8 +209,12 @@ trappingtime(x::ARM; kwargs...) = vl_average(x; kwargs...)
184209 meanrecurrencetime(x; lmin=2, theiler=0)
185210
186211Calculate the mean recurrence time of the recurrence matrix `x`, ruling out the
187- points within the Theiler window of size `theiler` and lines shorter
188- than `lmin`.
212+ lines shorter than `lmin`.
213+
214+ The line of identity (main diagonal) is excluded by default for matrices of type
215+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
216+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
217+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
189218
190219Equivalent to [`rt_average`](@ref).
191220"""
@@ -196,8 +225,12 @@ meanrecurrencetime(x::ARM; kwargs...) = rt_average(x; kwargs...)
196225 nmprt(x; lmin=2, theiler=0)
197226
198227Calculate the number of the most probable recurrence time (NMPRT), ruling out the
199- points within the Theiler window of size `theiler` and lines shorter
200- than `lmin`.
228+ lines shorter than `lmin`.
229+
230+ The line of identity (main diagonal) is excluded by default for matrices of type
231+ `RecurrenceMatrix` or `JointRecurrenceMatrix`, but included for matrices of type
232+ `CrossRecurrenceMatrix`. Use the keyword argument `theiler` to exclude the
233+ diagonals within a custom Theiler window (`theiler=0` to include all diagonals).
201234"""
202235nmprt (x:: ARM ; kwargs) = maximum (verticalhistograms (x; kwargs... )[2 ])
203236
0 commit comments