Skip to content

Commit

Permalink
use sssets v2 (#37)
Browse files Browse the repository at this point in the history
* use sssets v2

* correct usage of size

* remove deprecations

* fix doc problems

* fix all docs errors

* warnonly on missing cross refs
  • Loading branch information
Datseris authored Sep 23, 2024
1 parent de84306 commit 55344d9
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FractalDimensions"
uuid = "4665ce21-e117-4649-aed8-08bbe5ccbead"
authors = ["George Datseris <[email protected]>", "Ignacio Del Amo <@PythagoreanCult>", "Anton P Braun"]
version = "1.8.1"
version = "1.8.2"

[deps]
ComplexityMeasures = "ab4b797d-85ee-42ba-b621-05d793b346a2"
Expand All @@ -19,7 +19,7 @@ StateSpaceSets = "40b095a5-5852-4c12-98c7-d43bf788e795"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
ComplexityMeasures = "2.8, 3"
ComplexityMeasures = "3"
Distances = "0.10"
Distributions = "0.24, 0.25"
HypothesisTests = "0.11"
Expand All @@ -30,6 +30,6 @@ Reexport = "1"
Roots = "1, 2"
Scratch = "1"
SpecialFunctions = "1, 2"
StateSpaceSets = "1"
StateSpaceSets = "2"
Statistics = "1"
julia = "1.5"
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ bib = CitationBibliography(
)

build_docs_with_style(FRACTALDIMENSION_PAGES, FractalDimensions, ComplexityMeasures, StateSpaceSets;
expandfirst = ["index.md"], bib,
expandfirst = ["index.md"], bib, warnonly = [:cross_references, :doctest, :missing_docs],
)
11 changes: 10 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,24 @@ The whole above pipeline we went through is bundled in [`grassberger_proccacia_d
```@docs
slopefit
LinearRegression
linreg
```

```@docs
LargestLinearRegion
linear_regions
linear_region
```

```@docs
AllSlopesDistribution
estimate_boxsizes
minimum_pairwise_distance
```

## Generalized (entropy) dimension

Based on the definition of the Generalized entropy ([`genentropy`](@ref)), one can calculate an appropriate dimension, called *generalized dimension*:
Based on the definition of the generalized (Renyi) entropy, one can calculate an appropriate dimension, called *generalized dimension*:
```@docs
generalized_dim
molteno_dim
Expand Down Expand Up @@ -173,6 +181,7 @@ extremevaltheory_gpdfit_pvalues
### Block-maxima estimator
```@docs
BlockMaxima
estimate_gev_parameters
```

## Theiler window
Expand Down
19 changes: 9 additions & 10 deletions docs/style.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# %% Color theme definitions
# Color theme definitions
struct CyclicContainer <: AbstractVector{String}
c::Vector{String}
n::Int
Expand All @@ -17,23 +17,22 @@ end
Base.iterate(c::CyclicContainer, i = 1) = iterate(c.c, i)

COLORSCHEME = [
"#6D44D0",
"#2CB3BF",
"#1B1B1B",
"#DA5210",
"#03502A",
"#866373",
"#7143E0",
"#191E44",
"#0A9A84",
"#AF9327",
"#791457",
"#6C768C",
]

COLORS = CyclicContainer(COLORSCHEME)
LINESTYLES = CyclicContainer(["-", ":", "--", "-."])

# %% Makie styling
# other styling elements for Makie
set_theme!(;
palette = (color = COLORSCHEME,),
fontsize = 22,
figure_padding = 4,
resolution = (1000, 500),
figure_padding = 8,
size = (800, 400),
linewidth = 3.0,
)
6 changes: 3 additions & 3 deletions src/corrsum_based/correlationsum_boxassisted.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exact to the original [`correlationsum`](@ref). For any other `P`, some
point pairs that should have been included may be skipped due to having smaller
distance in the remaining dimensions, but larger distance in the first `P` dimensions.
"""
function boxed_correlationsum(X; P = 2, kwargs...)
function boxed_correlationsum(X::AbstractStateSpaceSet; P = 2, kwargs...)
P = min(P, dimension(X))
r0, ε0 = estimate_r0_buenoorovio(X, P)
εs = 2.0 .^ range(log2(ε0), log2(r0); length = 16)
Expand All @@ -75,7 +75,7 @@ boxed_correlationsum(X, e::Real, r0 = e; kwargs...) = boxed_correlationsum(X, [e
function boxed_correlationsum(
X, εs, r0 = maximum(εs); q = 2, P = 2, kwargs...
)
P size(X, 2) || error("Prism dimension has to be ≤ than `X` dimension.")
P dimension(X) || error("Prism dimension has to be ≤ than `X` dimension.")
issorted(εs) || error("Sorted `εs` required for optimized version.")
if r0 < maximum(εs)
@warn("Box size `r0` has to be ≥ than `maximum(εs)`.")
Expand Down Expand Up @@ -358,7 +358,7 @@ using Random: shuffle!
Estimate a reasonable size for boxing `X`, proposed by
Bueno-Orovio and Pérez-García [BuenoOrovio2007](@cite), before calculating the correlation
dimension as presented by [Theiler1983](@cite).
dimension as presented by [Theiler1987](@cite).
Return the size `r0` and the minimum interpoint distance `ε0` in the data.
If instead of boxes, prisms
Expand Down
2 changes: 1 addition & 1 deletion src/corrsum_based/correlationsum_vanilla.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ i.e. it calculates [`correlationsum`](@ref) for various radii and then tries to
a linear region in the plot of the log of the correlation sum versus log(ε).
See [`correlationsum`](@ref) for the available keywords.
See also [`takens_best_estimate`](@ref), [`boxassisted_correlation_dim`](@ref).
See also [`takens_best_estimate_dim`](@ref), [`boxassisted_correlation_dim`](@ref).
"""
function grassberger_proccacia_dim(X::AbstractStateSpaceSet, εs = estimate_boxsizes(X); kwargs...)
cm = correlationsum(X, εs; kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/extremes_based/confidence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function gpd_nrmse(E, gpd, nbins)
# Compute histogram of E
bins = range(0, nextfloat(maximum(E), 2); length = nbins)
binning = FixedRectangularBinning(bins)
allprobs = allprobabilities(ValueHistogram(binning), E)
allprobs = allprobabilities_and_outcomes(ValueHistogram(binning), E)[1]
width = step(bins)

# We will calcuate the GPD pdf at the midpoint of each bin
Expand Down
2 changes: 1 addition & 1 deletion src/extremes_based/gpd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Estimate and return the parameters `σ, ξ` of a Generalized Pareto Distribution
fit to `X` (which typically is the exceedances of the log distance of a state space set),
assuming that `minimum(X) ≥ 0` and hence the parameter `μ` is 0
(if not, simply shift `X` by its minimum), according to the methods provided
in [Pons2023](@ref).
in [Pons2023](@cite).
The estimator can be:
Expand Down
2 changes: 1 addition & 1 deletion src/linear_fits/estimate_boxsizes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export estimate_boxsizes
estimate_boxsizes(X::AbstractStateSpaceSet; kwargs...) → εs
Return `k` exponentially spaced values: `εs = base .^ range(lower + w, upper + z; length = k)`,
that are a good estimate for sizes ε that are used in calculating a [Fractal Dimension](@ref).
that are a good estimate for sizes ε that are used in calculating a fractal Dimension.
It is strongly recommended to [`standardize`](@ref) input dataset before using this
function.
Expand Down

0 comments on commit 55344d9

Please sign in to comment.