junifer 0.0.7.dev332__py3-none-any.whl → 0.0.8__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.
Files changed (293) hide show
  1. junifer/_version.py +9 -19
  2. junifer/api/__init__.pyi +17 -2
  3. junifer/api/functions.py +222 -39
  4. junifer/api/queue_context/__init__.pyi +11 -3
  5. junifer/api/queue_context/gnu_parallel_local_adapter.py +81 -120
  6. junifer/api/queue_context/htcondor_adapter.py +118 -181
  7. junifer/api/queue_context/queue_context_adapter.py +51 -7
  8. junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +10 -35
  9. junifer/api/queue_context/tests/test_htcondor_adapter.py +13 -50
  10. junifer/api/res/fsl/run_fsl_docker.sh +4 -0
  11. junifer/api/tests/test_functions.py +863 -36
  12. junifer/cli/__init__.py +1 -7
  13. junifer/cli/cli.py +41 -22
  14. junifer/cli/parser.py +23 -147
  15. junifer/cli/tests/data/gmd_mean.yaml +6 -6
  16. junifer/cli/tests/data/gmd_mean_htcondor.yaml +6 -5
  17. junifer/cli/tests/data/partly_cloudy_agg_mean_tian.yml +1 -0
  18. junifer/cli/tests/test_cli.py +120 -4
  19. junifer/cli/tests/test_cli_utils.py +23 -6
  20. junifer/cli/utils.py +14 -9
  21. junifer/configs/__init__.py +5 -0
  22. junifer/configs/__init__.pyi +0 -0
  23. junifer/configs/juseless/datagrabbers/__init__.pyi +4 -2
  24. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +18 -24
  25. junifer/configs/juseless/datagrabbers/camcan_vbm.py +20 -27
  26. junifer/configs/juseless/datagrabbers/ixi_vbm.py +44 -52
  27. junifer/configs/juseless/datagrabbers/tests/test_ixi_vbm.py +0 -7
  28. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -19
  29. junifer/configs/juseless/datagrabbers/ucla.py +111 -104
  30. junifer/configs/juseless/datagrabbers/ukb_vbm.py +19 -25
  31. junifer/configs/py.typed +0 -0
  32. junifer/conftest.py +63 -24
  33. junifer/data/_dispatch.py +9 -19
  34. junifer/data/coordinates/_ants_coordinates_warper.py +4 -1
  35. junifer/data/coordinates/_coordinates.py +51 -6
  36. junifer/data/coordinates/_fsl_coordinates_warper.py +4 -1
  37. junifer/data/coordinates/tests/test_coordinates.py +15 -3
  38. junifer/data/coordinates/tests/test_coordinates_names.py +37 -0
  39. junifer/data/maps/_ants_maps_warper.py +18 -12
  40. junifer/data/maps/_fsl_maps_warper.py +7 -3
  41. junifer/data/maps/_maps.py +12 -8
  42. junifer/data/maps/tests/test_maps.py +13 -21
  43. junifer/data/masks/_ants_mask_warper.py +18 -12
  44. junifer/data/masks/_fsl_mask_warper.py +7 -3
  45. junifer/data/masks/_masks.py +15 -12
  46. junifer/data/masks/tests/test_masks.py +20 -17
  47. junifer/data/parcellations/_ants_parcellation_warper.py +18 -12
  48. junifer/data/parcellations/_fsl_parcellation_warper.py +7 -5
  49. junifer/data/parcellations/_parcellations.py +125 -91
  50. junifer/data/parcellations/tests/test_parcellations.py +122 -1
  51. junifer/data/template_spaces.py +117 -50
  52. junifer/data/tests/test_template_spaces.py +10 -7
  53. junifer/data/utils.py +10 -8
  54. junifer/datagrabber/__init__.pyi +38 -5
  55. junifer/datagrabber/aomic/__init__.pyi +8 -1
  56. junifer/datagrabber/aomic/_types.py +22 -0
  57. junifer/datagrabber/aomic/id1000.py +193 -183
  58. junifer/datagrabber/aomic/piop1.py +215 -259
  59. junifer/datagrabber/aomic/piop2.py +211 -244
  60. junifer/datagrabber/aomic/tests/test_id1000.py +70 -53
  61. junifer/datagrabber/aomic/tests/test_piop1.py +98 -102
  62. junifer/datagrabber/aomic/tests/test_piop2.py +88 -85
  63. junifer/datagrabber/base.py +253 -79
  64. junifer/datagrabber/datalad_base.py +127 -76
  65. junifer/datagrabber/dmcc13_benchmark.py +204 -289
  66. junifer/datagrabber/hcp1200/__init__.pyi +7 -2
  67. junifer/datagrabber/hcp1200/datalad_hcp1200.py +61 -40
  68. junifer/datagrabber/hcp1200/hcp1200.py +151 -164
  69. junifer/datagrabber/hcp1200/tests/test_hcp1200.py +116 -128
  70. junifer/datagrabber/multiple.py +183 -63
  71. junifer/datagrabber/pattern.py +358 -227
  72. junifer/datagrabber/pattern_datalad.py +84 -124
  73. junifer/datagrabber/pattern_validation_mixin.py +22 -50
  74. junifer/datagrabber/tests/test_base.py +17 -4
  75. junifer/datagrabber/tests/test_datalad_base.py +20 -27
  76. junifer/datagrabber/tests/test_dmcc13_benchmark.py +110 -122
  77. junifer/datagrabber/tests/test_multiple.py +293 -31
  78. junifer/datagrabber/tests/test_pattern.py +577 -18
  79. junifer/datagrabber/tests/test_pattern_datalad.py +177 -107
  80. junifer/datagrabber/tests/test_pattern_validation_mixin.py +9 -51
  81. junifer/datareader/default.py +8 -5
  82. junifer/datareader/tests/test_default_reader.py +1 -1
  83. junifer/external/BrainPrint/.codecov.yml +2 -0
  84. junifer/external/BrainPrint/.codespellignore +2 -0
  85. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/bug-report.md +45 -0
  86. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/documentation.md +12 -0
  87. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/feature-request.md +24 -0
  88. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/questions-help-support.md +28 -0
  89. junifer/external/BrainPrint/.github/dependabot.yml +6 -0
  90. junifer/external/BrainPrint/.github/workflows/build.yml +53 -0
  91. junifer/external/BrainPrint/.github/workflows/code-style.yml +44 -0
  92. junifer/external/BrainPrint/.github/workflows/doc.yml +65 -0
  93. junifer/external/BrainPrint/.github/workflows/publish.yml +31 -0
  94. junifer/external/BrainPrint/.github/workflows/pytest.yml +54 -0
  95. junifer/external/BrainPrint/.gitignore +123 -0
  96. junifer/external/BrainPrint/LICENSE +21 -0
  97. junifer/external/BrainPrint/README.md +108 -0
  98. junifer/external/BrainPrint/brainprint/cli/__init__.py +11 -0
  99. junifer/external/BrainPrint/brainprint/cli/help_text.py +169 -0
  100. junifer/external/BrainPrint/brainprint/cli/parser.py +150 -0
  101. junifer/external/BrainPrint/brainprint/cli/utils.py +14 -0
  102. junifer/external/BrainPrint/brainprint/commands/__init__.py +0 -0
  103. junifer/external/BrainPrint/brainprint/commands/sys_info.py +18 -0
  104. junifer/external/BrainPrint/brainprint/utils/tests/__init__.py +0 -0
  105. junifer/external/BrainPrint/brainprint/utils/tests/test_config.py +33 -0
  106. junifer/external/BrainPrint/doc/Makefile +20 -0
  107. junifer/external/BrainPrint/doc/_static/.gitkeep +0 -0
  108. junifer/external/BrainPrint/doc/_templates/autosummary/class.rst +10 -0
  109. junifer/external/BrainPrint/doc/_templates/autosummary/function.rst +8 -0
  110. junifer/external/BrainPrint/doc/_templates/autosummary/module.rst +6 -0
  111. junifer/external/BrainPrint/doc/api/index.rst +11 -0
  112. junifer/external/BrainPrint/doc/conf.py +272 -0
  113. junifer/external/BrainPrint/doc/index.rst +140 -0
  114. junifer/external/BrainPrint/doc/links.inc +36 -0
  115. junifer/external/BrainPrint/doc/make.bat +35 -0
  116. junifer/external/BrainPrint/doc/references.bib +23 -0
  117. junifer/external/BrainPrint/pyproject.toml +170 -0
  118. junifer/external/BrainPrint/setup.py +3 -0
  119. junifer/external/__init__.py +5 -0
  120. junifer/external/__init__.pyi +0 -0
  121. junifer/external/nilearn/junifer_connectivity_measure.py +95 -39
  122. junifer/external/nilearn/junifer_nifti_spheres_masker.py +226 -67
  123. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +39 -27
  124. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +231 -21
  125. junifer/external/py.typed +0 -0
  126. junifer/markers/__init__.pyi +6 -3
  127. junifer/markers/base.py +126 -76
  128. junifer/markers/brainprint.py +30 -39
  129. junifer/markers/complexity/__init__.py +20 -3
  130. junifer/markers/complexity/complexity_base.py +40 -41
  131. junifer/markers/complexity/hurst_exponent.py +22 -35
  132. junifer/markers/complexity/multiscale_entropy_auc.py +53 -41
  133. junifer/markers/complexity/perm_entropy.py +22 -36
  134. junifer/markers/complexity/range_entropy.py +22 -35
  135. junifer/markers/complexity/range_entropy_auc.py +27 -36
  136. junifer/markers/complexity/sample_entropy.py +22 -36
  137. junifer/markers/complexity/tests/test_complexity_registry.py +48 -0
  138. junifer/markers/complexity/tests/test_hurst_exponent.py +47 -36
  139. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +50 -36
  140. junifer/markers/complexity/tests/test_perm_entropy.py +48 -36
  141. junifer/markers/complexity/tests/test_range_entropy.py +47 -36
  142. junifer/markers/complexity/tests/test_range_entropy_auc.py +47 -36
  143. junifer/markers/complexity/tests/test_sample_entropy.py +48 -36
  144. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +50 -36
  145. junifer/markers/complexity/weighted_perm_entropy.py +22 -36
  146. junifer/markers/ets_rss.py +35 -31
  147. junifer/markers/falff/__init__.pyi +7 -1
  148. junifer/markers/falff/_afni_falff.py +22 -9
  149. junifer/markers/falff/_junifer_falff.py +47 -31
  150. junifer/markers/falff/falff_base.py +80 -60
  151. junifer/markers/falff/falff_maps.py +17 -41
  152. junifer/markers/falff/falff_parcels.py +26 -51
  153. junifer/markers/falff/falff_spheres.py +34 -61
  154. junifer/markers/falff/tests/test_falff_maps.py +20 -23
  155. junifer/markers/falff/tests/test_falff_mask.py +99 -0
  156. junifer/markers/falff/tests/test_falff_parcels.py +14 -10
  157. junifer/markers/falff/tests/test_falff_spheres.py +14 -10
  158. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +32 -34
  159. junifer/markers/functional_connectivity/edge_functional_connectivity_maps.py +12 -25
  160. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +19 -34
  161. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +24 -44
  162. junifer/markers/functional_connectivity/functional_connectivity_base.py +50 -40
  163. junifer/markers/functional_connectivity/functional_connectivity_maps.py +12 -25
  164. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +19 -34
  165. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +24 -45
  166. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +21 -22
  167. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_maps.py +8 -7
  168. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +8 -4
  169. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +8 -4
  170. junifer/markers/functional_connectivity/tests/test_functional_connectivity_maps.py +8 -7
  171. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +9 -5
  172. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +8 -12
  173. junifer/markers/maps_aggregation.py +77 -55
  174. junifer/markers/parcel_aggregation.py +91 -70
  175. junifer/markers/reho/__init__.pyi +7 -1
  176. junifer/markers/reho/_afni_reho.py +23 -14
  177. junifer/markers/reho/_junifer_reho.py +112 -123
  178. junifer/markers/reho/reho_base.py +115 -37
  179. junifer/markers/reho/reho_maps.py +18 -32
  180. junifer/markers/reho/reho_parcels.py +26 -41
  181. junifer/markers/reho/reho_spheres.py +33 -54
  182. junifer/markers/reho/tests/test_junifer_reho.py +178 -0
  183. junifer/markers/reho/tests/test_reho_maps.py +27 -25
  184. junifer/markers/reho/tests/test_reho_parcels.py +28 -22
  185. junifer/markers/reho/tests/test_reho_spheres.py +16 -12
  186. junifer/markers/sphere_aggregation.py +88 -72
  187. junifer/markers/temporal_snr/temporal_snr_base.py +32 -30
  188. junifer/markers/temporal_snr/temporal_snr_maps.py +9 -18
  189. junifer/markers/temporal_snr/temporal_snr_parcels.py +19 -27
  190. junifer/markers/temporal_snr/temporal_snr_spheres.py +27 -41
  191. junifer/markers/temporal_snr/tests/test_temporal_snr_base.py +2 -2
  192. junifer/markers/temporal_snr/tests/test_temporal_snr_maps.py +17 -22
  193. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +11 -3
  194. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +9 -9
  195. junifer/markers/tests/test_brainprint.py +10 -9
  196. junifer/markers/tests/test_ets_rss.py +7 -3
  197. junifer/markers/tests/test_lost_regions.py +279 -0
  198. junifer/markers/tests/test_maps_aggregation.py +67 -114
  199. junifer/markers/tests/test_marker_utils.py +40 -1
  200. junifer/markers/tests/test_markers_base.py +275 -6
  201. junifer/markers/tests/test_parcel_aggregation.py +91 -53
  202. junifer/markers/tests/test_sphere_aggregation.py +53 -47
  203. junifer/markers/utils.py +267 -5
  204. junifer/onthefly/__init__.py +2 -3
  205. junifer/onthefly/__init__.pyi +4 -0
  206. junifer/onthefly/_brainprint.py +3 -5
  207. junifer/onthefly/py.typed +0 -0
  208. junifer/onthefly/read_transform.py +11 -9
  209. junifer/onthefly/tests/test_read_transform.py +7 -7
  210. junifer/pipeline/__init__.pyi +4 -2
  211. junifer/pipeline/marker_collection.py +14 -10
  212. junifer/pipeline/pipeline_component_registry.py +25 -6
  213. junifer/pipeline/pipeline_step_mixin.py +5 -12
  214. junifer/pipeline/tests/test_data_object_dumper.py +10 -10
  215. junifer/pipeline/tests/test_marker_collection.py +145 -168
  216. junifer/pipeline/tests/test_pipeline_component_registry.py +52 -8
  217. junifer/pipeline/tests/test_pipeline_step_mixin.py +12 -26
  218. junifer/pipeline/tests/test_update_meta_mixin.py +4 -5
  219. junifer/pipeline/tests/test_workdir_manager.py +39 -0
  220. junifer/pipeline/update_meta_mixin.py +13 -10
  221. junifer/pipeline/utils.py +22 -17
  222. junifer/pipeline/workdir_manager.py +41 -32
  223. junifer/preprocess/__init__.pyi +9 -4
  224. junifer/preprocess/_temporal_filter.py +34 -33
  225. junifer/preprocess/_temporal_slicer.py +17 -30
  226. junifer/preprocess/base.py +99 -55
  227. junifer/preprocess/confounds/__init__.pyi +10 -2
  228. junifer/preprocess/confounds/fmriprep_confound_remover.py +87 -109
  229. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +64 -45
  230. junifer/preprocess/smoothing/__init__.pyi +2 -2
  231. junifer/preprocess/smoothing/_afni_smoothing.py +8 -7
  232. junifer/preprocess/smoothing/_fsl_smoothing.py +6 -4
  233. junifer/preprocess/smoothing/_nilearn_smoothing.py +7 -5
  234. junifer/preprocess/smoothing/smoothing.py +59 -40
  235. junifer/preprocess/smoothing/tests/test_smoothing.py +28 -8
  236. junifer/preprocess/tests/test_preprocess_base.py +17 -9
  237. junifer/preprocess/tests/test_temporal_filter.py +37 -16
  238. junifer/preprocess/tests/test_temporal_slicer.py +12 -12
  239. junifer/preprocess/warping/__init__.pyi +2 -2
  240. junifer/preprocess/warping/_ants_warper.py +56 -40
  241. junifer/preprocess/warping/_fsl_warper.py +49 -36
  242. junifer/preprocess/warping/_utils.py +106 -0
  243. junifer/preprocess/warping/space_warper.py +99 -98
  244. junifer/preprocess/warping/tests/test_space_warper.py +46 -41
  245. junifer/preprocess/warping/tests/test_warping_utils.py +163 -0
  246. junifer/stats.py +46 -34
  247. junifer/storage/__init__.pyi +8 -4
  248. junifer/storage/base.py +129 -64
  249. junifer/storage/hdf5.py +307 -199
  250. junifer/storage/pandas_base.py +46 -24
  251. junifer/storage/sqlite.py +99 -62
  252. junifer/storage/tests/data/collected_h5io_fork.hdf5 +0 -0
  253. junifer/storage/tests/test_hdf5.py +147 -12
  254. junifer/storage/tests/test_repeated_storage.py +293 -0
  255. junifer/storage/tests/test_sqlite.py +9 -20
  256. junifer/storage/tests/test_storage_base.py +18 -21
  257. junifer/storage/tests/test_utils.py +83 -22
  258. junifer/storage/utils.py +58 -38
  259. junifer/testing/__init__.pyi +2 -2
  260. junifer/testing/datagrabbers.py +480 -44
  261. junifer/testing/registry.py +12 -0
  262. junifer/testing/tests/test_adhdtesting_datagrabber.py +24 -0
  263. junifer/testing/tests/test_oasisvmbtesting_datagrabber.py +5 -0
  264. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +52 -0
  265. junifer/testing/tests/test_spmauditory_datagrabber.py +16 -0
  266. junifer/testing/tests/test_testing_registry.py +31 -0
  267. junifer/testing/tests/test_testing_utils.py +35 -0
  268. junifer/testing/tests/test_uclacnpvbmtesting_datagrabber.py +81 -0
  269. junifer/testing/utils.py +33 -1
  270. junifer/tests/test_stats.py +1 -5
  271. junifer/typing/__init__.pyi +2 -0
  272. junifer/typing/_typing.py +34 -19
  273. junifer/typing/py.typed +0 -0
  274. junifer/utils/__init__.pyi +10 -1
  275. junifer/utils/_config.py +1 -2
  276. junifer/utils/helpers.py +68 -2
  277. junifer/utils/logging.py +31 -7
  278. junifer/utils/tests/test_helpers.py +36 -1
  279. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/METADATA +43 -35
  280. junifer-0.0.8.dist-info/RECORD +402 -0
  281. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/WHEEL +1 -1
  282. junifer/cli/tests/test_parser.py +0 -280
  283. junifer/external/h5io/h5io/__init__.py +0 -15
  284. junifer/external/h5io/h5io/_h5io.py +0 -767
  285. junifer/external/h5io/h5io/_version.py +0 -1
  286. junifer/external/h5io/h5io/chunked_array.py +0 -94
  287. junifer/external/h5io/h5io/chunked_list.py +0 -65
  288. junifer/markers/complexity/__init__.pyi +0 -17
  289. junifer-0.0.7.dev332.dist-info/RECORD +0 -353
  290. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/entry_points.txt +0 -0
  291. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/AUTHORS.rst +0 -0
  292. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/LICENSE.md +0 -0
  293. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/top_level.txt +0 -0
@@ -7,65 +7,65 @@ import shutil
7
7
  import tempfile
8
8
  from collections.abc import Iterable
9
9
  from pathlib import Path
10
- from typing import Optional
11
10
 
11
+ import datalad.api as dl
12
12
  import pytest
13
+ from pydantic import AnyUrl
13
14
 
14
15
  from junifer.datagrabber import HCP1200, DataladHCP1200
16
+ from junifer.testing import config_override
15
17
  from junifer.utils import configure_logging
16
18
 
17
19
 
18
- URI = "https://gin.g-node.org/juaml/datalad-example-hcp1200"
19
-
20
-
21
20
  @pytest.fixture(scope="module")
22
21
  def hcpdg() -> Iterable[DataladHCP1200]:
23
22
  """Return a HCP1200 DataGrabber."""
24
23
  tmpdir = Path(tempfile.gettempdir())
25
- dg = DataladHCP1200(datadir=tmpdir / "datadir")
26
- # Set URI to Gin
27
- dg.uri = URI
28
- # Set correct root directory
29
- dg._rootdir = "."
30
- with dg:
24
+ dg = DataladHCP1200(
25
+ uri=AnyUrl(
26
+ "https://cerebra.fz-juelich.de/junifer/datalad-example-hcp1200.git"
27
+ ),
28
+ datadir=tmpdir / "hcp1200_test",
29
+ rootdir=Path("."),
30
+ )
31
+ with config_override("datagrabber.skipidcheck", True), dg:
31
32
  for t_elem in dg.get_elements():
32
33
  dg[t_elem]
33
34
  yield dg
34
- shutil.rmtree(tmpdir / "datadir", ignore_errors=True)
35
+ shutil.rmtree(tmpdir / "hcp1200_test", ignore_errors=True)
35
36
 
36
37
 
37
38
  @pytest.mark.parametrize(
38
39
  "tasks, phase_encodings, ica_fix, expected_path_name",
39
40
  [
40
- (None, None, False, "rfMRI_REST1_LR.nii.gz"),
41
41
  ("REST1", "LR", False, "rfMRI_REST1_LR.nii.gz"),
42
- ("REST1", "RL", False, "rfMRI_REST1_RL.nii.gz"),
42
+ (["REST1"], ["RL"], False, "rfMRI_REST1_RL.nii.gz"),
43
43
  ("REST2", "LR", False, "rfMRI_REST2_LR.nii.gz"),
44
- ("REST2", "RL", False, "rfMRI_REST2_RL.nii.gz"),
44
+ (["REST2"], ["RL"], False, "rfMRI_REST2_RL.nii.gz"),
45
45
  ("SOCIAL", "LR", False, "tfMRI_SOCIAL_LR.nii.gz"),
46
- ("SOCIAL", "RL", False, "tfMRI_SOCIAL_RL.nii.gz"),
46
+ (["SOCIAL"], ["RL"], False, "tfMRI_SOCIAL_RL.nii.gz"),
47
47
  ("WM", "LR", False, "tfMRI_WM_LR.nii.gz"),
48
- ("WM", "RL", False, "tfMRI_WM_RL.nii.gz"),
48
+ (["WM"], ["RL"], False, "tfMRI_WM_RL.nii.gz"),
49
49
  ("RELATIONAL", "LR", False, "tfMRI_RELATIONAL_LR.nii.gz"),
50
- ("RELATIONAL", "RL", False, "tfMRI_RELATIONAL_RL.nii.gz"),
50
+ (["RELATIONAL"], ["RL"], False, "tfMRI_RELATIONAL_RL.nii.gz"),
51
51
  ("EMOTION", "LR", False, "tfMRI_EMOTION_LR.nii.gz"),
52
- ("EMOTION", "RL", False, "tfMRI_EMOTION_RL.nii.gz"),
52
+ (["EMOTION"], ["RL"], False, "tfMRI_EMOTION_RL.nii.gz"),
53
53
  ("LANGUAGE", "LR", False, "tfMRI_LANGUAGE_LR.nii.gz"),
54
- ("LANGUAGE", "RL", False, "tfMRI_LANGUAGE_RL.nii.gz"),
54
+ (["LANGUAGE"], ["RL"], False, "tfMRI_LANGUAGE_RL.nii.gz"),
55
55
  ("GAMBLING", "LR", False, "tfMRI_GAMBLING_LR.nii.gz"),
56
- ("GAMBLING", "RL", False, "tfMRI_GAMBLING_RL.nii.gz"),
56
+ (["GAMBLING"], ["RL"], False, "tfMRI_GAMBLING_RL.nii.gz"),
57
57
  ("MOTOR", "LR", False, "tfMRI_MOTOR_LR.nii.gz"),
58
- ("MOTOR", "RL", False, "tfMRI_MOTOR_RL.nii.gz"),
58
+ (["MOTOR"], ["RL"], False, "tfMRI_MOTOR_RL.nii.gz"),
59
59
  ("REST1", "LR", True, "rfMRI_REST1_LR_hp2000_clean.nii.gz"),
60
- ("REST1", "RL", True, "rfMRI_REST1_RL_hp2000_clean.nii.gz"),
60
+ (["REST1"], ["RL"], True, "rfMRI_REST1_RL_hp2000_clean.nii.gz"),
61
61
  ("REST2", "LR", True, "rfMRI_REST2_LR_hp2000_clean.nii.gz"),
62
- ("REST2", "RL", True, "rfMRI_REST2_RL_hp2000_clean.nii.gz"),
62
+ (["REST2"], ["RL"], True, "rfMRI_REST2_RL_hp2000_clean.nii.gz"),
63
63
  ],
64
64
  )
65
65
  def test_HCP1200(
66
66
  hcpdg: DataladHCP1200,
67
- tasks: Optional[str],
68
- phase_encodings: Optional[str],
67
+ tasks: str | list[str],
68
+ phase_encodings: str | list[str],
69
69
  ica_fix: bool,
70
70
  expected_path_name: str,
71
71
  ) -> None:
@@ -76,9 +76,9 @@ def test_HCP1200(
76
76
  hcpdg : DataladHCP1200
77
77
  The Datalad version of the DataGrabber with the first subject
78
78
  already cloned.
79
- tasks : str
79
+ tasks : str or list of str
80
80
  The parametrized tasks.
81
- phase_encodings : str
81
+ phase_encodings : str or list of str
82
82
  The parametrized phase encodings.
83
83
  ica_fix : bool
84
84
  The parametrized ICA-FIX flag.
@@ -119,29 +119,29 @@ def test_HCP1200(
119
119
  "tasks, phase_encodings",
120
120
  [
121
121
  ("REST1", "LR"),
122
- ("REST1", "RL"),
122
+ (["REST1"], ["RL"]),
123
123
  ("REST2", "LR"),
124
- ("REST2", "RL"),
124
+ (["REST2"], ["RL"]),
125
125
  ("SOCIAL", "LR"),
126
- ("SOCIAL", "RL"),
126
+ (["SOCIAL"], ["RL"]),
127
127
  ("WM", "LR"),
128
- ("WM", "RL"),
128
+ (["WM"], ["RL"]),
129
129
  ("RELATIONAL", "LR"),
130
- ("RELATIONAL", "RL"),
130
+ (["RELATIONAL"], ["RL"]),
131
131
  ("EMOTION", "LR"),
132
- ("EMOTION", "RL"),
132
+ (["EMOTION"], ["RL"]),
133
133
  ("LANGUAGE", "LR"),
134
- ("LANGUAGE", "RL"),
134
+ (["LANGUAGE"], ["RL"]),
135
135
  ("GAMBLING", "LR"),
136
- ("GAMBLING", "RL"),
136
+ (["GAMBLING"], ["RL"]),
137
137
  ("MOTOR", "LR"),
138
- ("MOTOR", "RL"),
138
+ (["MOTOR"], ["RL"]),
139
139
  ],
140
140
  )
141
141
  def test_HCP1200_single_access(
142
142
  hcpdg: DataladHCP1200,
143
- tasks: Optional[str],
144
- phase_encodings: Optional[str],
143
+ tasks: str | list[str],
144
+ phase_encodings: str | list[str],
145
145
  ) -> None:
146
146
  """Test HCP1200 DataGrabber single access.
147
147
 
@@ -150,9 +150,9 @@ def test_HCP1200_single_access(
150
150
  hcpdg : DataladHCP1200
151
151
  The Datalad version of the DataGrabber with the first subject
152
152
  already cloned.
153
- tasks : str
153
+ tasks : str or list of str
154
154
  The parametrized tasks.
155
- phase_encodings : str
155
+ phase_encodings : str or list of str
156
156
  The parametrized phase encodings.
157
157
 
158
158
  """
@@ -167,21 +167,16 @@ def test_HCP1200_single_access(
167
167
  all_elements = dg.get_elements()
168
168
  # Check only specified task and phase encoding are found
169
169
  for element in all_elements:
170
- assert element[1] == tasks
171
- assert element[2] == phase_encodings
170
+ assert element[1] == tasks if isinstance(tasks, str) else tasks[0]
171
+ assert (
172
+ element[2] == phase_encodings
173
+ if isinstance(phase_encodings, str)
174
+ else phase_encodings[0]
175
+ )
172
176
 
173
177
 
174
- @pytest.mark.parametrize(
175
- "tasks, phase_encodings",
176
- [
177
- (["REST1", "REST2"], ["LR", "RL"]),
178
- (["REST1", "REST2"], None),
179
- ],
180
- )
181
178
  def test_HCP1200_multi_access(
182
179
  hcpdg: DataladHCP1200,
183
- tasks: Optional[str],
184
- phase_encodings: Optional[str],
185
180
  ) -> None:
186
181
  """Test HCP1200 DataGrabber multiple access.
187
182
 
@@ -190,17 +185,13 @@ def test_HCP1200_multi_access(
190
185
  hcpdg : DataladHCP1200
191
186
  The Datalad version of the DataGrabber with the first subject
192
187
  already cloned.
193
- tasks : str
194
- The parametrized tasks.
195
- phase_encodings : str
196
- The parametrized phase encodings.
197
188
 
198
189
  """
199
190
  configure_logging(level="DEBUG")
200
191
  dg = HCP1200(
201
192
  datadir=hcpdg.datadir,
202
- tasks=tasks,
203
- phase_encodings=phase_encodings,
193
+ tasks=["REST1", "REST2"],
194
+ phase_encodings=["LR", "RL"],
204
195
  )
205
196
  with dg:
206
197
  # Get all elements
@@ -265,70 +256,6 @@ def test_HCP1200_multi_access_phase_simple(
265
256
  assert element[2] == "LR"
266
257
 
267
258
 
268
- @pytest.mark.parametrize(
269
- "tasks, phase_encodings",
270
- [
271
- ("FOO", ["LR", "RL"]),
272
- ("FOO", "RL"),
273
- (["FOO", "BAR"], ["LR", "RL"]),
274
- (["FOO", "BAR"], "LR"),
275
- ],
276
- )
277
- def test_HCP1200_incorrect_access_task(
278
- tasks: Optional[str],
279
- phase_encodings: Optional[str],
280
- ) -> None:
281
- """Test HCP1200 DataGrabber incorrect access for task.
282
-
283
- Parameters
284
- ----------
285
- tasks : str
286
- The parametrized tasks.
287
- phase_encodings : str
288
- The parametrized phase encodings.
289
-
290
- """
291
- configure_logging(level="DEBUG")
292
- with pytest.raises(ValueError, match="not a valid HCP-YA fMRI task input"):
293
- _ = HCP1200(
294
- datadir=".",
295
- tasks=tasks,
296
- phase_encodings=phase_encodings,
297
- )
298
-
299
-
300
- @pytest.mark.parametrize(
301
- "tasks, phase_encodings",
302
- [
303
- ("REST1", ["FOO", "BAR"]),
304
- ("REST1", "FOO"),
305
- (["REST1", "REST2"], ["FOO", "BAR"]),
306
- (["REST1", "REST2"], "BAR"),
307
- ],
308
- )
309
- def test_HCP1200_incorrect_access_phase(
310
- tasks: Optional[str],
311
- phase_encodings: Optional[str],
312
- ) -> None:
313
- """Test HCP1200 DataGrabber incorrect access for phase.
314
-
315
- Parameters
316
- ----------
317
- tasks : str
318
- The parametrized tasks.
319
- phase_encodings : str
320
- The parametrized phase encodings.
321
-
322
- """
323
- configure_logging(level="DEBUG")
324
- with pytest.raises(ValueError, match="not a valid HCP-YA phase encoding"):
325
- _ = HCP1200(
326
- datadir=".",
327
- tasks=tasks,
328
- phase_encodings=phase_encodings,
329
- )
330
-
331
-
332
259
  def test_HCP1200_elements(
333
260
  hcpdg: DataladHCP1200,
334
261
  ) -> None:
@@ -364,23 +291,24 @@ def test_HCP1200_elements(
364
291
  @pytest.mark.parametrize(
365
292
  "tasks, ica_fix",
366
293
  [
367
- ("SOCIAL", True),
294
+ (["SOCIAL"], True),
368
295
  ("WM", True),
369
- ("RELATIONAL", True),
296
+ (["RELATIONAL"], True),
370
297
  ("EMOTION", True),
371
- ("LANGUAGE", True),
298
+ (["LANGUAGE"], True),
372
299
  ("GAMBLING", True),
373
- ("MOTOR", True),
300
+ (["MOTOR"], True),
374
301
  ],
375
302
  )
376
303
  def test_HCP1200_incorrect_access_icafix(
377
- tasks: Optional[str], ica_fix: bool
304
+ tasks: str | list[str],
305
+ ica_fix: bool,
378
306
  ) -> None:
379
307
  """Test HCP1200 DataGrabber incorrect access for icafix.
380
308
 
381
309
  Parameters
382
310
  ----------
383
- tasks : str
311
+ tasks : str or list of str
384
312
  The parametrized tasks.
385
313
  ica_fix : bool
386
314
  The parametrized ICA-FIX flag.
@@ -389,7 +317,67 @@ def test_HCP1200_incorrect_access_icafix(
389
317
  configure_logging(level="DEBUG")
390
318
  with pytest.raises(ValueError, match="is only available for"):
391
319
  _ = HCP1200(
392
- datadir=".",
320
+ datadir=Path("."),
393
321
  tasks=tasks,
394
322
  ica_fix=ica_fix,
395
323
  )
324
+
325
+
326
+ def test_DataladHCP1200_subdatasets(tmp_path: Path) -> None:
327
+ """Test DataladHCP1200 with a sub-dataset for each subject, as HCP.
328
+
329
+ Parameters
330
+ ----------
331
+ tmp_path : pathlib.Path
332
+ The path to the test directory.
333
+
334
+ """
335
+ dataset = dl.create(tmp_path / "origin", result_renderer="disabled")
336
+ for subject in ("100206", "100307"):
337
+ subdataset = dataset.create(subject, result_renderer="disabled")
338
+ for folder in ("rfMRI_REST1_LR", "tfMRI_WM_RL"):
339
+ path = (
340
+ subdataset.pathobj
341
+ / "MNINonLinear"
342
+ / "Results"
343
+ / folder
344
+ / f"{folder}.nii.gz"
345
+ )
346
+ path.parent.mkdir(parents=True)
347
+ path.write_text(f"{subject} {folder}")
348
+ path = subdataset.pathobj / "T1w" / "T1w_acpc_dc_restore.nii.gz"
349
+ path.parent.mkdir(parents=True)
350
+ path.write_text(f"{subject} T1w")
351
+ dataset.save(recursive=True, result_renderer="disabled")
352
+ dg = DataladHCP1200(
353
+ uri=AnyUrl(f"file://{dataset.path}"),
354
+ datadir=tmp_path / "clone",
355
+ rootdir=Path("."),
356
+ types=["BOLD", "T1w"],
357
+ tasks=["REST1", "WM"],
358
+ phase_encodings=["LR", "RL"],
359
+ )
360
+ with config_override("datagrabber.skipidcheck", True), dg:
361
+ # All the subjects with the tasks and phase encodings, without
362
+ # installing the sub-datasets
363
+ assert dg.get_elements() == [
364
+ (subject, task, phase_encoding)
365
+ for subject in ("100206", "100307")
366
+ for task in ("REST1", "WM")
367
+ for phase_encoding in ("LR", "RL")
368
+ ]
369
+ assert not (dg.fulldir / "100206" / "T1w").exists()
370
+ out = dg[("100307", "WM", "RL")]
371
+ assert out["BOLD"]["path"].read_text() == "100307 tfMRI_WM_RL"
372
+ assert out["T1w"]["path"].read_text() == "100307 T1w"
373
+ out = dg[("100206", "REST1", "LR")]
374
+ assert out["BOLD"]["path"].read_text() == "100206 rfMRI_REST1_LR"
375
+ dg = DataladHCP1200(
376
+ uri=AnyUrl(f"file://{dataset.path}"),
377
+ datadir=tmp_path / "clone",
378
+ rootdir=Path("."),
379
+ types=["T1w"],
380
+ )
381
+ with config_override("datagrabber.skipidcheck", True), dg:
382
+ assert dg.get_elements() == ["100206", "100307"]
383
+ assert dg["100206"]["T1w"]["path"].read_text() == "100206 T1w"