Skip to content

Commit 2aa89a9

Browse files
kahaagaDatseris
andauthored
Refactor api (#89)
* Remove @show * Refactor nearest neighbors methods * Typos * Remove duplicate function * Reorganize docs * API renaming * Switch order of docs * Refactoring * Unnecessary capitalization * Further refactoring * Missing part of equation * Use new name * Add deprecations * Add note for single-symbol encoding in docstring * Add note for single-symbol encoding in docstring * Remove redundant note * Use @deprecate for genentropy * Add (preliminary) update message * [wip] reusable docs * re-write intro page * improve entropy wording * Complete re-organization of source code folders * correct includes state * finish first draft of docs new way (many TODOs left_) * Fix wavelet entropy docs * add docstrings to convenience calls * final touches * add documentation build phase * Add power spectrum probability estimator (#94) * add code and docstring for spectral entropy * add docs * even better test reorganization * add one more depth level * WIP: reviewing new api (#95) * Equivalent to, not equivalent with * Include dispersion entropy * Clearer wording * Symbolization routines need to be imported before estimators using them * Export in-place version. * Follow Julia's linting conventions * Run CI on all pull requests * Don't export in-place version * Missing a letter Co-authored-by: Datseris <[email protected]>
1 parent e093e13 commit 2aa89a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1261
-821
lines changed

.github/workflows/ci.yml

+33-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6+
- '**' # matches every branch
67
push:
78
branches:
89
- main
@@ -15,20 +16,18 @@ jobs:
1516
fail-fast: false
1617
matrix:
1718
version:
18-
- '1' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
19-
os:
20-
- ubuntu-latest
19+
- '1'
20+
os: [ubuntu-latest] # adjust according to need, e.g. os: [ubuntu-latest] if testing only on linux
2121
arch:
2222
- x64
23-
2423
steps:
25-
# Cancel ongoing CI test runs if pushing to branch again before the previous tests
24+
# Cancel ongoing CI test runs if pushing to branch again before the previous tests
2625
# have finished
2726
- name: Cancel ongoing test runs for previous commits
2827
uses: styfle/[email protected]
2928
with:
3029
access_token: ${{ github.token }}
31-
30+
3231
# Do tests
3332
- uses: actions/checkout@v2
3433
- uses: julia-actions/setup-julia@v1
@@ -51,3 +50,31 @@ jobs:
5150
- uses: codecov/codecov-action@v1
5251
with:
5352
file: lcov.info
53+
docs:
54+
name: Documentation
55+
runs-on: ubuntu-latest
56+
steps:
57+
# Cancel ongoing documentation build if pushing to branch again before the previous
58+
# build is finished.
59+
- name: Cancel ongoing documentation builds for previous commits
60+
uses: styfle/[email protected]
61+
with:
62+
access_token: ${{ github.token }}
63+
64+
# Build docs
65+
- uses: actions/checkout@v2
66+
- uses: julia-actions/setup-julia@v1
67+
with:
68+
version: '1'
69+
- name: Instantiate and install dependencies
70+
run: |
71+
julia --project=docs -e '
72+
using Pkg
73+
Pkg.develop(PackageSpec(path=pwd()))
74+
Pkg.instantiate()'
75+
- name: Generate documentation and deploy
76+
env: # needed for pushing to gh-pages branch
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
79+
run:
80+
julia --project=docs docs/make.jl

Project.toml

+4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ version = "1.3.0"
77
[deps]
88
DelayEmbeddings = "5732040d-69e3-5649-938a-b6b4f237613f"
99
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
10+
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1011
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1112
Neighborhood = "645ca80c-8b79-4109-87ea-e1f58159d116"
1213
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
1314
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
15+
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
1416
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1517
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1618
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
@@ -21,8 +23,10 @@ Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a"
2123
[compat]
2224
DelayEmbeddings = "2"
2325
Distances = "0.9, 0.10"
26+
FFTW = "1"
2427
Neighborhood = "0.1, 0.2"
2528
QuadGK = "2"
29+
Scratch = "1"
2630
SpecialFunctions = "0.10, 1.0, 2"
2731
StaticArrays = "0.12, 1.0"
2832
StatsBase = "0.33"

docs/Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
55
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
66
DynamicalSystems = "61744808-ddfa-5f27-97ff-6e42cc95d634"
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
8+
Entropies = "ed8fcbec-b94c-44b6-89df-898894ad9591"
89
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
910
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1011
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
11-
Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a"

docs/make.jl

+15-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1+
using Entropies # using before activation of environment ensures dev'ed version
12
cd(@__DIR__)
23
using Pkg
34
CI = get(ENV, "CI", nothing) == "true" || get(ENV, "GITHUB_TOKEN", nothing) !== nothing
4-
CI && Pkg.activate(@__DIR__)
5+
Pkg.activate(@__DIR__)
56
CI && Pkg.instantiate()
6-
CI && (ENV["GKSwstype"] = "100")
77
using DelayEmbeddings
88
using Documenter
99
using DocumenterTools: Themes
10-
using Entropies
11-
using PyPlot
10+
using CairoMakie
11+
using Entropies.Wavelets
1212
using DynamicalSystems
13-
using Wavelets
1413

15-
# %% JuliaDynamics theme.
16-
# download the themes
14+
# %% JuliaDynamics theme
15+
# It includes themeing for the HTML build
16+
# and themeing for the Makie plotting
17+
1718
using DocumenterTools: Themes
1819
for file in ("juliadynamics-lightdefs.scss", "juliadynamics-darkdefs.scss", "juliadynamics-style.scss")
19-
download("https://raw.githubusercontent.com/JuliaDynamics/doctheme/master/$file", joinpath(@__DIR__, file))
20+
filepath = joinpath(@__DIR__, file)
21+
if !isfile(filepath)
22+
download("https://raw.githubusercontent.com/JuliaDynamics/doctheme/master/$file", joinpath(@__DIR__, file))
23+
end
2024
end
2125
# create the themes
2226
for w in ("light", "dark")
@@ -29,18 +33,10 @@ Themes.compile(joinpath(@__DIR__, "juliadynamics-light.scss"), joinpath(@__DIR__
2933
Themes.compile(joinpath(@__DIR__, "juliadynamics-dark.scss"), joinpath(@__DIR__, "src/assets/themes/documenter-dark.css"))
3034

3135
# %% Build docs
32-
PyPlot.ioff()
33-
cd(@__DIR__)
3436
ENV["JULIA_DEBUG"] = "Documenter"
3537

36-
PAGES = [
37-
"Entropies.jl" => "index.md",
38-
"Estimators" => "estimators.md",
39-
"Remaining" => [
40-
"DispersionEntropy.md",
41-
],
42-
"Utility methods" => "utils.md",
43-
]
38+
PAGES = include("toc.jl")
39+
include("style.jl")
4440

4541
makedocs(
4642
modules = [Entropies],
@@ -49,6 +45,7 @@ makedocs(
4945
assets = [
5046
asset("https://fonts.googleapis.com/css?family=Montserrat|Source+Code+Pro&display=swap", class=:css),
5147
],
48+
collapselevel = 3,
5249
),
5350
sitename = "Entropies.jl",
5451
authors = "Kristian Agasøster Haaga, George Datseris",
@@ -62,5 +59,3 @@ if CI
6259
push_preview = true
6360
)
6461
end
65-
PyPlot.close("all")
66-
PyPlot.ion()

docs/src/DispersionEntropy.md

-5
This file was deleted.

docs/src/complexity_measures.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Complexity measures
2+
3+
## Sample entropy
4+
5+
## Approximate entropy
6+
7+
## Disequilibrium

docs/src/entropies.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Entropies
2+
3+
## Rényi (generalized) entropy
4+
5+
```@docs
6+
entropy_renyi
7+
```
8+
9+
## Tsallis (generalized) entropy
10+
11+
```@docs
12+
entropy_tsallis
13+
```
14+
15+
## Shannon entropy (convenience)
16+
```@docs
17+
entropy_shannon
18+
```
19+
20+
## Indirect entropies
21+
Here we list functions which compute Shannon entropies via alternate means, without explicitly computing some probability distributions and then using the Shannon formulat.
22+
23+
### Nearest neighbors entropy
24+
```@docs
25+
entropy_kraskov
26+
entropy_kozachenkoleonenko
27+
```
28+
29+
## Convenience functions
30+
In this subsection we expand documentation strings of "entropy names" that are used commonly in the literature, such as "permutation entropy". As we made clear in [API & terminology](@ref), these are just the existing Shannon/Rényi/Tsallis entropy with a particularly chosen probability estimator. We have only defined convenience functions for the most used names, and arbitrary more specialized convenience functions can be easily defined in a couple lines of code.
31+
```@docs
32+
entropy_permutation
33+
entropy_spatial_permutation
34+
entropy_wavelet
35+
entropy_dispersion
36+
```

0 commit comments

Comments
 (0)