Skip to content

Commit

Permalink
Merge pull request #814 from neuropsychology/dev
Browse files Browse the repository at this point in the history
0.2.5
  • Loading branch information
DominiqueMakowski authored Jul 9, 2023
2 parents 3d5ecfc + 294196f commit 366583e
Show file tree
Hide file tree
Showing 53 changed files with 1,052 additions and 342 deletions.
72 changes: 36 additions & 36 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
engines:
pep8:
enabled: true
checks:
E501:
pep8:
enabled: true
checks:
E501:
enabled: false
E203:
enabled: false
E302:
enabled: false
E303:
enabled: false

checks:
argument-count:
enabled: false
E203:
complex-logic:
enabled: false
E302:
file-lines:
enabled: false
E303:
method-complexity:
enabled: false
method-count:
enabled: false
method-lines:
enabled: false
nested-control-flow:
enabled: true
return-statements:
enabled: true
similar-code:
enabled: false
identical-code:
enabled: false

checks:
argument-count:
enabled: false
complex-logic:
enabled: false
file-lines:
enabled: true
method-complexity:
enabled: false
method-count:
enabled: true
method-lines:
enabled: false
nested-control-flow:
enabled: true
return-statements:
enabled: true
similar-code:
enabled: false
identical-code:
enabled: false

exclude_patterns:
- "tests/"
- "scripts/"
- "benchmarks/"
- "studies/"
- "data/"
- "docs/img/"
- "docs/readme/"
- "tests/"
- "scripts/"
- "benchmarks/"
- "studies/"
- "data/"
- "docs/img/"
- "docs/readme/"
3 changes: 2 additions & 1 deletion .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ jobs:
pip install sphinx-book-theme
pip install sphinxemoji
pip install sphinx-copybutton
pip install ipykernel==6.23.2
pip install ipython
pip install myst-parser
pip install myst-nb
pip install numpy
pip install numpy==1.24.3
pip install pandas
pip install scipy
pip install scikit-learn
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ jobs:
pip install sphinx-book-theme
pip install sphinxemoji
pip install sphinx-copybutton
pip install ipykernel==6.23.2
pip install ipython
pip install myst-parser
pip install myst-nb
pip install numpy
pip install numpy==1.24.3
pip install pandas
pip install scipy
pip install scikit-learn
Expand Down
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import os
import re
import sys
import asyncio
import platform

# -- Path setup --------------------------------------------------------------

Expand Down Expand Up @@ -105,6 +107,9 @@ def find_version():

# googleanalytics_id = "G-DVXSEGN5M9"

# Address asyncio warning
if platform.system() == "Windows":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

# NumPyDoc configuration -----------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions docs/functions/signal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Preprocessing
"""""""""""""""""""""
.. autofunction:: neurokit2.signal_resample

*signal_fillmissing()*
""""""""""""""""""""
.. autofunction:: neurokit2.signal_fillmissing


Transformation
^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion neurokit2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from .video import *

# Info
__version__ = "0.2.4"
__version__ = "0.2.5"


# Maintainer info
Expand Down
4 changes: 2 additions & 2 deletions neurokit2/complexity/complexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def complexity(signal, which="makowski2022", delay=1, dimension=2, tolerance="sd
depending on what the literature suggests. We recommend using this function only for quick
exploratory analyses, but then replacing it by the calls to the individual functions.
Check-out our open-access `study <https://onlinelibrary.wiley.com/doi/10.1111/ejn.15800>`_
Check-out our `open-access study <https://onlinelibrary.wiley.com/doi/10.1111/ejn.15800>`_
explaining the selection of indices.
The categorization by "computation time" is based on our `study
The categorization by "computation time" is based on `our study
<https://www.mdpi.com/1099-4300/24/8/1036>`_ results:
.. figure:: https://raw.githubusercontent.com/DominiqueMakowski/ComplexityStructure/main/figures/time1-1.png
Expand Down
2 changes: 1 addition & 1 deletion neurokit2/complexity/fractal_tmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def fractal_tmf(signal, n=40, show=False, **kwargs):
w = np.zeros(n)
for i in range(n):
surro = signal_surrogate(signal, method="IAAFT")
w[i] = fractal_dfa(surro, multifractal=True, show=False)[0]["Width"]
w[i] = float(fractal_dfa(surro, multifractal=True, show=False)[0]["Width"].iloc[0])

# Run t-test
# TODO: adjust in the future
Expand Down
6 changes: 3 additions & 3 deletions neurokit2/complexity/optim_complexity_tolerance.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def complexity_tolerance(
.. ipython:: python
@savefig p_complexity_tolerance4.png scale=100%
@savefig p_complexity_tolerance5.png scale=100%
r, info = nk.complexity_tolerance(signal, delay=1, dimension=3,
method = 'bin', show=True)
@suppress
Expand All @@ -168,7 +168,7 @@ def complexity_tolerance(
.. ipython:: python
# Slow method
@savefig p_complexity_tolerance5.png scale=100%
@savefig p_complexity_tolerance6.png scale=100%
r, info = nk.complexity_tolerance(signal, delay=8, dimension=6,
method = 'maxApEn', show=True)
@suppress
Expand All @@ -184,7 +184,7 @@ def complexity_tolerance(
.. ipython:: python
# Narrower range
@savefig p_complexity_tolerance6.png scale=100%
@savefig p_complexity_tolerance7.png scale=100%
r, info = nk.complexity_tolerance(signal, delay=8, dimension=6, method = 'maxApEn',
r_range=np.linspace(0.002, 0.8, 30), show=True)
@suppress
Expand Down
10 changes: 8 additions & 2 deletions neurokit2/complexity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
import sklearn.metrics
import sklearn.neighbors
from packaging import version

from .utils_complexity_embedding import complexity_embedding

Expand Down Expand Up @@ -109,11 +110,16 @@ def _get_count(
# Get neighbors count
# -------------------
# Sanity checks
if distance not in sklearn.neighbors.KDTree.valid_metrics + ["range"]:
sklearn_version = version.parse(sklearn.__version__)
if sklearn_version >= version.parse("1.3.0"):
valid_metrics = sklearn.neighbors.KDTree.valid_metrics() + ["range"]
else:
valid_metrics = sklearn.neighbors.KDTree.valid_metrics + ["range"]
if distance not in valid_metrics:
raise ValueError(
"The given metric (%s) is not valid."
"The valid metric names are: %s"
% (distance, sklearn.neighbors.KDTree.valid_metrics + ["range"])
% (distance, valid_metrics)
)

if fuzzy is True:
Expand Down
2 changes: 1 addition & 1 deletion neurokit2/complexity/utils_fractal_mandelbrot.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _buddhabrot_initialize(size=1000, iterations=100, real_range=(-2, 2), imagin
def _mandelbrot_optimize(c):
# Optimizations: most of the mset points lie within the
# within the cardioid or in the period-2 bulb. (The two most
# prominant shapes in the mandelbrot set. We can eliminate these
# prominent shapes in the mandelbrot set. We can eliminate these
# from our search straight away and save alot of time.
# see: http://en.wikipedia.org/wiki/Mandelbrot_set#Optimizations

Expand Down
Loading

0 comments on commit 366583e

Please sign in to comment.