junifer 0.0.6.dev538__py3-none-any.whl → 0.0.7.dev43__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 +0 -1
- junifer/api/functions.py +1 -2
- junifer/api/queue_context/gnu_parallel_local_adapter.py +4 -7
- junifer/api/queue_context/htcondor_adapter.py +6 -10
- junifer/cli/tests/test_parser.py +66 -0
- junifer/data/_dispatch.py +5 -5
- junifer/data/coordinates/_ants_coordinates_warper.py +1 -1
- junifer/data/coordinates/_coordinates.py +1 -1
- junifer/data/coordinates/_fsl_coordinates_warper.py +1 -1
- junifer/data/coordinates/tests/test_coordinates.py +38 -16
- junifer/data/masks/_ants_mask_warper.py +1 -1
- junifer/data/masks/_fsl_mask_warper.py +1 -1
- junifer/data/masks/tests/test_masks.py +66 -33
- junifer/data/parcellations/_ants_parcellation_warper.py +1 -1
- junifer/data/parcellations/_fsl_parcellation_warper.py +1 -1
- junifer/data/parcellations/_parcellations.py +7 -7
- junifer/data/parcellations/tests/test_parcellations.py +162 -76
- junifer/data/tests/test_data_utils.py +0 -1
- junifer/data/utils.py +1 -1
- junifer/datagrabber/aomic/id1000.py +6 -0
- junifer/datagrabber/aomic/piop1.py +4 -3
- junifer/datagrabber/aomic/piop2.py +4 -3
- junifer/datagrabber/pattern_datalad.py +0 -1
- junifer/datagrabber/pattern_validation_mixin.py +0 -1
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +4 -8
- junifer/external/nilearn/junifer_connectivity_measure.py +32 -3
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +45 -1
- junifer/markers/base.py +3 -3
- junifer/markers/brainprint.py +5 -5
- junifer/markers/complexity/multiscale_entropy_auc.py +3 -3
- junifer/markers/complexity/range_entropy.py +3 -3
- junifer/markers/complexity/sample_entropy.py +3 -3
- junifer/markers/falff/falff_parcels.py +2 -6
- junifer/markers/falff/falff_spheres.py +2 -6
- junifer/markers/functional_connectivity/functional_connectivity_base.py +7 -5
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +2 -1
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +2 -1
- junifer/markers/reho/_afni_reho.py +1 -1
- junifer/markers/reho/reho_base.py +0 -1
- junifer/markers/reho/reho_parcels.py +0 -1
- junifer/markers/reho/reho_spheres.py +0 -1
- junifer/markers/temporal_snr/temporal_snr_base.py +0 -1
- junifer/markers/tests/test_markers_base.py +0 -1
- junifer/onthefly/_brainprint.py +3 -3
- junifer/onthefly/read_transform.py +1 -2
- junifer/onthefly/tests/test_read_transform.py +0 -1
- junifer/pipeline/tests/test_marker_collection.py +2 -1
- junifer/pipeline/workdir_manager.py +1 -2
- junifer/preprocess/confounds/fmriprep_confound_remover.py +1 -1
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +0 -1
- junifer/preprocess/smoothing/tests/test_smoothing.py +0 -1
- junifer/preprocess/warping/_ants_warper.py +2 -3
- junifer/preprocess/warping/_fsl_warper.py +1 -1
- junifer/preprocess/warping/space_warper.py +4 -2
- junifer/storage/pandas_base.py +3 -1
- junifer/storage/sqlite.py +3 -8
- junifer/storage/tests/test_pandas_base.py +6 -3
- junifer/storage/tests/test_storage_base.py +2 -1
- junifer/utils/logging.py +38 -128
- junifer/utils/tests/test_logging.py +12 -4
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/METADATA +3 -2
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/RECORD +68 -91
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/WHEEL +1 -1
- junifer/data/coordinates/VOIs/meta/AutobiographicalMemory_VOIs.txt +0 -23
- junifer/data/coordinates/VOIs/meta/CogAC_VOIs.txt +0 -19
- junifer/data/coordinates/VOIs/meta/CogAR_VOIs.txt +0 -8
- junifer/data/coordinates/VOIs/meta/DMNBuckner_VOIs.txt +0 -6
- junifer/data/coordinates/VOIs/meta/Dosenbach2010_MNI_VOIs.txt +0 -160
- junifer/data/coordinates/VOIs/meta/Empathy_VOIs.txt +0 -22
- junifer/data/coordinates/VOIs/meta/Motor_VOIs.txt +0 -10
- junifer/data/coordinates/VOIs/meta/MultiTask_VOIs.txt +0 -9
- junifer/data/coordinates/VOIs/meta/PhysioStress_VOIs.txt +0 -18
- junifer/data/coordinates/VOIs/meta/Power2011_MNI_VOIs.txt +0 -264
- junifer/data/coordinates/VOIs/meta/Power2013_MNI_VOIs.tsv +0 -264
- junifer/data/coordinates/VOIs/meta/Rew_VOIs.txt +0 -25
- junifer/data/coordinates/VOIs/meta/Somatosensory_VOIs.txt +0 -10
- junifer/data/coordinates/VOIs/meta/ToM_VOIs.txt +0 -15
- junifer/data/coordinates/VOIs/meta/VigAtt_VOIs.txt +0 -16
- junifer/data/coordinates/VOIs/meta/WM_VOIs.txt +0 -23
- junifer/data/coordinates/VOIs/meta/eMDN_VOIs.txt +0 -17
- junifer/data/coordinates/VOIs/meta/eSAD_VOIs.txt +0 -12
- junifer/data/coordinates/VOIs/meta/extDMN_VOIs.txt +0 -16
- junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
- junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean.nii.gz +0 -0
- junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean_3mm.nii.gz +0 -0
- junifer/data/masks/vickery-patil/GMprob0.2_cortex_3mm_NA_rm.nii.gz +0 -0
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/licenses/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/licenses/LICENSE.md +0 -0
- {junifer-0.0.6.dev538.dist-info → junifer-0.0.7.dev43.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,8 @@ def test_BaseFeatureStorage_abstractness() -> None:
|
|
13
13
|
"""Test BaseFeatureStorage is abstract base class."""
|
14
14
|
with pytest.raises(TypeError, match=r"abstract"):
|
15
15
|
BaseFeatureStorage(
|
16
|
-
uri="/tmp",
|
16
|
+
uri="/tmp",
|
17
|
+
storage_types=["matrix"], # type: ignore
|
17
18
|
)
|
18
19
|
|
19
20
|
|
junifer/utils/logging.py
CHANGED
@@ -8,15 +8,14 @@ import os
|
|
8
8
|
import sys
|
9
9
|
|
10
10
|
|
11
|
-
if sys.version_info < (3, 12):
|
11
|
+
if sys.version_info < (3, 12): # pragma: no cover
|
12
12
|
from distutils.version import LooseVersion
|
13
|
-
else:
|
13
|
+
else:
|
14
14
|
from looseversion import LooseVersion
|
15
15
|
|
16
16
|
import logging
|
17
17
|
import warnings
|
18
18
|
from pathlib import Path
|
19
|
-
from subprocess import PIPE, Popen, TimeoutExpired
|
20
19
|
from typing import ClassVar, NoReturn, Optional, Union
|
21
20
|
from warnings import warn
|
22
21
|
|
@@ -77,7 +76,7 @@ class WrapStdOut(logging.StreamHandler):
|
|
77
76
|
# just stdout) in order for this to work (tested on OSX and Linux)
|
78
77
|
if hasattr(sys.stdout, name):
|
79
78
|
return getattr(sys.stdout, name)
|
80
|
-
else:
|
79
|
+
else: # pragma: no cover
|
81
80
|
raise AttributeError(f"'file' object has not attribute '{name}'")
|
82
81
|
|
83
82
|
|
@@ -107,11 +106,13 @@ class ColorFormatter(logging.Formatter):
|
|
107
106
|
COLOR_SEQ: str = "\033[1;%dm"
|
108
107
|
BOLD_SEQ: str = "\033[1m"
|
109
108
|
|
110
|
-
def __init__(
|
109
|
+
def __init__(
|
110
|
+
self, fmt: str, datefmt: Optional[str] = None
|
111
|
+
) -> None: # pragma: no cover
|
111
112
|
"""Initialize the ColorFormatter."""
|
112
113
|
logging.Formatter.__init__(self, fmt, datefmt)
|
113
114
|
|
114
|
-
def format(self, record: logging.LogRecord) -> str:
|
115
|
+
def format(self, record: logging.LogRecord) -> str: # pragma: no cover
|
115
116
|
"""Format the log record.
|
116
117
|
|
117
118
|
Parameters
|
@@ -134,45 +135,6 @@ class ColorFormatter(logging.Formatter):
|
|
134
135
|
return logging.Formatter.format(self, record)
|
135
136
|
|
136
137
|
|
137
|
-
def _get_git_head(path: Path) -> str:
|
138
|
-
"""Aux function to read HEAD from git.
|
139
|
-
|
140
|
-
Parameters
|
141
|
-
----------
|
142
|
-
path : pathlib.Path
|
143
|
-
The path to read git HEAD from.
|
144
|
-
|
145
|
-
Returns
|
146
|
-
-------
|
147
|
-
str
|
148
|
-
Empty string if timeout expired for subprocess command execution else
|
149
|
-
git HEAD information.
|
150
|
-
|
151
|
-
Raises
|
152
|
-
------
|
153
|
-
FileNotFoundError
|
154
|
-
If ``path`` is invalid.
|
155
|
-
|
156
|
-
"""
|
157
|
-
if not path.exists():
|
158
|
-
raise_error(
|
159
|
-
msg=f"This path does not exist: {path}", klass=FileNotFoundError
|
160
|
-
)
|
161
|
-
command = f"cd {path}; git rev-parse --verify HEAD"
|
162
|
-
process = Popen(
|
163
|
-
args=command,
|
164
|
-
stdout=PIPE,
|
165
|
-
shell=True,
|
166
|
-
)
|
167
|
-
try:
|
168
|
-
stdout, _ = process.communicate(timeout=10)
|
169
|
-
proc_stdout = stdout.strip().decode()
|
170
|
-
except TimeoutExpired:
|
171
|
-
process.kill()
|
172
|
-
proc_stdout = ""
|
173
|
-
return proc_stdout
|
174
|
-
|
175
|
-
|
176
138
|
def get_versions() -> dict:
|
177
139
|
"""Import stuff and get versions if module.
|
178
140
|
|
@@ -182,52 +144,22 @@ def get_versions() -> dict:
|
|
182
144
|
The module names and corresponding versions.
|
183
145
|
|
184
146
|
"""
|
147
|
+
# Setup dictionary to track versions of modules
|
185
148
|
module_versions = {}
|
186
149
|
for name, module in sys.modules.copy().items():
|
187
150
|
# Bypassing sub-modules of packages and
|
188
151
|
# allowing ruamel.yaml
|
189
152
|
if "." in name and name != "ruamel.yaml":
|
190
153
|
continue
|
191
|
-
|
192
|
-
continue
|
154
|
+
# Get version or None as string
|
193
155
|
vstring = str(getattr(module, "__version__", None))
|
194
|
-
|
195
|
-
module_version = getattr(
|
196
|
-
if module_version is None:
|
197
|
-
module_version = None
|
198
|
-
elif "git" in module_version:
|
199
|
-
git_path = Path(module.__file__).resolve().parent # type: ignore
|
200
|
-
head = _get_git_head(git_path)
|
201
|
-
module_version += f"-HEAD:{head}"
|
202
|
-
|
156
|
+
# Get module version
|
157
|
+
module_version = getattr(LooseVersion(vstring), "vstring", None)
|
203
158
|
module_versions[name] = module_version
|
204
159
|
return module_versions
|
205
160
|
|
206
161
|
|
207
|
-
|
208
|
-
# """Get versions of external tools used by junifer.
|
209
|
-
|
210
|
-
# Parameters
|
211
|
-
# ----------
|
212
|
-
# tbox_path : pathlib.Path
|
213
|
-
# The path to external toolboxes.
|
214
|
-
|
215
|
-
# Returns
|
216
|
-
# -------
|
217
|
-
# dict
|
218
|
-
# The dependency information.
|
219
|
-
|
220
|
-
# """
|
221
|
-
# versions = {}
|
222
|
-
# # spm_path = tbox_path / 'spm12'
|
223
|
-
# # if spm_path.exists():
|
224
|
-
# # head = _get_git_head(spm_path)
|
225
|
-
# # module_version = 'SPM12-HEAD:{}'.format(head)
|
226
|
-
# # versions['spm'] = module_version
|
227
|
-
# return versions
|
228
|
-
|
229
|
-
|
230
|
-
def _close_handlers(logger: logging.Logger) -> None:
|
162
|
+
def _close_handlers(logger: logging.Logger) -> None: # pragma: no cover
|
231
163
|
"""Safely close relevant handlers for logger.
|
232
164
|
|
233
165
|
Parameters
|
@@ -243,55 +175,37 @@ def _close_handlers(logger: logging.Logger) -> None:
|
|
243
175
|
logger.removeHandler(handler)
|
244
176
|
|
245
177
|
|
246
|
-
def
|
247
|
-
"""Log
|
248
|
-
|
249
|
-
Parameters
|
250
|
-
----------
|
251
|
-
versions : dict
|
252
|
-
The dictionary with keys as dependency names and values as the
|
253
|
-
versions.
|
254
|
-
name : str
|
255
|
-
The dependency to look up in `versions`.
|
256
|
-
|
257
|
-
"""
|
258
|
-
if name in versions:
|
259
|
-
logger.info(f"{name}: {versions[name]}")
|
260
|
-
|
261
|
-
|
262
|
-
def log_versions(tbox_path: Optional[Path] = None) -> None:
|
263
|
-
"""Log versions of dependencies and junifer.
|
264
|
-
|
265
|
-
If `tbox_path` is specified, can also log versions of external toolboxes.
|
266
|
-
|
267
|
-
Parameters
|
268
|
-
----------
|
269
|
-
tbox_path : pathlib.Path, optional
|
270
|
-
The path to external toolboxes (default None).
|
271
|
-
|
272
|
-
"""
|
178
|
+
def log_versions() -> None:
|
179
|
+
"""Log versions of dependencies and junifer."""
|
273
180
|
# Get versions of all found packages
|
274
181
|
versions = get_versions()
|
275
|
-
|
182
|
+
# Set packages to log
|
183
|
+
pkgs_to_log = [
|
184
|
+
"click",
|
185
|
+
"numpy",
|
186
|
+
"scipy",
|
187
|
+
"datalad",
|
188
|
+
"pandas",
|
189
|
+
"nibabel",
|
190
|
+
"nilearn",
|
191
|
+
"sqlalchemy",
|
192
|
+
"ruamel.yaml",
|
193
|
+
"h5py",
|
194
|
+
"tqdm",
|
195
|
+
"templateflow",
|
196
|
+
"lapy",
|
197
|
+
"junifer_data",
|
198
|
+
"junifer",
|
199
|
+
]
|
200
|
+
# Log
|
276
201
|
logger.info("===== Lib Versions =====")
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
_safe_log(versions, "nipype")
|
281
|
-
_safe_log(versions, "nitime")
|
282
|
-
_safe_log(versions, "nilearn")
|
283
|
-
_safe_log(versions, "nibabel")
|
284
|
-
_safe_log(versions, "junifer")
|
202
|
+
for pkg in pkgs_to_log:
|
203
|
+
if pkg in versions:
|
204
|
+
logger.info(f"{pkg}: {versions[pkg]}")
|
285
205
|
logger.info("========================")
|
286
206
|
|
287
|
-
if tbox_path is not None:
|
288
|
-
# ext_versions = get_ext_versions(tbox_path)
|
289
|
-
# logger.info('spm: {}'.format(ext_versions['spm']))
|
290
|
-
# logger.info('========================')
|
291
|
-
pass
|
292
|
-
|
293
207
|
|
294
|
-
def _can_use_color(handler: logging.Handler) -> bool:
|
208
|
+
def _can_use_color(handler: logging.Handler) -> bool: # pragma: no cover
|
295
209
|
"""Check if color can be used in the logging output.
|
296
210
|
|
297
211
|
Parameters
|
@@ -391,11 +305,7 @@ def configure_logging(
|
|
391
305
|
# Set logging format
|
392
306
|
if output_format is None:
|
393
307
|
output_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
394
|
-
|
395
|
-
# "%(asctime)s [%(levelname)s] %(message)s "
|
396
|
-
# "(%(filename)s:%(lineno)s)"
|
397
|
-
# )
|
398
|
-
if _can_use_color(lh):
|
308
|
+
if _can_use_color(lh): # pragma: no cover
|
399
309
|
formatter = ColorFormatter(fmt=output_format)
|
400
310
|
else:
|
401
311
|
formatter = logging.Formatter(fmt=output_format)
|
@@ -68,7 +68,9 @@ def test_log_file(tmp_path: Path) -> None:
|
|
68
68
|
assert any("Warn message" in line for line in lines)
|
69
69
|
assert any("Error message" in line for line in lines)
|
70
70
|
|
71
|
-
configure_logging(
|
71
|
+
configure_logging(
|
72
|
+
fname=str((tmp_path / "test2.log").resolve()), level="INFO"
|
73
|
+
)
|
72
74
|
logger.debug("Debug message")
|
73
75
|
logger.info("Info message")
|
74
76
|
logger.warning("Warn message")
|
@@ -81,7 +83,9 @@ def test_log_file(tmp_path: Path) -> None:
|
|
81
83
|
assert any("Warn message" in line for line in lines)
|
82
84
|
assert any("Error message" in line for line in lines)
|
83
85
|
|
84
|
-
configure_logging(
|
86
|
+
configure_logging(
|
87
|
+
fname=tmp_path / "test3.log", level="WARNING", level_datalad="WARNING"
|
88
|
+
)
|
85
89
|
logger.debug("Debug message")
|
86
90
|
logger.info("Info message")
|
87
91
|
logger.warning("Warn message")
|
@@ -94,7 +98,7 @@ def test_log_file(tmp_path: Path) -> None:
|
|
94
98
|
assert any("Warn message" in line for line in lines)
|
95
99
|
assert any("Error message" in line for line in lines)
|
96
100
|
|
97
|
-
configure_logging(fname=tmp_path / "test4.log", level=
|
101
|
+
configure_logging(fname=tmp_path / "test4.log", level=logging.ERROR)
|
98
102
|
logger.debug("Debug message")
|
99
103
|
logger.info("Info message")
|
100
104
|
logger.warning("Warn message")
|
@@ -107,7 +111,11 @@ def test_log_file(tmp_path: Path) -> None:
|
|
107
111
|
assert any("Error message" in line for line in lines)
|
108
112
|
|
109
113
|
with pytest.warns(UserWarning, match="to avoid this message"):
|
110
|
-
configure_logging(
|
114
|
+
configure_logging(
|
115
|
+
fname=tmp_path / "test4.log",
|
116
|
+
level="WARNING",
|
117
|
+
level_datalad=logging.WARNING,
|
118
|
+
)
|
111
119
|
logger.debug("Debug2 message")
|
112
120
|
logger.info("Info2 message")
|
113
121
|
logger.warning("Warn2 message")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.7.dev43
|
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>
|
@@ -57,6 +57,8 @@ Requires-Dist: neurokit2>=0.1.7; extra == "neurokit2"
|
|
57
57
|
Provides-Extra: dev
|
58
58
|
Requires-Dist: tox; extra == "dev"
|
59
59
|
Requires-Dist: pre-commit; extra == "dev"
|
60
|
+
Requires-Dist: ruff; extra == "dev"
|
61
|
+
Requires-Dist: towncrier; extra == "dev"
|
60
62
|
Provides-Extra: docs
|
61
63
|
Requires-Dist: seaborn<0.14.0,>=0.13.0; extra == "docs"
|
62
64
|
Requires-Dist: sphinx<8.1.0,>=7.3.0; extra == "docs"
|
@@ -81,7 +83,6 @@ Dynamic: license-file
|
|
81
83
|
[](https://anaconda.org/conda-forge/junifer)
|
82
84
|

|
83
85
|

|
84
|
-
[](https://github.com/psf/black)
|
85
86
|
[](https://github.com/charliermarsh/ruff)
|
86
87
|
[](https://github.com/pre-commit/pre-commit)
|
87
88
|
[](https://doi.org/10.5281/zenodo.8176570)
|