junifer 0.0.5__py3-none-any.whl → 0.0.5.dev24__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 (194) hide show
  1. junifer/__init__.py +0 -17
  2. junifer/_version.py +2 -2
  3. junifer/api/__init__.py +1 -4
  4. junifer/api/cli.py +1 -91
  5. junifer/api/decorators.py +0 -9
  6. junifer/api/functions.py +10 -56
  7. junifer/api/parser.py +0 -3
  8. junifer/api/queue_context/__init__.py +1 -4
  9. junifer/api/res/afni/run_afni_docker.sh +1 -1
  10. junifer/api/res/ants/run_ants_docker.sh +1 -1
  11. junifer/api/res/fsl/run_fsl_docker.sh +1 -1
  12. junifer/api/tests/test_api_utils.py +2 -4
  13. junifer/api/tests/test_cli.py +0 -83
  14. junifer/api/tests/test_functions.py +2 -27
  15. junifer/configs/__init__.py +1 -1
  16. junifer/configs/juseless/__init__.py +1 -4
  17. junifer/configs/juseless/datagrabbers/__init__.py +1 -10
  18. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +0 -3
  19. junifer/configs/juseless/datagrabbers/camcan_vbm.py +0 -3
  20. junifer/configs/juseless/datagrabbers/ixi_vbm.py +0 -3
  21. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +3 -1
  22. junifer/configs/juseless/datagrabbers/ucla.py +9 -12
  23. junifer/configs/juseless/datagrabbers/ukb_vbm.py +0 -3
  24. junifer/data/__init__.py +1 -21
  25. junifer/data/coordinates.py +19 -10
  26. junifer/data/masks.py +87 -58
  27. junifer/data/parcellations.py +3 -14
  28. junifer/data/template_spaces.py +1 -4
  29. junifer/data/tests/test_masks.py +37 -26
  30. junifer/data/utils.py +0 -3
  31. junifer/datagrabber/__init__.py +1 -18
  32. junifer/datagrabber/aomic/__init__.py +0 -3
  33. junifer/datagrabber/aomic/id1000.py +37 -70
  34. junifer/datagrabber/aomic/piop1.py +36 -69
  35. junifer/datagrabber/aomic/piop2.py +38 -71
  36. junifer/datagrabber/aomic/tests/test_id1000.py +99 -44
  37. junifer/datagrabber/aomic/tests/test_piop1.py +108 -65
  38. junifer/datagrabber/aomic/tests/test_piop2.py +102 -45
  39. junifer/datagrabber/base.py +6 -13
  40. junifer/datagrabber/datalad_base.py +1 -13
  41. junifer/datagrabber/dmcc13_benchmark.py +53 -36
  42. junifer/datagrabber/hcp1200/__init__.py +0 -3
  43. junifer/datagrabber/hcp1200/datalad_hcp1200.py +0 -3
  44. junifer/datagrabber/hcp1200/hcp1200.py +1 -4
  45. junifer/datagrabber/multiple.py +6 -45
  46. junifer/datagrabber/pattern.py +62 -170
  47. junifer/datagrabber/pattern_datalad.py +12 -25
  48. junifer/datagrabber/tests/test_datagrabber_utils.py +218 -0
  49. junifer/datagrabber/tests/test_datalad_base.py +4 -4
  50. junifer/datagrabber/tests/test_dmcc13_benchmark.py +19 -46
  51. junifer/datagrabber/tests/test_multiple.py +84 -161
  52. junifer/datagrabber/tests/test_pattern.py +0 -45
  53. junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
  54. junifer/datagrabber/utils.py +230 -0
  55. junifer/datareader/__init__.py +1 -4
  56. junifer/datareader/default.py +43 -95
  57. junifer/external/__init__.py +1 -1
  58. junifer/external/nilearn/__init__.py +1 -5
  59. junifer/external/nilearn/junifer_nifti_spheres_masker.py +9 -23
  60. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +1 -76
  61. junifer/markers/__init__.py +1 -23
  62. junifer/markers/base.py +28 -68
  63. junifer/markers/collection.py +2 -10
  64. junifer/markers/complexity/__init__.py +0 -10
  65. junifer/markers/complexity/complexity_base.py +43 -26
  66. junifer/markers/complexity/hurst_exponent.py +0 -3
  67. junifer/markers/complexity/multiscale_entropy_auc.py +0 -3
  68. junifer/markers/complexity/perm_entropy.py +0 -3
  69. junifer/markers/complexity/range_entropy.py +0 -3
  70. junifer/markers/complexity/range_entropy_auc.py +0 -3
  71. junifer/markers/complexity/sample_entropy.py +0 -3
  72. junifer/markers/complexity/tests/test_hurst_exponent.py +3 -11
  73. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +3 -11
  74. junifer/markers/complexity/tests/test_perm_entropy.py +3 -11
  75. junifer/markers/complexity/tests/test_range_entropy.py +3 -11
  76. junifer/markers/complexity/tests/test_range_entropy_auc.py +3 -11
  77. junifer/markers/complexity/tests/test_sample_entropy.py +3 -11
  78. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +3 -11
  79. junifer/markers/complexity/weighted_perm_entropy.py +0 -3
  80. junifer/markers/ets_rss.py +42 -27
  81. junifer/markers/falff/__init__.py +0 -3
  82. junifer/markers/falff/_afni_falff.py +2 -5
  83. junifer/markers/falff/_junifer_falff.py +0 -3
  84. junifer/markers/falff/falff_base.py +46 -20
  85. junifer/markers/falff/falff_parcels.py +27 -56
  86. junifer/markers/falff/falff_spheres.py +29 -60
  87. junifer/markers/falff/tests/test_falff_parcels.py +23 -39
  88. junifer/markers/falff/tests/test_falff_spheres.py +23 -39
  89. junifer/markers/functional_connectivity/__init__.py +0 -9
  90. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +60 -63
  91. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +32 -45
  92. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +36 -49
  93. junifer/markers/functional_connectivity/functional_connectivity_base.py +70 -71
  94. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +25 -34
  95. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +30 -40
  96. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +7 -11
  97. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +7 -27
  98. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +12 -28
  99. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +11 -35
  100. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +62 -36
  101. junifer/markers/parcel_aggregation.py +61 -47
  102. junifer/markers/reho/__init__.py +0 -3
  103. junifer/markers/reho/_afni_reho.py +2 -5
  104. junifer/markers/reho/_junifer_reho.py +1 -4
  105. junifer/markers/reho/reho_base.py +27 -8
  106. junifer/markers/reho/reho_parcels.py +17 -28
  107. junifer/markers/reho/reho_spheres.py +18 -27
  108. junifer/markers/reho/tests/test_reho_parcels.py +3 -8
  109. junifer/markers/reho/tests/test_reho_spheres.py +3 -8
  110. junifer/markers/sphere_aggregation.py +59 -43
  111. junifer/markers/temporal_snr/__init__.py +0 -3
  112. junifer/markers/temporal_snr/temporal_snr_base.py +32 -23
  113. junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -9
  114. junifer/markers/temporal_snr/temporal_snr_spheres.py +6 -9
  115. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +3 -6
  116. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +3 -6
  117. junifer/markers/tests/test_collection.py +8 -9
  118. junifer/markers/tests/test_ets_rss.py +9 -15
  119. junifer/markers/tests/test_markers_base.py +18 -17
  120. junifer/markers/tests/test_parcel_aggregation.py +32 -93
  121. junifer/markers/tests/test_sphere_aggregation.py +19 -72
  122. junifer/onthefly/__init__.py +1 -4
  123. junifer/onthefly/read_transform.py +0 -3
  124. junifer/pipeline/__init__.py +1 -9
  125. junifer/pipeline/pipeline_step_mixin.py +4 -21
  126. junifer/pipeline/registry.py +0 -3
  127. junifer/pipeline/singleton.py +0 -3
  128. junifer/pipeline/tests/test_registry.py +1 -1
  129. junifer/pipeline/update_meta_mixin.py +0 -3
  130. junifer/pipeline/utils.py +1 -67
  131. junifer/pipeline/workdir_manager.py +0 -3
  132. junifer/preprocess/__init__.py +2 -9
  133. junifer/preprocess/ants/__init__.py +4 -0
  134. junifer/preprocess/ants/ants_apply_transforms_warper.py +185 -0
  135. junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +56 -0
  136. junifer/preprocess/base.py +3 -6
  137. junifer/preprocess/bold_warper.py +265 -0
  138. junifer/preprocess/confounds/__init__.py +0 -3
  139. junifer/preprocess/confounds/fmriprep_confound_remover.py +60 -47
  140. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +113 -72
  141. junifer/preprocess/fsl/__init__.py +4 -0
  142. junifer/preprocess/fsl/apply_warper.py +179 -0
  143. junifer/preprocess/fsl/tests/test_apply_warper.py +45 -0
  144. junifer/preprocess/smoothing/__init__.py +0 -3
  145. junifer/preprocess/smoothing/_afni_smoothing.py +1 -1
  146. junifer/preprocess/tests/test_bold_warper.py +159 -0
  147. junifer/preprocess/warping/__init__.py +0 -3
  148. junifer/preprocess/warping/_ants_warper.py +0 -3
  149. junifer/preprocess/warping/_fsl_warper.py +0 -3
  150. junifer/stats.py +1 -4
  151. junifer/storage/__init__.py +1 -9
  152. junifer/storage/base.py +1 -40
  153. junifer/storage/hdf5.py +9 -71
  154. junifer/storage/pandas_base.py +0 -3
  155. junifer/storage/sqlite.py +0 -3
  156. junifer/storage/tests/test_hdf5.py +10 -82
  157. junifer/storage/utils.py +0 -9
  158. junifer/testing/__init__.py +1 -4
  159. junifer/testing/datagrabbers.py +6 -13
  160. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
  161. junifer/testing/utils.py +0 -3
  162. junifer/utils/__init__.py +2 -13
  163. junifer/utils/fs.py +0 -3
  164. junifer/utils/helpers.py +1 -32
  165. junifer/utils/logging.py +4 -33
  166. junifer/utils/tests/test_logging.py +0 -8
  167. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/METADATA +16 -17
  168. junifer-0.0.5.dev24.dist-info/RECORD +265 -0
  169. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/WHEEL +1 -1
  170. junifer/api/res/freesurfer/mri_binarize +0 -3
  171. junifer/api/res/freesurfer/mri_mc +0 -3
  172. junifer/api/res/freesurfer/mri_pretess +0 -3
  173. junifer/api/res/freesurfer/mris_convert +0 -3
  174. junifer/api/res/freesurfer/run_freesurfer_docker.sh +0 -61
  175. junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
  176. junifer/datagrabber/pattern_validation_mixin.py +0 -388
  177. junifer/datagrabber/tests/test_pattern_validation_mixin.py +0 -249
  178. junifer/external/BrainPrint/brainprint/__init__.py +0 -4
  179. junifer/external/BrainPrint/brainprint/_version.py +0 -3
  180. junifer/external/BrainPrint/brainprint/asymmetry.py +0 -91
  181. junifer/external/BrainPrint/brainprint/brainprint.py +0 -441
  182. junifer/external/BrainPrint/brainprint/surfaces.py +0 -258
  183. junifer/external/BrainPrint/brainprint/utils/__init__.py +0 -1
  184. junifer/external/BrainPrint/brainprint/utils/_config.py +0 -112
  185. junifer/external/BrainPrint/brainprint/utils/utils.py +0 -188
  186. junifer/external/nilearn/junifer_connectivity_measure.py +0 -483
  187. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +0 -1089
  188. junifer/markers/brainprint.py +0 -459
  189. junifer/markers/tests/test_brainprint.py +0 -58
  190. junifer-0.0.5.dist-info/RECORD +0 -275
  191. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/AUTHORS.rst +0 -0
  192. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/LICENSE.md +0 -0
  193. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/entry_points.txt +0 -0
  194. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/top_level.txt +0 -0
@@ -25,12 +25,7 @@ from junifer.storage.utils import (
25
25
  def test_get_valid_inputs() -> None:
26
26
  """Test valid inputs."""
27
27
  storage = HDF5FeatureStorage(uri="/tmp")
28
- assert storage.get_valid_inputs() == [
29
- "matrix",
30
- "vector",
31
- "timeseries",
32
- "scalar_table",
33
- ]
28
+ assert storage.get_valid_inputs() == ["matrix", "vector", "timeseries"]
34
29
 
35
30
 
36
31
  def test_single_output(tmp_path: Path) -> None:
@@ -813,7 +808,7 @@ def test_store_timeseries(tmp_path: Path) -> None:
813
808
  data = np.array([[10], [20], [30], [40], [50]])
814
809
  col_names = ["signal"]
815
810
 
816
- # Store timeseries
811
+ # Store vector
817
812
  storage.store_timeseries(
818
813
  meta_md5=meta_md5,
819
814
  element=element_to_store,
@@ -827,53 +822,6 @@ def test_store_timeseries(tmp_path: Path) -> None:
827
822
  assert_array_equal(read_df.values, data)
828
823
 
829
824
 
830
- def test_store_scalar_table(tmp_path: Path) -> None:
831
- """Test scalar table store.
832
-
833
- Parameters
834
- ----------
835
- tmp_path : pathlib.Path
836
- The path to the test directory.
837
-
838
- """
839
- uri = tmp_path / "test_store_scalar_table.hdf5"
840
- storage = HDF5FeatureStorage(uri=uri)
841
- # Metadata to store
842
- element = {"subject": "test"}
843
- meta = {
844
- "element": element,
845
- "dependencies": ["numpy"],
846
- "marker": {"name": "brainprint"},
847
- "type": "FreeSurfer",
848
- }
849
- # Process the metadata
850
- meta_md5, meta_to_store, element_to_store = process_meta(meta)
851
- # Store metadata
852
- storage.store_metadata(
853
- meta_md5=meta_md5, element=element_to_store, meta=meta_to_store
854
- )
855
-
856
- # Data to store
857
- data = np.array([[10, 20], [30, 40], [50, 60]])
858
- col_names = ["roi1", "roi2"]
859
- row_names = ["ev1", "ev2", "ev3"]
860
-
861
- # Store timeseries
862
- storage.store_scalar_table(
863
- meta_md5=meta_md5,
864
- element=element_to_store,
865
- data=data,
866
- col_names=col_names,
867
- row_names=row_names,
868
- row_header_col_name="eigenvalue",
869
- )
870
-
871
- # Read into dataframe
872
- read_df = storage.read_df(feature_md5=meta_md5)
873
- # Check if data are equal
874
- assert_array_equal(read_df.values, data)
875
-
876
-
877
825
  def _create_data_to_store(n_elements: int, kind: str) -> Tuple[str, Dict]:
878
826
  """Create data to store.
879
827
 
@@ -906,19 +854,13 @@ def _create_data_to_store(n_elements: int, kind: str) -> Tuple[str, Dict]:
906
854
  "col_names": [f"col-{i}" for i in range(10)],
907
855
  "matrix_kind": "full",
908
856
  }
909
- elif kind in "timeseries":
857
+ elif kind == "timeseries":
910
858
  data_to_store = {
911
859
  "data": np.arange(20).reshape(2, 10),
912
860
  "col_names": [f"col-{i}" for i in range(10)],
913
861
  }
914
- elif kind in "scalar_table":
915
- data_to_store = {
916
- "data": np.arange(50).reshape(5, 10),
917
- "row_names": [f"row-{i}" for i in range(5)],
918
- "col_names": [f"col-{i}" for i in range(10)],
919
- "row_header_col_name": "row",
920
- }
921
-
862
+ else:
863
+ raise ValueError(f"Unknown kind {kind}.")
922
864
  for i in range(n_elements):
923
865
  element = {"subject": f"sub-{i // 2}", "session": f"ses-{i % 2}"}
924
866
  meta = {
@@ -961,7 +903,6 @@ def _create_data_to_store(n_elements: int, kind: str) -> Tuple[str, Dict]:
961
903
  (10, 3, "matrix"),
962
904
  (10, 5, "matrix"),
963
905
  (10, 5, "timeseries"),
964
- (10, 5, "scalar_table"),
965
906
  ],
966
907
  )
967
908
  def test_multi_output_store_and_collect(
@@ -989,20 +930,21 @@ def test_multi_output_store_and_collect(
989
930
  meta_md5, all_data = _create_data_to_store(n_elements, kind)
990
931
 
991
932
  for t_data in all_data:
992
- # Store metadata
933
+ # Store metadata for tables
993
934
  storage.store_metadata(
994
935
  meta_md5=meta_md5,
995
936
  element=t_data["element"],
996
937
  meta=t_data["meta"],
997
938
  )
998
- # Store data
999
939
  if kind == "vector":
940
+ # Store tables
1000
941
  storage.store_vector(
1001
942
  meta_md5=meta_md5,
1002
943
  element=t_data["element"],
1003
944
  **t_data["data"],
1004
945
  )
1005
946
  elif kind == "matrix":
947
+ # Store tables
1006
948
  storage.store_matrix(
1007
949
  meta_md5=meta_md5,
1008
950
  element=t_data["element"],
@@ -1014,17 +956,11 @@ def test_multi_output_store_and_collect(
1014
956
  element=t_data["element"],
1015
957
  **t_data["data"],
1016
958
  )
1017
- elif kind == "scalar_table":
1018
- storage.store_scalar_table(
1019
- meta_md5=meta_md5,
1020
- element=t_data["element"],
1021
- **t_data["data"],
1022
- )
1023
959
  # Check that base URI does not exist yet
1024
960
  assert not uri.exists()
1025
961
 
1026
962
  for t_data in all_data:
1027
- # Convert element to prefix
963
+ # Convert element to preifx
1028
964
  prefix = element_to_prefix(t_data["element"])
1029
965
  # URIs for data storage
1030
966
  elem_uri = uri.parent / f"{prefix}{uri.name}"
@@ -1041,7 +977,7 @@ def test_multi_output_store_and_collect(
1041
977
  # Check that base URI exists now
1042
978
  assert uri.exists()
1043
979
 
1044
- # Read unified metadata
980
+ # # Read unified metadata
1045
981
  read_unified_meta = storage.list_features()
1046
982
  assert meta_md5 in read_unified_meta
1047
983
 
@@ -1053,10 +989,6 @@ def test_multi_output_store_and_collect(
1053
989
  data_size = np.sum([x["data"]["data"].shape[0] for x in all_data])
1054
990
  assert len(all_df) == data_size
1055
991
  idx_names = [x for x in all_df.index.names if x != "timepoint"]
1056
- elif kind == "scalar_table":
1057
- data_size = np.sum([x["data"]["data"].shape[0] for x in all_data])
1058
- assert len(all_df) == data_size
1059
- idx_names = [x for x in all_df.index.names if x != "row"]
1060
992
  else:
1061
993
  assert len(all_df) == len(all_data)
1062
994
  idx_names = all_df.index.names
@@ -1081,10 +1013,6 @@ def test_multi_output_store_and_collect(
1081
1013
  assert_array_equal(t_series.values, t_data["data"]["data"])
1082
1014
  series_names = t_series.columns.values.tolist()
1083
1015
  assert series_names == t_data["data"]["col_names"]
1084
- elif kind == "scalar_table":
1085
- assert_array_equal(t_series.values, t_data["data"]["data"])
1086
- series_names = t_series.columns.values.tolist()
1087
- assert series_names == t_data["data"]["col_names"]
1088
1016
 
1089
1017
 
1090
1018
  def test_collect_error_single_output() -> None:
junifer/storage/utils.py CHANGED
@@ -14,15 +14,6 @@ import numpy as np
14
14
  from ..utils.logging import logger, raise_error
15
15
 
16
16
 
17
- __all__ = [
18
- "get_dependency_version",
19
- "process_meta",
20
- "element_to_prefix",
21
- "store_matrix_checks",
22
- "matrix_to_vector",
23
- ]
24
-
25
-
26
17
  def get_dependency_version(dependency: str) -> str:
27
18
  """Get dependency version.
28
19
 
@@ -1,4 +1,4 @@
1
- """Testing components."""
1
+ """Provide imports for testing sub-package."""
2
2
 
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
@@ -6,6 +6,3 @@
6
6
 
7
7
  from . import datagrabbers
8
8
  from .utils import get_testing_data
9
-
10
-
11
- __all__ = ["datagrabbers", "get_testing_data"]
@@ -1,4 +1,4 @@
1
- """Testing DataGrabbers."""
1
+ """Provide testing DataGrabbers."""
2
2
 
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
@@ -14,13 +14,6 @@ from nilearn import datasets, image
14
14
  from ..datagrabber.base import BaseDataGrabber
15
15
 
16
16
 
17
- __all__ = [
18
- "OasisVBMTestingDataGrabber",
19
- "SPMAuditoryTestingDataGrabber",
20
- "PartlyCloudyTestingDataGrabber",
21
- ]
22
-
23
-
24
17
  class OasisVBMTestingDataGrabber(BaseDataGrabber):
25
18
  """DataGrabber for Oasis VBM testing data.
26
19
 
@@ -188,7 +181,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
188
181
  """Initialize the class."""
189
182
  datadir = tempfile.mkdtemp()
190
183
  # Define types
191
- types = ["BOLD"]
184
+ types = ["BOLD", "BOLD_confounds"]
192
185
  self.reduce_confounds = reduce_confounds
193
186
  self.age_group = age_group
194
187
  super().__init__(types=types, datadir=datadir)
@@ -249,10 +242,10 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
249
242
  out["BOLD"] = {
250
243
  "path": Path(self._dataset["func"][i_sub]),
251
244
  "space": "MNI152NLin2009cAsym",
252
- "confounds": {
253
- "path": Path(self._dataset["confounds"][i_sub]),
254
- "format": "fmriprep",
255
- },
245
+ }
246
+ out["BOLD_confounds"] = {
247
+ "path": Path(self._dataset["confounds"][i_sub]),
248
+ "format": "fmriprep",
256
249
  }
257
250
 
258
251
  return out
@@ -28,13 +28,13 @@ def test_PartlyCloudyTestingDataGrabber() -> None:
28
28
  assert out["BOLD"]["path"].exists()
29
29
  assert out["BOLD"]["path"].is_file()
30
30
 
31
- assert "confounds" in out["BOLD"]
32
- assert out["BOLD"]["confounds"]["path"].exists()
33
- assert out["BOLD"]["confounds"]["path"].is_file()
34
- assert "format" in out["BOLD"]["confounds"]
35
- assert "fmriprep" == out["BOLD"]["confounds"]["format"]
31
+ assert "BOLD_confounds" in out
32
+ assert out["BOLD_confounds"]["path"].exists()
33
+ assert out["BOLD_confounds"]["path"].is_file()
34
+ assert "format" in out["BOLD_confounds"]
35
+ assert "fmriprep" == out["BOLD_confounds"]["format"]
36
36
 
37
37
  with PartlyCloudyTestingDataGrabber(reduce_confounds=False) as dg:
38
38
  out = dg["sub-01"]
39
- assert "format" in out["BOLD"]["confounds"]
40
- assert "fmriprep" == out["BOLD"]["confounds"]["format"]
39
+ assert "format" in out["BOLD_confounds"]
40
+ assert "fmriprep" == out["BOLD_confounds"]["format"]
junifer/testing/utils.py CHANGED
@@ -6,9 +6,6 @@
6
6
  from pathlib import Path
7
7
 
8
8
 
9
- __all__ = ["get_testing_data"]
10
-
11
-
12
9
  def get_testing_data(fname: str) -> Path:
13
10
  """Get the path to a testing data file.
14
11
 
junifer/utils/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- """General utilities and helpers."""
1
+ """Provide imports for utils sub-package."""
2
2
 
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
@@ -6,15 +6,4 @@
6
6
 
7
7
  from .fs import make_executable
8
8
  from .logging import configure_logging, logger, raise_error, warn_with_log
9
- from .helpers import run_ext_cmd, deep_update
10
-
11
-
12
- __all__ = [
13
- "make_executable",
14
- "configure_logging",
15
- "logger",
16
- "raise_error",
17
- "warn_with_log",
18
- "run_ext_cmd",
19
- "deep_update",
20
- ]
9
+ from .helpers import run_ext_cmd
junifer/utils/fs.py CHANGED
@@ -8,9 +8,6 @@ import stat
8
8
  from pathlib import Path
9
9
 
10
10
 
11
- __all__ = ["make_executable"]
12
-
13
-
14
11
  def make_executable(path: Path) -> None:
15
12
  """Make ``path`` executable.
16
13
 
junifer/utils/helpers.py CHANGED
@@ -3,16 +3,12 @@
3
3
  # Authors: Synchon Mandal <s.mandal@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- import collections.abc
7
6
  import subprocess
8
- from typing import Dict, List
7
+ from typing import List
9
8
 
10
9
  from .logging import logger, raise_error
11
10
 
12
11
 
13
- __all__ = ["run_ext_cmd", "deep_update"]
14
-
15
-
16
12
  def run_ext_cmd(name: str, cmd: List[str]) -> None:
17
13
  """Run external command via subprocess.
18
14
 
@@ -55,30 +51,3 @@ def run_ext_cmd(name: str, cmd: List[str]) -> None:
55
51
  ),
56
52
  klass=RuntimeError,
57
53
  )
58
-
59
-
60
- def deep_update(d: Dict, u: Dict) -> Dict:
61
- """Deep update `d` with `u`.
62
-
63
- From: "https://stackoverflow.com/questions/3232943/update-value-of-a-nested
64
- -dictionary-of-varying-depth"
65
-
66
- Parameters
67
- ----------
68
- d : dict
69
- The dictionary to deep-update.
70
- u : dict
71
- The dictionary to deep-update `d` with.
72
-
73
- Returns
74
- -------
75
- dict
76
- The updated dictionary.
77
-
78
- """
79
- for k, v in u.items():
80
- if isinstance(v, collections.abc.Mapping):
81
- d[k] = deep_update(d.get(k, {}), v)
82
- else:
83
- d[k] = v
84
- return d
junifer/utils/logging.py CHANGED
@@ -4,16 +4,13 @@
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
5
5
  # License: AGPL
6
6
 
7
- import sys
8
-
9
-
10
- if sys.version_info < (3, 12):
7
+ try:
11
8
  from distutils.version import LooseVersion
12
- else: # pragma: no cover
9
+ except ImportError: # pragma: no cover
13
10
  from looseversion import LooseVersion
14
11
 
15
12
  import logging
16
- import warnings
13
+ import sys
17
14
  from pathlib import Path
18
15
  from subprocess import PIPE, Popen, TimeoutExpired
19
16
  from typing import Dict, NoReturn, Optional, Type, Union
@@ -22,16 +19,6 @@ from warnings import warn
22
19
  import datalad
23
20
 
24
21
 
25
- __all__ = [
26
- "WrapStdOut",
27
- "get_versions",
28
- "log_versions",
29
- "configure_logging",
30
- "raise_error",
31
- "warn_with_log",
32
- ]
33
-
34
-
35
22
  logger = logging.getLogger("JUNIFER")
36
23
 
37
24
  # Set up datalad logger level to warning by default
@@ -45,23 +32,6 @@ _logging_types = {
45
32
  }
46
33
 
47
34
 
48
- # Copied over from stdlib and tweaked to our use-case.
49
- def _showwarning(message, category, filename, lineno, file=None, line=None):
50
- s = warnings.formatwarning(message, category, filename, lineno, line)
51
- logger.warning(str(s))
52
-
53
-
54
- # Overwrite warnings display to integrate with logging
55
-
56
-
57
- def capture_warnings():
58
- """Capture warnings and log them."""
59
- warnings.showwarning = _showwarning
60
-
61
-
62
- capture_warnings()
63
-
64
-
65
35
  class WrapStdOut(logging.StreamHandler):
66
36
  """Dynamically wrap to sys.stdout.
67
37
 
@@ -343,4 +313,5 @@ def warn_with_log(
343
313
  The warning subclass (default RuntimeWarning).
344
314
 
345
315
  """
316
+ logger.warning(msg)
346
317
  warn(msg, category=category, stacklevel=2)
@@ -145,16 +145,8 @@ def test_log_file(tmp_path: Path) -> None:
145
145
  assert any("Warn3 message" in line for line in lines)
146
146
  assert any("Error3 message" in line for line in lines)
147
147
 
148
- # This should raise a warning (test that it was raised)
149
148
  with pytest.warns(RuntimeWarning, match=r"Warn raised"):
150
149
  warn_with_log("Warn raised")
151
-
152
- # This should log the warning (workaround for pytest messing with logging)
153
- from junifer.utils.logging import capture_warnings
154
-
155
- capture_warnings()
156
-
157
- warn_with_log("Warn raised 2")
158
150
  with pytest.raises(ValueError, match=r"Error raised"):
159
151
  raise_error("Error raised")
160
152
  with open(tmp_path / "test4.log") as f:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: junifer
3
- Version: 0.0.5
3
+ Version: 0.0.5.dev24
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>
@@ -29,20 +29,19 @@ Description-Content-Type: text/markdown
29
29
  License-File: LICENSE.md
30
30
  License-File: AUTHORS.rst
31
31
  Requires-Dist: click <8.2,>=8.1.3
32
- Requires-Dist: numpy <2.0.0,>=1.24.0
33
- Requires-Dist: scipy <=1.14.0,>=1.10.0
34
- Requires-Dist: datalad <1.2.0,>=1.0.0
35
- Requires-Dist: pandas <2.3.0,>=2.0.0
36
- Requires-Dist: nibabel <5.3.0,>=5.2.0
37
- Requires-Dist: nilearn <=0.10.4,>=0.10.3
38
- Requires-Dist: sqlalchemy <=2.1.0,>=2.0.25
32
+ Requires-Dist: numpy <1.27,>=1.24
33
+ Requires-Dist: scipy <=1.11.4,>=1.9.0
34
+ Requires-Dist: datalad <0.20,>=0.15.4
35
+ Requires-Dist: pandas <2.2,>=1.4.0
36
+ Requires-Dist: nibabel <5.11,>=3.2.0
37
+ Requires-Dist: nilearn <=0.10.2,>=0.9.0
38
+ Requires-Dist: sqlalchemy <=2.1.0,>=1.4.27
39
39
  Requires-Dist: ruamel.yaml <0.18,>=0.17
40
40
  Requires-Dist: h5py >=3.10
41
41
  Requires-Dist: httpx[http2] ==0.26.0
42
42
  Requires-Dist: tqdm ==4.66.1
43
43
  Requires-Dist: templateflow >=23.0.0
44
- Requires-Dist: lapy <2.0.0,>=1.0.0
45
- Requires-Dist: importlib-metadata ; python_version < "3.9"
44
+ Requires-Dist: importlib-metadata ; python_version < "3.10"
46
45
  Requires-Dist: looseversion ==1.3.0 ; python_version >= "3.12"
47
46
  Provides-Extra: all
48
47
  Requires-Dist: bctpy ==0.6.0 ; extra == 'all'
@@ -53,14 +52,14 @@ Provides-Extra: dev
53
52
  Requires-Dist: tox ; extra == 'dev'
54
53
  Requires-Dist: pre-commit ; extra == 'dev'
55
54
  Provides-Extra: docs
56
- Requires-Dist: seaborn <0.14.0,>=0.13.0 ; extra == 'docs'
57
- Requires-Dist: sphinx <7.4.0,>=7.3.0 ; extra == 'docs'
58
- Requires-Dist: sphinx-gallery <0.17.0,>=0.15.0 ; extra == 'docs'
59
- Requires-Dist: furo <2024.6.0,>=2024.4.27 ; extra == 'docs'
60
- Requires-Dist: numpydoc <1.8.0,>=1.6.0 ; extra == 'docs'
61
- Requires-Dist: julearn ==0.3.3 ; extra == 'docs'
55
+ Requires-Dist: seaborn <0.13,>=0.11.2 ; extra == 'docs'
56
+ Requires-Dist: sphinx <7.3,>=5.3.0 ; extra == 'docs'
57
+ Requires-Dist: sphinx-gallery <0.15.0,>=0.11.0 ; extra == 'docs'
58
+ Requires-Dist: furo <2023.10.0,>=2022.9.29 ; extra == 'docs'
59
+ Requires-Dist: numpydoc <1.6,>=1.5.0 ; extra == 'docs'
60
+ Requires-Dist: julearn <0.4,>=0.3.0 ; extra == 'docs'
62
61
  Requires-Dist: sphinx-copybutton <0.5.3,>=0.5.1 ; extra == 'docs'
63
- Requires-Dist: towncrier <23.12.0,>=23.10.0 ; extra == 'docs'
62
+ Requires-Dist: towncrier <23.7,>=22.12.0 ; extra == 'docs'
64
63
  Requires-Dist: sphinxcontrib-mermaid <0.10,>=0.8.1 ; extra == 'docs'
65
64
  Provides-Extra: neurokit2
66
65
  Requires-Dist: neurokit2 >=0.1.7 ; extra == 'neurokit2'