junifer 0.0.6.dev248__py3-none-any.whl → 0.0.6.dev258__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- junifer/_version.py +2 -2
- junifer/api/decorators.py +1 -2
- junifer/api/functions.py +18 -18
- junifer/api/queue_context/gnu_parallel_local_adapter.py +4 -4
- junifer/api/queue_context/htcondor_adapter.py +4 -4
- junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +3 -3
- junifer/api/queue_context/tests/test_htcondor_adapter.py +3 -3
- junifer/api/tests/test_functions.py +32 -32
- junifer/cli/cli.py +3 -3
- junifer/cli/parser.py +4 -4
- junifer/cli/tests/test_cli.py +5 -5
- junifer/cli/utils.py +5 -6
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +2 -2
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -2
- junifer/configs/juseless/datagrabbers/ucla.py +4 -4
- junifer/data/_dispatch.py +11 -14
- junifer/data/coordinates/_ants_coordinates_warper.py +16 -6
- junifer/data/coordinates/_coordinates.py +7 -7
- junifer/data/coordinates/_fsl_coordinates_warper.py +3 -3
- junifer/data/masks/_ants_mask_warper.py +3 -3
- junifer/data/masks/_fsl_mask_warper.py +3 -3
- junifer/data/masks/_masks.py +6 -9
- junifer/data/masks/tests/test_masks.py +4 -4
- junifer/data/parcellations/_ants_parcellation_warper.py +3 -3
- junifer/data/parcellations/_fsl_parcellation_warper.py +3 -3
- junifer/data/parcellations/_parcellations.py +19 -19
- junifer/data/parcellations/tests/test_parcellations.py +1 -2
- junifer/data/pipeline_data_registry_base.py +3 -2
- junifer/data/template_spaces.py +3 -3
- junifer/data/tests/test_data_utils.py +1 -2
- junifer/data/utils.py +4 -3
- junifer/datagrabber/aomic/id1000.py +2 -2
- junifer/datagrabber/aomic/piop1.py +5 -5
- junifer/datagrabber/aomic/piop2.py +5 -5
- junifer/datagrabber/aomic/tests/test_id1000.py +3 -3
- junifer/datagrabber/aomic/tests/test_piop1.py +4 -4
- junifer/datagrabber/aomic/tests/test_piop2.py +4 -4
- junifer/datagrabber/base.py +12 -11
- junifer/datagrabber/datalad_base.py +3 -3
- junifer/datagrabber/dmcc13_benchmark.py +8 -8
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -3
- junifer/datagrabber/hcp1200/hcp1200.py +8 -8
- junifer/datagrabber/hcp1200/tests/test_hcp1200.py +2 -1
- junifer/datagrabber/multiple.py +7 -7
- junifer/datagrabber/pattern.py +10 -10
- junifer/datagrabber/pattern_validation_mixin.py +10 -10
- junifer/datagrabber/tests/test_datalad_base.py +7 -8
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +2 -2
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +6 -6
- junifer/datareader/default.py +6 -6
- junifer/external/nilearn/junifer_connectivity_measure.py +2 -2
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +4 -4
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +15 -15
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +2 -3
- junifer/markers/base.py +8 -8
- junifer/markers/brainprint.py +7 -9
- junifer/markers/complexity/complexity_base.py +6 -8
- junifer/markers/complexity/hurst_exponent.py +5 -5
- junifer/markers/complexity/multiscale_entropy_auc.py +5 -5
- junifer/markers/complexity/perm_entropy.py +5 -5
- junifer/markers/complexity/range_entropy.py +5 -5
- junifer/markers/complexity/range_entropy_auc.py +5 -5
- junifer/markers/complexity/sample_entropy.py +5 -5
- junifer/markers/complexity/weighted_perm_entropy.py +5 -5
- junifer/markers/ets_rss.py +7 -7
- junifer/markers/falff/_afni_falff.py +1 -2
- junifer/markers/falff/_junifer_falff.py +1 -2
- junifer/markers/falff/falff_base.py +2 -4
- junifer/markers/falff/falff_parcels.py +7 -7
- junifer/markers/falff/falff_spheres.py +6 -6
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +6 -6
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +7 -7
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +6 -6
- junifer/markers/functional_connectivity/functional_connectivity_base.py +10 -10
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +7 -7
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +6 -6
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +1 -2
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +1 -2
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +3 -3
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +3 -3
- junifer/markers/parcel_aggregation.py +8 -8
- junifer/markers/reho/_afni_reho.py +1 -2
- junifer/markers/reho/_junifer_reho.py +1 -2
- junifer/markers/reho/reho_base.py +2 -4
- junifer/markers/reho/reho_parcels.py +8 -8
- junifer/markers/reho/reho_spheres.py +7 -7
- junifer/markers/sphere_aggregation.py +8 -8
- junifer/markers/temporal_snr/temporal_snr_base.py +8 -8
- junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -6
- junifer/markers/temporal_snr/temporal_snr_spheres.py +5 -5
- junifer/markers/utils.py +3 -3
- junifer/onthefly/_brainprint.py +2 -2
- junifer/onthefly/read_transform.py +3 -3
- junifer/pipeline/marker_collection.py +4 -4
- junifer/pipeline/pipeline_component_registry.py +5 -4
- junifer/pipeline/pipeline_step_mixin.py +7 -7
- junifer/pipeline/tests/test_pipeline_component_registry.py +2 -3
- junifer/pipeline/tests/test_pipeline_step_mixin.py +19 -19
- junifer/pipeline/tests/test_update_meta_mixin.py +4 -4
- junifer/pipeline/update_meta_mixin.py +2 -2
- junifer/pipeline/utils.py +5 -5
- junifer/preprocess/base.py +10 -10
- junifer/preprocess/confounds/fmriprep_confound_remover.py +11 -14
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +1 -2
- junifer/preprocess/smoothing/smoothing.py +7 -7
- junifer/preprocess/warping/_ants_warper.py +3 -4
- junifer/preprocess/warping/_fsl_warper.py +3 -4
- junifer/preprocess/warping/space_warper.py +6 -6
- junifer/preprocess/warping/tests/test_space_warper.py +3 -4
- junifer/stats.py +4 -4
- junifer/storage/base.py +14 -13
- junifer/storage/hdf5.py +21 -20
- junifer/storage/pandas_base.py +12 -11
- junifer/storage/sqlite.py +11 -11
- junifer/storage/tests/test_hdf5.py +1 -2
- junifer/storage/tests/test_sqlite.py +2 -2
- junifer/storage/tests/test_utils.py +8 -7
- junifer/storage/utils.py +7 -7
- junifer/testing/datagrabbers.py +9 -10
- junifer/tests/test_stats.py +2 -2
- junifer/typing/_typing.py +6 -9
- junifer/utils/helpers.py +2 -3
- junifer/utils/logging.py +5 -5
- junifer/utils/singleton.py +3 -3
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/METADATA +2 -2
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/RECORD +131 -131
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/WHEEL +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev258.dist-info}/top_level.txt +0 -0
junifer/storage/utils.py
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
import hashlib
|
8
8
|
import json
|
9
|
+
from collections.abc import Iterable
|
9
10
|
from importlib.metadata import PackageNotFoundError, version
|
10
|
-
from typing import Dict, Iterable, List, Tuple
|
11
11
|
|
12
12
|
import numpy as np
|
13
13
|
|
@@ -50,7 +50,7 @@ def get_dependency_version(dependency: str) -> str:
|
|
50
50
|
return dep_version
|
51
51
|
|
52
52
|
|
53
|
-
def _meta_hash(meta:
|
53
|
+
def _meta_hash(meta: dict) -> str:
|
54
54
|
"""Compute the MD5 hash of the metadata.
|
55
55
|
|
56
56
|
Parameters
|
@@ -78,7 +78,7 @@ def _meta_hash(meta: Dict) -> str:
|
|
78
78
|
return meta_md5
|
79
79
|
|
80
80
|
|
81
|
-
def process_meta(meta:
|
81
|
+
def process_meta(meta: dict) -> tuple[str, dict, dict]:
|
82
82
|
"""Process the metadata for storage.
|
83
83
|
|
84
84
|
It removes the key "element" and adds the "_element_keys" with the keys
|
@@ -109,7 +109,7 @@ def process_meta(meta: Dict) -> Tuple[str, Dict, Dict]:
|
|
109
109
|
# Copy the metadata
|
110
110
|
t_meta = meta.copy()
|
111
111
|
# Remove key "element"
|
112
|
-
element:
|
112
|
+
element: dict = t_meta.pop("element", None)
|
113
113
|
if element is None:
|
114
114
|
raise_error(msg="`meta` must contain the key 'element'")
|
115
115
|
if "marker" not in t_meta:
|
@@ -128,7 +128,7 @@ def process_meta(meta: Dict) -> Tuple[str, Dict, Dict]:
|
|
128
128
|
return md5_hash, t_meta, element
|
129
129
|
|
130
130
|
|
131
|
-
def element_to_prefix(element:
|
131
|
+
def element_to_prefix(element: dict) -> str:
|
132
132
|
"""Convert the element metadata to prefix.
|
133
133
|
|
134
134
|
Parameters
|
@@ -156,7 +156,7 @@ def element_to_prefix(element: Dict) -> str:
|
|
156
156
|
def store_matrix_checks(
|
157
157
|
matrix_kind: str,
|
158
158
|
diagonal: bool,
|
159
|
-
data_shape:
|
159
|
+
data_shape: tuple[int, int],
|
160
160
|
row_names_len: int,
|
161
161
|
col_names_len: int,
|
162
162
|
) -> None:
|
@@ -218,7 +218,7 @@ def matrix_to_vector(
|
|
218
218
|
row_names: Iterable[str],
|
219
219
|
matrix_kind: str,
|
220
220
|
diagonal: bool,
|
221
|
-
) ->
|
221
|
+
) -> tuple[np.ndarray, list[str]]:
|
222
222
|
"""Convert matrix to vector based on parameters.
|
223
223
|
|
224
224
|
Parameters
|
junifer/testing/datagrabbers.py
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
import tempfile
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import Dict, List
|
10
9
|
|
11
10
|
import nibabel as nib
|
12
11
|
from nilearn import datasets, image
|
@@ -35,7 +34,7 @@ class OasisVBMTestingDataGrabber(BaseDataGrabber):
|
|
35
34
|
types = ["VBM_GM"]
|
36
35
|
super().__init__(types=types, datadir=datadir)
|
37
36
|
|
38
|
-
def get_element_keys(self) ->
|
37
|
+
def get_element_keys(self) -> list[str]:
|
39
38
|
"""Get element keys.
|
40
39
|
|
41
40
|
Returns
|
@@ -46,7 +45,7 @@ class OasisVBMTestingDataGrabber(BaseDataGrabber):
|
|
46
45
|
"""
|
47
46
|
return ["subject"]
|
48
47
|
|
49
|
-
def get_item(self, subject: str) ->
|
48
|
+
def get_item(self, subject: str) -> dict[str, dict]:
|
50
49
|
"""Implement indexing support.
|
51
50
|
|
52
51
|
Parameters
|
@@ -80,7 +79,7 @@ class OasisVBMTestingDataGrabber(BaseDataGrabber):
|
|
80
79
|
self._dataset = datasets.fetch_oasis_vbm(n_subjects=10)
|
81
80
|
return self
|
82
81
|
|
83
|
-
def get_elements(self) ->
|
82
|
+
def get_elements(self) -> list[str]:
|
84
83
|
"""Get elements.
|
85
84
|
|
86
85
|
Returns
|
@@ -106,7 +105,7 @@ class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
|
|
106
105
|
types = ["BOLD", "T1w"] # TODO: Check that they are T1w
|
107
106
|
super().__init__(types=types, datadir=datadir)
|
108
107
|
|
109
|
-
def get_element_keys(self) ->
|
108
|
+
def get_element_keys(self) -> list[str]:
|
110
109
|
"""Get element keys.
|
111
110
|
|
112
111
|
Returns
|
@@ -117,7 +116,7 @@ class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
|
|
117
116
|
"""
|
118
117
|
return ["subject"]
|
119
118
|
|
120
|
-
def get_elements(self) ->
|
119
|
+
def get_elements(self) -> list[str]:
|
121
120
|
"""Get elements.
|
122
121
|
|
123
122
|
Returns
|
@@ -128,7 +127,7 @@ class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
|
|
128
127
|
"""
|
129
128
|
return [f"sub{x:03d}" for x in list(range(1, 11))]
|
130
129
|
|
131
|
-
def get_item(self, subject: str) ->
|
130
|
+
def get_item(self, subject: str) -> dict[str, dict]:
|
132
131
|
"""Implement indexing support.
|
133
132
|
|
134
133
|
Parameters
|
@@ -208,7 +207,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
208
207
|
)
|
209
208
|
return self
|
210
209
|
|
211
|
-
def get_element_keys(self) ->
|
210
|
+
def get_element_keys(self) -> list[str]:
|
212
211
|
"""Get element keys.
|
213
212
|
|
214
213
|
Returns
|
@@ -219,7 +218,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
219
218
|
"""
|
220
219
|
return ["subject"]
|
221
220
|
|
222
|
-
def get_elements(self) ->
|
221
|
+
def get_elements(self) -> list[str]:
|
223
222
|
"""Get elements.
|
224
223
|
|
225
224
|
Returns
|
@@ -230,7 +229,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
230
229
|
"""
|
231
230
|
return [f"sub-{x:02d}" for x in list(range(1, 11))]
|
232
231
|
|
233
|
-
def get_item(self, subject: str) ->
|
232
|
+
def get_item(self, subject: str) -> dict[str, dict]:
|
234
233
|
"""Implement indexing support.
|
235
234
|
|
236
235
|
Parameters
|
junifer/tests/test_stats.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
5
5
|
|
6
|
-
from typing import
|
6
|
+
from typing import Optional
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import pytest
|
@@ -25,7 +25,7 @@ from junifer.stats import count, get_aggfunc_by_name, select, winsorized_mean
|
|
25
25
|
("mode", {"keepdims": True}),
|
26
26
|
],
|
27
27
|
)
|
28
|
-
def test_get_aggfunc_by_name(name: str, params: Optional[
|
28
|
+
def test_get_aggfunc_by_name(name: str, params: Optional[dict]) -> None:
|
29
29
|
"""Test aggregation function retrieval by name.
|
30
30
|
|
31
31
|
Parameters
|
junifer/typing/_typing.py
CHANGED
@@ -3,12 +3,9 @@
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
5
5
|
|
6
|
+
from collections.abc import MutableMapping, Sequence
|
6
7
|
from typing import (
|
7
8
|
TYPE_CHECKING,
|
8
|
-
AbstractSet,
|
9
|
-
MutableMapping,
|
10
|
-
Sequence,
|
11
|
-
Type,
|
12
9
|
Union,
|
13
10
|
)
|
14
11
|
|
@@ -34,10 +31,10 @@ __all__ = [
|
|
34
31
|
]
|
35
32
|
|
36
33
|
|
37
|
-
DataGrabberLike =
|
38
|
-
PreprocessorLike =
|
39
|
-
MarkerLike =
|
40
|
-
StorageLike =
|
34
|
+
DataGrabberLike = type["BaseDataGrabber"]
|
35
|
+
PreprocessorLike = type["BasePreprocessor"]
|
36
|
+
MarkerLike = type["BaseMarker"]
|
37
|
+
StorageLike = type["BaseFeatureStorage"]
|
41
38
|
PipelineComponent = Union[
|
42
39
|
"DataGrabberLike",
|
43
40
|
"DefaultDataReader",
|
@@ -45,7 +42,7 @@ PipelineComponent = Union[
|
|
45
42
|
"MarkerLike",
|
46
43
|
"StorageLike",
|
47
44
|
]
|
48
|
-
Dependencies =
|
45
|
+
Dependencies = set[str]
|
49
46
|
ConditionalDependencies = Sequence[
|
50
47
|
MutableMapping[
|
51
48
|
str,
|
junifer/utils/helpers.py
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
import collections.abc
|
7
7
|
import subprocess
|
8
8
|
import sys
|
9
|
-
from typing import Dict, List
|
10
9
|
|
11
10
|
from .logging import logger, raise_error
|
12
11
|
|
@@ -14,7 +13,7 @@ from .logging import logger, raise_error
|
|
14
13
|
__all__ = ["run_ext_cmd", "deep_update"]
|
15
14
|
|
16
15
|
|
17
|
-
def run_ext_cmd(name: str, cmd:
|
16
|
+
def run_ext_cmd(name: str, cmd: list[str]) -> None:
|
18
17
|
"""Run external command via subprocess.
|
19
18
|
|
20
19
|
Parameters
|
@@ -58,7 +57,7 @@ def run_ext_cmd(name: str, cmd: List[str]) -> None:
|
|
58
57
|
)
|
59
58
|
|
60
59
|
|
61
|
-
def deep_update(d:
|
60
|
+
def deep_update(d: dict, u: dict) -> dict:
|
62
61
|
"""Deep update `d` with `u`.
|
63
62
|
|
64
63
|
From: "https://stackoverflow.com/questions/3232943/update-value-of-a-nested
|
junifer/utils/logging.py
CHANGED
@@ -16,7 +16,7 @@ import logging
|
|
16
16
|
import warnings
|
17
17
|
from pathlib import Path
|
18
18
|
from subprocess import PIPE, Popen, TimeoutExpired
|
19
|
-
from typing import
|
19
|
+
from typing import NoReturn, Optional, Union
|
20
20
|
from warnings import warn
|
21
21
|
|
22
22
|
import datalad
|
@@ -119,7 +119,7 @@ def _get_git_head(path: Path) -> str:
|
|
119
119
|
return proc_stdout
|
120
120
|
|
121
121
|
|
122
|
-
def get_versions() ->
|
122
|
+
def get_versions() -> dict:
|
123
123
|
"""Import stuff and get versions if module.
|
124
124
|
|
125
125
|
Returns
|
@@ -189,7 +189,7 @@ def _close_handlers(logger: logging.Logger) -> None:
|
|
189
189
|
logger.removeHandler(handler)
|
190
190
|
|
191
191
|
|
192
|
-
def _safe_log(versions:
|
192
|
+
def _safe_log(versions: dict, name: str) -> None:
|
193
193
|
"""Log with safety.
|
194
194
|
|
195
195
|
Parameters
|
@@ -308,7 +308,7 @@ def configure_logging(
|
|
308
308
|
|
309
309
|
def raise_error(
|
310
310
|
msg: str,
|
311
|
-
klass:
|
311
|
+
klass: type[Exception] = ValueError,
|
312
312
|
exception: Optional[Exception] = None,
|
313
313
|
) -> NoReturn:
|
314
314
|
"""Raise error, but first log it.
|
@@ -331,7 +331,7 @@ def raise_error(
|
|
331
331
|
|
332
332
|
|
333
333
|
def warn_with_log(
|
334
|
-
msg: str, category: Optional[
|
334
|
+
msg: str, category: Optional[type[Warning]] = RuntimeWarning
|
335
335
|
) -> None:
|
336
336
|
"""Warn, but first log it.
|
337
337
|
|
junifer/utils/singleton.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# License: AGPL
|
6
6
|
|
7
7
|
from abc import ABCMeta
|
8
|
-
from typing import Any, ClassVar
|
8
|
+
from typing import Any, ClassVar
|
9
9
|
|
10
10
|
|
11
11
|
__all__ = ["Singleton", "ABCSingleton"]
|
@@ -21,9 +21,9 @@ class Singleton(type):
|
|
21
21
|
|
22
22
|
"""
|
23
23
|
|
24
|
-
instances: ClassVar[
|
24
|
+
instances: ClassVar[dict] = {}
|
25
25
|
|
26
|
-
def __call__(cls, *args: Any, **kwargs: Any) ->
|
26
|
+
def __call__(cls, *args: Any, **kwargs: Any) -> type:
|
27
27
|
"""Get the only instance for a class.
|
28
28
|
|
29
29
|
Parameters
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.6.
|
3
|
+
Version: 0.0.6.dev258
|
4
4
|
Summary: JUelich NeuroImaging FEature extractoR
|
5
5
|
Author-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
|
6
6
|
Maintainer-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -24,7 +24,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.11
|
25
25
|
Classifier: Programming Language :: Python :: 3.12
|
26
26
|
Classifier: Programming Language :: Python :: 3.13
|
27
|
-
Requires-Python: >=3.
|
27
|
+
Requires-Python: >=3.9
|
28
28
|
Description-Content-Type: text/markdown
|
29
29
|
License-File: LICENSE.md
|
30
30
|
License-File: AUTHORS.rst
|