From 6d15eb2b4731dcb30d3bedaa2f098570d803fb93 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 27 Oct 2023 17:30:20 +0200 Subject: [PATCH] chore: lint --- junifer/markers/complexity/complexity_base.py | 44 ++++++++++++------- junifer/markers/complexity/hurst_exponent.py | 4 +- .../complexity/multiscale_entropy_auc.py | 10 ++--- junifer/markers/complexity/perm_entropy.py | 2 +- junifer/markers/complexity/range_entropy.py | 3 +- .../markers/complexity/range_entropy_auc.py | 6 +-- junifer/markers/complexity/sample_entropy.py | 2 +- .../complexity/weighted_perm_entropy.py | 2 +- 8 files changed, 39 insertions(+), 34 deletions(-) diff --git a/junifer/markers/complexity/complexity_base.py b/junifer/markers/complexity/complexity_base.py index b0f59e33d7..193cb79407 100644 --- a/junifer/markers/complexity/complexity_base.py +++ b/junifer/markers/complexity/complexity_base.py @@ -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 @@ -39,7 +48,7 @@ class ComplexityBase(BaseMarker): """ - _DEPENDENCIES = {"nilearn", "neurokit2"} + _DEPENDENCIES: ClassVar[Set[str]] = {"nilearn", "neurokit2"} def __init__( self, @@ -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 diff --git a/junifer/markers/complexity/hurst_exponent.py b/junifer/markers/complexity/hurst_exponent.py index e9c2165aff..7e4a406e5b 100644 --- a/junifer/markers/complexity/hurst_exponent.py +++ b/junifer/markers/complexity/hurst_exponent.py @@ -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, 82–87, 1995. + Chaos Interdiscip. J. Nonlinear Sci., 5, 82-87, 1995. - See also + See Also -------- neurokit2.fractal_dfa diff --git a/junifer/markers/complexity/multiscale_entropy_auc.py b/junifer/markers/complexity/multiscale_entropy_auc.py index 6597a5583f..064f76d83f 100644 --- a/junifer/markers/complexity/multiscale_entropy_auc.py +++ b/junifer/markers/complexity/multiscale_entropy_auc.py @@ -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 @@ -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 diff --git a/junifer/markers/complexity/perm_entropy.py b/junifer/markers/complexity/perm_entropy.py index ab0345d980..423d2e0d89 100644 --- a/junifer/markers/complexity/perm_entropy.py +++ b/junifer/markers/complexity/perm_entropy.py @@ -91,7 +91,7 @@ def compute_complexity( series. Physical review letters, 88(17), 174102. - See also + See Also -------- neurokit2.entropy_permutation diff --git a/junifer/markers/complexity/range_entropy.py b/junifer/markers/complexity/range_entropy.py index 48cf948540..ccb8581efd 100644 --- a/junifer/markers/complexity/range_entropy.py +++ b/junifer/markers/complexity/range_entropy.py @@ -91,7 +91,7 @@ def compute_complexity( Self-Similarity. Entropy, vol. 20, no. 12, p. 962, 2018. - See also + See Also -------- neurokit2.entropy_range @@ -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, diff --git a/junifer/markers/complexity/range_entropy_auc.py b/junifer/markers/complexity/range_entropy_auc.py index 837d46e640..d350f595f3 100644 --- a/junifer/markers/complexity/range_entropy_auc.py +++ b/junifer/markers/complexity/range_entropy_auc.py @@ -92,7 +92,7 @@ def compute_complexity( Self-Similarity. Entropy, vol. 20, no. 12, p. 962, 2018. - See also + See Also -------- neurokit2.entropy_range @@ -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, diff --git a/junifer/markers/complexity/sample_entropy.py b/junifer/markers/complexity/sample_entropy.py index 814f537e71..66711a5dc2 100644 --- a/junifer/markers/complexity/sample_entropy.py +++ b/junifer/markers/complexity/sample_entropy.py @@ -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 diff --git a/junifer/markers/complexity/weighted_perm_entropy.py b/junifer/markers/complexity/weighted_perm_entropy.py index 22824ec6c4..1c3f165d61 100644 --- a/junifer/markers/complexity/weighted_perm_entropy.py +++ b/junifer/markers/complexity/weighted_perm_entropy.py @@ -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