Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outlier detection and robust estimation #22

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
e8f1628
fix edge case
MerlinDumeur Jun 27, 2023
b2d1182
Merge branch 'robust' of github.com:MerlinDumeur/pymultifracs into ro…
MerlinDumeur Jun 27, 2023
b6ab233
Prepared figures
MerlinDumeur Jun 27, 2023
f0cf3dc
Improved robust algorithm
MerlinDumeur Aug 8, 2023
839514b
Merge branch 'robust' of github.com:MerlinDumeur/pymultifracs into ro…
MerlinDumeur Sep 1, 2023
248b35f
fix edge case
MerlinDumeur Jun 27, 2023
9a23e56
Prepared figures
MerlinDumeur Jun 27, 2023
4e9a8a6
Improved robust algorithm
MerlinDumeur Aug 8, 2023
d3cf506
Merge branch 'robust' of github.com:MerlinDumeur/pymultifracs into ro…
MerlinDumeur Sep 1, 2023
9fe0cca
EURASIP modifs
MerlinDumeur Sep 9, 2023
b3aae5f
Tiny fix
MerlinDumeur Sep 11, 2023
29330cc
Added custom width of leader blocks + on the fly rejection of leaders
MerlinDumeur Oct 4, 2023
0ff3844
Fixed beta estimation
MerlinDumeur Oct 5, 2023
f707405
Fixing functions
MerlinDumeur Oct 17, 2023
48c30bf
fix edge case
MerlinDumeur Jun 27, 2023
f4007bd
Prepared figures
MerlinDumeur Jun 27, 2023
805b739
Improved robust algorithm
MerlinDumeur Aug 8, 2023
48723c9
fix edge case
MerlinDumeur Jun 27, 2023
7a3399c
Prepared figures
MerlinDumeur Jun 27, 2023
1c4b122
Improved robust algorithm
MerlinDumeur Aug 8, 2023
2eba38a
EURASIP modifs
MerlinDumeur Sep 9, 2023
f41cdb6
Tiny fix
MerlinDumeur Sep 11, 2023
da8c1af
Added custom width of leader blocks + on the fly rejection of leaders
MerlinDumeur Oct 4, 2023
de84045
Fixed beta estimation
MerlinDumeur Oct 5, 2023
8200a03
Fixing functions
MerlinDumeur Oct 17, 2023
b7c3444
Fixing tests
MerlinDumeur Oct 26, 2023
a11ab88
Merge
MerlinDumeur Oct 26, 2023
a785166
Prepared last method
MerlinDumeur Dec 4, 2023
b1d3f33
Fix cumulant plotting bug
MerlinDumeur Dec 19, 2023
bf2e05c
Fix PSD plotting function
MerlinDumeur Dec 21, 2023
d6f63c9
Fixed robust cumulant estimation
MerlinDumeur Jan 25, 2024
95b244e
Added multifractal spectra with rejected coefficients; individual gam…
MerlinDumeur Feb 23, 2024
6b39772
Plotting function allow shift in gamint
MerlinDumeur Feb 23, 2024
999fd63
plot improvement
MerlinDumeur Feb 29, 2024
51d094a
Pep8 improvement, doc, prepare robust
MerlinDumeur Mar 1, 2024
2ddc566
Fixed debugging
MerlinDumeur Mar 1, 2024
cf5a209
Fixing wavelet function
MerlinDumeur Mar 4, 2024
2b80d83
Faster cumulants
MerlinDumeur Mar 5, 2024
a74f943
Update doc
MerlinDumeur Mar 5, 2024
f0d6524
Fixed type linking
MerlinDumeur Mar 5, 2024
3430416
Modifying API
MerlinDumeur Mar 7, 2024
038475d
Progress on new API
MerlinDumeur Mar 18, 2024
2a5b168
API rework
MerlinDumeur Mar 21, 2024
1225ec1
API rework 2 -- not tested
MerlinDumeur Mar 22, 2024
e1efddb
Fix imports
MerlinDumeur Mar 22, 2024
3f58573
Fixing WT transform and plotting
MerlinDumeur Mar 25, 2024
8bd85d8
Fixed plotting and bootstrapping
MerlinDumeur Mar 26, 2024
8e869f0
Fixing tests
MerlinDumeur Mar 27, 2024
f2cea67
Fixed regression
MerlinDumeur Mar 28, 2024
6a04f8b
Started bivariate analysis
MerlinDumeur Apr 2, 2024
97e9f15
Bivariate sf WIP
MerlinDumeur Apr 2, 2024
df3bf43
Bivariate structure function done
MerlinDumeur Apr 3, 2024
5b73fe5
Restructure dataclasses, add bivariate structure plotting
MerlinDumeur Apr 3, 2024
24dd51a
Added bivariate cumulants
MerlinDumeur Apr 4, 2024
87bc901
Fixing cumulants
MerlinDumeur Apr 5, 2024
517ad58
Fixing cumulants
MerlinDumeur Apr 5, 2024
59d0227
Fixed bivariate -- passing tests
MerlinDumeur Apr 8, 2024
b866240
Bootstrap WIP
MerlinDumeur Apr 8, 2024
f41cdfb
Bootstrap WIP
MerlinDumeur Apr 9, 2024
db5b47e
Bootstrap WIP
MerlinDumeur Apr 9, 2024
4c9a422
Bootstrap test successful
MerlinDumeur Apr 9, 2024
91db93f
Last test fix
MerlinDumeur Apr 10, 2024
0fca2bb
Refresh doc
MerlinDumeur Apr 10, 2024
b54e531
Integrated robust estimation
MerlinDumeur Apr 11, 2024
2d142c4
Doc update, WT analysis fixed, added example notebook
MerlinDumeur Apr 12, 2024
6be815e
Trying to fix CI
MerlinDumeur Apr 12, 2024
9e96f8f
Fixed 3.10 compatibility
MerlinDumeur Apr 13, 2024
72d2319
Fixed CI error, conda -> mamba
MerlinDumeur Apr 14, 2024
6ed5150
Micromamba CI fix
MerlinDumeur Apr 14, 2024
ef96994
CI fix 2
MerlinDumeur Apr 14, 2024
761fddb
Fixing bootstrapping bug
MerlinDumeur Apr 19, 2024
1198bf2
Bootstrap demo notebook
MerlinDumeur May 13, 2024
ffb6513
Benchmarking code improvement
MerlinDumeur May 25, 2024
ecd4f5c
Fixing WT transform for outlier detection
MerlinDumeur May 27, 2024
5a6f9aa
Fixing plot function
MerlinDumeur May 28, 2024
8b768dd
Fix WSE
MerlinDumeur Nov 27, 2024
501b3c8
Update installation process
MerlinDumeur Jan 21, 2025
7bb3aa4
update meta.yml
MerlinDumeur Jan 21, 2025
612acf2
update ci,meta.yml
MerlinDumeur Jan 21, 2025
499d7be
Update CI
MerlinDumeur Jan 21, 2025
c73dcef
doc update
MerlinDumeur Jan 22, 2025
851cad5
updated codecov and linting actions
MerlinDumeur Jan 22, 2025
0463e8b
CI fix
MerlinDumeur Jan 22, 2025
18a36ff
Mamba CI fix
MerlinDumeur Jan 22, 2025
249d72a
CI fix
MerlinDumeur Jan 22, 2025
414e102
CI fix
MerlinDumeur Jan 22, 2025
310f207
Hopefully fixes CI
MerlinDumeur Jan 22, 2025
421e959
Hopefully fixes CI-2
MerlinDumeur Jan 22, 2025
774bb7a
Hopefully fixes CI-3
MerlinDumeur Jan 22, 2025
38955a9
Hopefully fixes CI-4
MerlinDumeur Jan 22, 2025
304616b
Add tests
MerlinDumeur Jan 22, 2025
6cc81bd
Doc progress
MerlinDumeur Jan 23, 2025
6e6e110
Test fix and doc fix
MerlinDumeur Jan 23, 2025
3536979
Bivar test and benchmark coverage
MerlinDumeur Jan 23, 2025
7acbf14
Fixed missing tqdm dependency
MerlinDumeur Jan 23, 2025
70e275f
Doc update
MerlinDumeur Jan 27, 2025
b0a4e3a
Final doc changes
MerlinDumeur Jan 27, 2025
f7656be
Formatting fix
MerlinDumeur Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .coverage
Binary file not shown.
68 changes: 43 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0
- name: Lint code
uses: github/super-linter/slim@v4
uses: super-linter/super-linter/slim@v7.2.1
env:
LINTER_RULES_PATH: .
DEFAULT_BRANCH: master
VALIDATE_ALL_CODEBASE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_INCLUDE: ./pymultifracs/*.py
FILTER_REGEX_INCLUDE: ^(pymultifracs|tests)/.*\.py$
PYTHON_PYLINT_CONFIG_FILE: .pylintrc
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_PYTHON_PYLINT: true

Expand All @@ -36,42 +37,59 @@ jobs:
runs-on: ${{ matrix.os }}
needs: linter-check
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.8"]
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
include:
- os: windows-latest
python-version: "3.10"
- os: macos-latest
python-version: "3.10"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache conda
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('env.yml') }}
- name: Setup python ${{ matrix.python-version }} with conda
uses: conda-incubator/setup-miniconda@v2
# - name: Cache conda
# uses: actions/cache@v2
# env:
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key:
# ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
# hashFiles('env.yml') }}
- name: Setup python ${{ matrix.python-version }} with mamba
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
# installer-url: https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-Linux-x86_64.sh
# miniforge-variant: Miniforge3
miniforge-version: latest
environment-file: meta.yml
use-only-tar-bz2: true
conda-remove-defaults: "true"
channels: conda-forge,numba
channel-priority: strict
activate-environment: pymultifracs
# mamba-version: "*"
# use-only-tar-bz2: true
- name: Testing
# mamba install -c numba -c conda-forge numpy scipy pywavelets seaborn numba statsmodels pytest pytest-xdist pytest-cov tqdm joblib
run: |
conda install -c conda-forge pytest pytest-xdist pytest-cov
pip install -e .
mamba list
mamba --version
pip install -e .[bootstrap,robust,test]
mamba list
pytest -n auto -x --cov=./ --cov-report=xml
- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
uses: codecov/codecov-action@v3
# if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
fail_ci_if_error: false # optional (default = false)
verbose: true # optional (default = false)
52 changes: 27 additions & 25 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,31 @@ jobs:
if: github.repository == 'neurospin/pymultifracs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
- uses: actions/checkout@v4
# - name: Cache conda
# uses: actions/cache@v2
# env:
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key:
# doc-conda-${{ env.CACHE_NUMBER }}-${{
# hashFiles('meta.yml') }}
- name: Setup python with mamba
uses: conda-incubator/setup-miniconda@v3
with:
path: ~/conda_pkgs_dir
key:
doc-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('meta.yml') }}
- name: Setup python with conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: test
python-version: 3.11
# mamba-version: "*"
miniforge-version: latest
activate-environment: pymultifracs
python-version: 3.13
environment-file: meta.yml
use-only-tar-bz2: true
channel-priority: strict
channels: conda-forge,numba
- name: Build doc
shell: bash -el {0}
# mamba install -c conda-forge pip sphinx numpydoc pydata-sphinx-theme nbsphinx
run: |
conda install -c conda-forge pip sphinx numpydoc pydata-sphinx-theme
python -m pip install .
pip install .[bootstrap,robust,doc]
cd doc
make html
touch _build/html/.nojekyll
Expand All @@ -45,7 +47,7 @@ jobs:
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload gh page artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: doc/_build/html/
Expand All @@ -55,9 +57,9 @@ jobs:
needs: build-docs

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# permissions:
# pages: write # to deploy to Pages
# id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
Expand All @@ -69,6 +71,6 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
with:
token: ${{ secrets.GITHUB_TOKEN }}
uses: actions/deploy-pages@v4 # or the latest "vX.X.X" version tag for this action
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ dist/
docs/
doc/_build/
doc/_autosummary/
doc/auto_examples/
doc/auto_tutorials/
doc/generated/
doc/sg_execution_times.rst

.ipynb_checkpoints/
.vscode
Expand Down
13 changes: 9 additions & 4 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ persistent=yes

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.9
py-version=3.10

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
Expand Down Expand Up @@ -89,13 +89,18 @@ disable=raw-checker-failed,
too-many-arguments,
too-many-locals,
invalid-name,
consider-using-dict-items
consider-using-dict-items,
protected-access,
use-dict-literal,
too-many-instance-attributes,
unnecessary-lambda-assignment,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
enable=c-extension-no-member,
useless-suppression


[REPORTS]
Expand Down Expand Up @@ -517,7 +522,7 @@ max-public-methods=20
max-returns=6

# Maximum number of statements in function / method body.
max-statements=50
max-statements=100

# Minimum number of public methods for a class (see R0903).
min-public-methods=2
Expand Down
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ Implemented features:
* Computation of (1D) multiresolution quantities: wavelet coefficients, wavelet-leaders and p-leaders
* Computation of structure functions, cumulants and log-cumulants.
* Estimation of the multifractal spectrum.
* Bivariate multifractal analysis.
* Bootstrap-derived confidence intervals and automated scaling range selection.
* Outlier detection.


The code in this package is based on the Wavelet p-Leader and Bootstrap based MultiFractal analysis (PLBMF) `Matlab toolbox <http://www.ens-lyon.fr/PHYSIQUE/Equipe3/MultiFracs/software.html>`_ written by Patrice Abry, Herwig Wendt and colleagues. For a thorough introduction to multifractal analysis, you may access H. Wendt's PhD thesis available in `his webiste <https://www.irit.fr/~Herwig.Wendt/data/ThesisWendt.pdf)>`_.
The initial implementation of the code in this package was based on the Wavelet p-Leader and Bootstrap based MultiFractal analysis (PLBMF) `Matlab toolbox <http://www.ens-lyon.fr/PHYSIQUE/Equipe3/MultiFracs/software.html>`_ written by Patrice Abry, Herwig Wendt and colleagues. For a thorough introduction to multifractal analysis, you may access H. Wendt's PhD thesis available in `his webiste <https://www.irit.fr/~Herwig.Wendt/data/ThesisWendt.pdf)>`_.


For a brief introduction to multifractal analysis, see the file THEORY.ipynb
.. For a brief introduction to multifractal analysis, see the file THEORY.ipynb

There are two ways to install this package: either by using a package manager to install the package only, which will make
the code only usable as an import,
Expand Down
3 changes: 3 additions & 0 deletions doc/_static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,7 @@
/* Avoid extra spacing in our nested version */
h3.panel-title p {
margin: 0 0 0px;
}
.header-cell {
display: none;
}
6 changes: 2 additions & 4 deletions doc/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{ fullname | escape | underline}}
{{ objname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
.. autoclass:: {{ fullname }}
6 changes: 2 additions & 4 deletions doc/_templates/autosummary/function.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{ fullname | escape | underline }}
{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}
.. autofunction:: {{ fullname }}
4 changes: 4 additions & 0 deletions doc/_templates/not_instantiated.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ objname | escape | underline}}

.. autoclass:: {{ fullname }}()
:show-inheritance:
Loading
Loading