Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
synchon committed Nov 13, 2023
1 parent 76ecfbd commit 6d15eb2
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 34 deletions.
44 changes: 27 additions & 17 deletions junifer/markers/complexity/complexity_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
# License: AGPL

from abc import abstractmethod
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from typing import (
TYPE_CHECKING,
Any,
ClassVar,
Dict,
List,
Optional,
Set,
Union,
)

from ...utils import raise_error
from ..base import BaseMarker
Expand Down Expand Up @@ -39,7 +48,7 @@ class ComplexityBase(BaseMarker):
"""

_DEPENDENCIES = {"nilearn", "neurokit2"}
_DEPENDENCIES: ClassVar[Set[str]] = {"nilearn", "neurokit2"}

def __init__(
self,
Expand Down Expand Up @@ -101,21 +110,22 @@ def compute(
"""Compute.
Parameters
----------
input : dict
A single input from the pipeline data object in which to compute
the marker.
extra_input : dict, optional
The other fields in the pipeline data object. Useful for accessing
other data kind that needs to be used in the computation.
Returns
-------
dict
The computed result as dictionary. The following keys will be
included in the dictionary:
* ``data`` : ROI-wise complexity measures as ``numpy.ndarray``
* ``col_names`` : ROI labels for the complexity measures as list
----------
input : dict
A single input from the pipeline data object in which to compute
the marker.
extra_input : dict, optional
The other fields in the pipeline data object. Useful for accessing
other data kind that needs to be used in the computation.
Returns
-------
dict
The computed result as dictionary. The following keys will be
included in the dictionary:
* ``data`` : ROI-wise complexity measures as ``numpy.ndarray``
* ``col_names`` : ROI labels for the complexity measures as list
"""
# Initialize a ParcelAggregation
Expand Down
4 changes: 2 additions & 2 deletions junifer/markers/complexity/hurst_exponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def compute_complexity(
.. [1] Peng, C.; Havlin, S.; Stanley, H.E.; Goldberger, A.L.
Quantification of scaling exponents and crossover phenomena in
nonstationary heartbeat time series.
Chaos Interdiscip. J. Nonlinear Sci., 5, 8287, 1995.
Chaos Interdiscip. J. Nonlinear Sci., 5, 82-87, 1995.
See also
See Also
--------
neurokit2.fractal_dfa
Expand Down
10 changes: 4 additions & 6 deletions junifer/markers/complexity/multiscale_entropy_auc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def compute_complexity(
Multiscale entropy analysis of complex physiologic time series.
Physical review letters, 89(6), 068102, 2002.
See also
See Also
--------
neurokit2.entropy_multiscale
Expand Down Expand Up @@ -125,11 +125,9 @@ def compute_complexity(

if np.isnan(np.sum(MSEn_auc_roi)):
warn_with_log(
(
"There is NaN in the entropy values, likely due "
"to too short data length. A possible solution "
"may be to choose a smaller value for 'scale'."
)
"There is NaN in the entropy values, likely due "
"to too short data length. A possible solution "
"may be to choose a smaller value for 'scale'."
)

return MSEn_auc_roi.T # 1 X n_roi
2 changes: 1 addition & 1 deletion junifer/markers/complexity/perm_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def compute_complexity(
series.
Physical review letters, 88(17), 174102.
See also
See Also
--------
neurokit2.entropy_permutation
Expand Down
3 changes: 1 addition & 2 deletions junifer/markers/complexity/range_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def compute_complexity(
Self-Similarity.
Entropy, vol. 20, no. 12, p. 962, 2018.
See also
See Also
--------
neurokit2.entropy_range
Expand All @@ -112,7 +112,6 @@ def compute_complexity(
range_en_roi = np.zeros((n_roi, 1))

for idx_roi in range(n_roi):

sig = extracted_bold_values[:, idx_roi]
tmp = nk.entropy_range(
sig,
Expand Down
6 changes: 2 additions & 4 deletions junifer/markers/complexity/range_entropy_auc.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def compute_complexity(
Self-Similarity.
Entropy, vol. 20, no. 12, p. 962, 2018.
See also
See Also
--------
neurokit2.entropy_range
Expand All @@ -112,13 +112,11 @@ def compute_complexity(
range_en_auc_roi = np.zeros((n_roi, 1))

for idx_roi in range(n_roi):

sig = extracted_bold_values[:, idx_roi]

range_ent_vec = np.zeros((n_r))
range_ent_vec = np.zeros(n_r)
idx_r = 0
for tolerance in r_span:

range_en_auc_roi_tmp = nk.entropy_range(
sig,
dimension=emb_dim,
Expand Down
2 changes: 1 addition & 1 deletion junifer/markers/complexity/sample_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def compute_complexity(
Am. J. Physiol. Heart Circ. Physiol., 278 (6) (2000),
pp. H2039-2049
See also
See Also
--------
neurokit2.entropy_sample
Expand Down
2 changes: 1 addition & 1 deletion junifer/markers/complexity/weighted_perm_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def compute_complexity(
time series incorporating amplitude information.
Physical Review E, 87(2), 022911.
See also
See Also
--------
neurokit2.entropy_permutation
Expand Down

0 comments on commit 6d15eb2

Please sign in to comment.