From 5a955a6d353a51b76aa41315e95e9e8b21cacf41 Mon Sep 17 00:00:00 2001 From: Fede Raimondo Date: Fri, 31 Mar 2023 12:11:42 +0200 Subject: [PATCH 01/63] [BUG]: HCP1200 datagrabber does not provide the correct BOLD files (#183) * add ICA+FIx param * Add tests * add news * address comments * fix typo --- docs/changes/newsfragments/183.bugfix | 1 + docs/changes/newsfragments/183.change | 1 + junifer/datagrabber/hcp.py | 21 ++++++- junifer/datagrabber/tests/test_hcp.py | 83 +++++++++++++++++++------ tools/create_hcp1200_example_dataset.py | 15 ++++- 5 files changed, 97 insertions(+), 24 deletions(-) create mode 100644 docs/changes/newsfragments/183.bugfix create mode 100644 docs/changes/newsfragments/183.change diff --git a/docs/changes/newsfragments/183.bugfix b/docs/changes/newsfragments/183.bugfix new file mode 100644 index 000000000..a2a0c7bb6 --- /dev/null +++ b/docs/changes/newsfragments/183.bugfix @@ -0,0 +1 @@ +Fix a bug in which only ``REST1`` and ``REST2`` tasks could be accesed in :class:`.DataladHCP1200` and :class:`.HCP1200` datagrabbers by `Fede Raimondo`_ \ No newline at end of file diff --git a/docs/changes/newsfragments/183.change b/docs/changes/newsfragments/183.change new file mode 100644 index 000000000..374b56acd --- /dev/null +++ b/docs/changes/newsfragments/183.change @@ -0,0 +1 @@ +Add ``ica_fix`` parameter to :class:`.DataladHCP1200` and :class:`.HCP1200` datagrabbers to allow for selecting data processed with ICA+FIX. Default value is ``False`` which changes behaviour since 0.0.1 release. By `Fede Raimondo`_ \ No newline at end of file diff --git a/junifer/datagrabber/hcp.py b/junifer/datagrabber/hcp.py index d1048c034..d36e74b61 100644 --- a/junifer/datagrabber/hcp.py +++ b/junifer/datagrabber/hcp.py @@ -26,9 +26,12 @@ class HCP1200(PatternDataGrabber): phase_encodings : {"LR", "RL"} or list of the options, optional HCP phase encoding directions. If None, both will be used (default None). + ica_fix : bool, optional + Whether to retrieve data that was processed with ICA+FIX. + Only 'REST1' and 'REST2' tasks are available with ICA+FIX (default + False). **kwargs Keyword arguments passed to superclass. - """ def __init__( @@ -36,6 +39,7 @@ class HCP1200(PatternDataGrabber): datadir: Union[str, Path], tasks: Union[str, List[str], None] = None, phase_encodings: Union[str, List[str], None] = None, + ica_fix: bool = False, **kwargs, ) -> None: # All tasks @@ -82,6 +86,12 @@ class HCP1200(PatternDataGrabber): f"{all_phase_encodings}." ) + if ica_fix: + if not all([task in ["REST1", "REST2"] for task in self.tasks]): + raise_error( + "ICA+FIX is only available for 'REST1' and 'REST2' tasks." + ) + suffix = "_hp2000_clean" if ica_fix else "" # The types of data types = ["BOLD"] # The patterns @@ -89,7 +99,8 @@ class HCP1200(PatternDataGrabber): "BOLD": ( "{subject}/MNINonLinear/Results/" "{task}_{phase_encoding}/" - "{task}_{phase_encoding}_hp2000_clean.nii.gz" + "{task}_{phase_encoding}" + f"{suffix}.nii.gz" ) } # The replacements @@ -173,6 +184,10 @@ class DataladHCP1200(DataladDataGrabber, HCP1200): phase_encodings : {"LR", "RL"} or list of the options, optional HCP phase encoding directions. If None, both will be used (default None). + ica_fix : bool, optional + Whether to retrieve data that was processed with ICA+FIX. + Only 'REST1' and 'REST2' tasks are available with ICA+FIX (default + False). """ def __init__( @@ -180,6 +195,7 @@ class DataladHCP1200(DataladDataGrabber, HCP1200): datadir: Union[str, Path, None] = None, tasks: Union[str, List[str], None] = None, phase_encodings: Union[str, List[str], None] = None, + ica_fix: bool = False, ) -> None: uri = ( "https://github.com/datalad-datasets/" @@ -192,6 +208,7 @@ class DataladHCP1200(DataladDataGrabber, HCP1200): phase_encodings=phase_encodings, uri=uri, rootdir=rootdir, + ica_fix=ica_fix, ) @property diff --git a/junifer/datagrabber/tests/test_hcp.py b/junifer/datagrabber/tests/test_hcp.py index 375f4409d..c5ca8ec5b 100644 --- a/junifer/datagrabber/tests/test_hcp.py +++ b/junifer/datagrabber/tests/test_hcp.py @@ -29,33 +29,38 @@ def hcpdg() -> Iterable[DataladHCP1200]: @pytest.mark.parametrize( - "tasks, phase_encodings, expected_path_name", + "tasks, phase_encodings, ica_fix, expected_path_name", [ - (None, None, "rfMRI_REST1_LR_hp2000_clean.nii.gz"), - ("REST1", "LR", "rfMRI_REST1_LR_hp2000_clean.nii.gz"), - ("REST1", "RL", "rfMRI_REST1_RL_hp2000_clean.nii.gz"), - ("REST2", "LR", "rfMRI_REST2_LR_hp2000_clean.nii.gz"), - ("REST2", "RL", "rfMRI_REST2_RL_hp2000_clean.nii.gz"), - ("SOCIAL", "LR", "tfMRI_SOCIAL_LR_hp2000_clean.nii.gz"), - ("SOCIAL", "RL", "tfMRI_SOCIAL_RL_hp2000_clean.nii.gz"), - ("WM", "LR", "tfMRI_WM_LR_hp2000_clean.nii.gz"), - ("WM", "RL", "tfMRI_WM_RL_hp2000_clean.nii.gz"), - ("RELATIONAL", "LR", "tfMRI_RELATIONAL_LR_hp2000_clean.nii.gz"), - ("RELATIONAL", "RL", "tfMRI_RELATIONAL_RL_hp2000_clean.nii.gz"), - ("EMOTION", "LR", "tfMRI_EMOTION_LR_hp2000_clean.nii.gz"), - ("EMOTION", "RL", "tfMRI_EMOTION_RL_hp2000_clean.nii.gz"), - ("LANGUAGE", "LR", "tfMRI_LANGUAGE_LR_hp2000_clean.nii.gz"), - ("LANGUAGE", "RL", "tfMRI_LANGUAGE_RL_hp2000_clean.nii.gz"), - ("GAMBLING", "LR", "tfMRI_GAMBLING_LR_hp2000_clean.nii.gz"), - ("GAMBLING", "RL", "tfMRI_GAMBLING_RL_hp2000_clean.nii.gz"), - ("MOTOR", "LR", "tfMRI_MOTOR_LR_hp2000_clean.nii.gz"), - ("MOTOR", "RL", "tfMRI_MOTOR_RL_hp2000_clean.nii.gz"), + (None, None, False, "rfMRI_REST1_LR.nii.gz"), + ("REST1", "LR", False, "rfMRI_REST1_LR.nii.gz"), + ("REST1", "RL", False, "rfMRI_REST1_RL.nii.gz"), + ("REST2", "LR", False, "rfMRI_REST2_LR.nii.gz"), + ("REST2", "RL", False, "rfMRI_REST2_RL.nii.gz"), + ("SOCIAL", "LR", False, "tfMRI_SOCIAL_LR.nii.gz"), + ("SOCIAL", "RL", False, "tfMRI_SOCIAL_RL.nii.gz"), + ("WM", "LR", False, "tfMRI_WM_LR.nii.gz"), + ("WM", "RL", False, "tfMRI_WM_RL.nii.gz"), + ("RELATIONAL", "LR", False, "tfMRI_RELATIONAL_LR.nii.gz"), + ("RELATIONAL", "RL", False, "tfMRI_RELATIONAL_RL.nii.gz"), + ("EMOTION", "LR", False, "tfMRI_EMOTION_LR.nii.gz"), + ("EMOTION", "RL", False, "tfMRI_EMOTION_RL.nii.gz"), + ("LANGUAGE", "LR", False, "tfMRI_LANGUAGE_LR.nii.gz"), + ("LANGUAGE", "RL", False, "tfMRI_LANGUAGE_RL.nii.gz"), + ("GAMBLING", "LR", False, "tfMRI_GAMBLING_LR.nii.gz"), + ("GAMBLING", "RL", False, "tfMRI_GAMBLING_RL.nii.gz"), + ("MOTOR", "LR", False, "tfMRI_MOTOR_LR.nii.gz"), + ("MOTOR", "RL", False, "tfMRI_MOTOR_RL.nii.gz"), + ("REST1", "LR", True, "rfMRI_REST1_LR_hp2000_clean.nii.gz"), + ("REST1", "RL", True, "rfMRI_REST1_RL_hp2000_clean.nii.gz"), + ("REST2", "LR", True, "rfMRI_REST2_LR_hp2000_clean.nii.gz"), + ("REST2", "RL", True, "rfMRI_REST2_RL_hp2000_clean.nii.gz"), ], ) def test_hcp1200_datagrabber( hcpdg: DataladHCP1200, tasks: Optional[str], phase_encodings: Optional[str], + ica_fix: bool, expected_path_name: str, ) -> None: """Test HCP1200 datagrabber. @@ -69,6 +74,8 @@ def test_hcp1200_datagrabber( The parametrized tasks. phase_encodings : str The parametrized phase encodings. + ica_fix : bool + The parametrized ICA-FIX flag. expected_path_name : str The parametrized expected path name. @@ -78,6 +85,7 @@ def test_hcp1200_datagrabber( datadir=hcpdg.datadir, tasks=tasks, phase_encodings=phase_encodings, + ica_fix=ica_fix, ) # Get all elements all_elements = dg.get_elements() @@ -342,3 +350,38 @@ def test_hcp1200_datagrabber_elements( assert element[2] in ["LR", "RL"] assert set(found_subjects) == set(expected_subjects) + + +@pytest.mark.parametrize( + "tasks, ica_fix", + [ + ("SOCIAL", True), + ("WM", True), + ("RELATIONAL", True), + ("EMOTION", True), + ("LANGUAGE", True), + ("GAMBLING", True), + ("MOTOR", True), + ], +) +def test_hcp1200_datagrabber_incorrect_access_icafix( + tasks: Optional[str], + ica_fix: bool +) -> None: + """Test HCP1200 datagrabber incorrect access for icafix. + + Parameters + ---------- + tasks : str + The parametrized tasks. + ica_fix : bool + The parametrized ICA-FIX flag. + + """ + configure_logging(level="DEBUG") + with pytest.raises(ValueError, match="is only available for"): + _ = HCP1200( + datadir=".", + tasks=tasks, + ica_fix=ica_fix, + ) diff --git a/tools/create_hcp1200_example_dataset.py b/tools/create_hcp1200_example_dataset.py index 4aa4044ea..5a3bd0637 100644 --- a/tools/create_hcp1200_example_dataset.py +++ b/tools/create_hcp1200_example_dataset.py @@ -22,7 +22,7 @@ if __name__ == "__main__": # Set base directory basedir = tmpdir_path / "example_hcp1200" # Create new datalad dataset - dataset = dl.create(path=str(basedir.absolute())) + dataset = dl.create(path=str(basedir.absolute())) # type: ignore # Generate subject directories for sub in range(1, 10): subdir = basedir / f"sub-{sub:02d}" @@ -57,15 +57,26 @@ if __name__ == "__main__": ) # Create subject data directory sub_datadir.mkdir(parents=True) + # Set subject data file sub_datafile = ( sub_datadir - / f"{new_task}_{phase_encoding}_hp2000_clean.nii.gz" + / f"{new_task}_{phase_encoding}.nii.gz" ) # Create subject data file with open(sub_datafile, "w") as f: f.write("placeholder") + if "REST" in task: + # Set subject data file with ICA+FIX + sub_datafile = ( + sub_datadir + / f"{new_task}_{phase_encoding}_hp2000_clean.nii.gz" + ) + # Create subject data file with ICA+FIX + with open(sub_datafile, "w") as f: + f.write("placeholder") + # Save datalad dataset dataset.save(recursive=True) # Add datalad sibling -- 2.52.0 From b2a7c0698fb6539de1d822c0b1790265d6441732 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:15:28 +0200 Subject: [PATCH 02/63] chore: improve sphinx ref for builtin.rst --- docs/builtin.rst | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/builtin.rst b/docs/builtin.rst index 2ec046296..5b917706e 100644 --- a/docs/builtin.rst +++ b/docs/builtin.rst @@ -43,55 +43,55 @@ Available - Type/Config - State - Version Added - * - :class:`junifer.datagrabber.DataladHCP1200` + * - :class:`.DataladHCP1200` - `HCP OpenAccess dataset `_ - Open with registration - Built-in - Done - 0.0.1 - * - :class:`junifer.configs.juseless.datagrabbers.JuselessDataladUKBVBM` + * - :class:`.JuselessDataladUKBVBM` - UKB VBM dataset preprocessed with CAT. Available for Juseless only. - Restricted - ``junifer.configs.juseless`` - Done - 0.0.1 - * - :class:`junifer.configs.juseless.datagrabbers.JuselessDataladCamCANVBM` + * - :class:`.JuselessDataladCamCANVBM` - CamCAN VBM dataset preprocessed with CAT. Available for Juseless only. - Restricted - ``junifer.configs.juseless`` - Done - 0.0.1 - * - :class:`junifer.datagrabber.DataladAOMICID1000` + * - :class:`.DataladAOMICID1000` - `AOMIC 1000 dataset `_ - Open without registration - Built-in - Done - 0.0.1 - * - :class:`junifer.datagrabber.DataladAOMICPIOP1` + * - :class:`.DataladAOMICPIOP1` - `AOMIC PIOP1 dataset `_ - Open without registration - Built-in - Done - 0.0.1 - * - :class:`junifer.datagrabber.DataladAOMICPIOP2` + * - :class:`.DataladAOMICPIOP2` - `AOMIC PIOP2 dataset `_ - Open without registration - Built-in - Done - 0.0.1 - * - :class:`junifer.configs.juseless.datagrabbers.JuselessDataladAOMICID1000VBM` + * - :class:`.JuselessDataladAOMICID1000VBM` - AOMIC ID1000 VBM dataset. Available for Juseless only. - Restricted - ``junifer.configs.juseless`` - Done - 0.0.1 - * - :class:`junifer.configs.juseless.datagrabbers.JuselessDataladIXIVBM` + * - :class:`.JuselessDataladIXIVBM` - `IXI VBM dataset `_. Available for Juseless only. - Restricted - ``junifer.configs.juseless`` - Done - 0.0.1 - * - :class:`junifer.configs.juseless.datagrabbers.JuselessUCLA` + * - :class:`.JuselessUCLA` - UCLA fMRIPrep dataset. Available for Juseless only. - Restricted - ``junifer.configs.juseless`` @@ -144,61 +144,61 @@ Available - Description - State - Version Added - * - :class:`junifer.markers.ParcelAggregation` + * - :class:`.ParcelAggregation` - Apply parcellation and perform aggregation function - Done - 0.0.1 - * - :class:`junifer.markers.FunctionalConnectivityParcels` + * - :class:`.FunctionalConnectivityParcels` - Compute functional connectivity over parcellation - Done - 0.0.1 - * - :class:`junifer.markers.CrossParcellationFC` + * - :class:`.CrossParcellationFC` - Compute functional connectivity across two parcellations - Done - 0.0.1 - * - :class:`junifer.markers.SphereAggregation` + * - :class:`.SphereAggregation` - Spherical aggregation using mean - Done - 0.0.1 - * - :class:`junifer.markers.FunctionalConnectivitySpheres` + * - :class:`.FunctionalConnectivitySpheres` - Compute functional connectivity over spheres placed on coordinates - Done - 0.0.1 - * - :class:`junifer.markers.RSSETSMarker` + * - :class:`.RSSETSMarker` - Compute root sum of squares of edgewise timeseries - Done - 0.0.1 - * - :class:`junifer.markers.ReHoParcels` + * - :class:`.ReHoParcels` - Calculate regional homogeneity over parcellation - Done - 0.0.1 - * - :class:`junifer.markers.ReHoSpheres` + * - :class:`.ReHoSpheres` - Calculate regional homogeneity over spheres placed on coordinates - Done - 0.0.1 - * - :class:`junifer.markers.ALFFParcels` + * - :class:`.ALFFParcels` - Calculate (f)ALFF and aggregate using parcellations - Done - 0.0.1 - * - :class:`junifer.markers.ALFFSpheres` + * - :class:`.ALFFSpheres` - Calculate (f)ALFF and aggregate using spheres placed on coordinates - Done - 0.0.1 - * - :class:`junifer.markers.EdgeCentricFCParcels` + * - :class:`.EdgeCentricFCParcels` - Calculate edge-centric functional connectivity over parcellation, as found in `Jo et al. (2021) `_ - Done - 0.0.2 - * - :class:`junifer.markers.EdgeCentricFCSpheres` + * - :class:`.EdgeCentricFCSpheres` - Calculate edge-centric functional connectivity over spheres placed on coordinates, as found in `Jo et al. (2021) `_ - Done - 0.0.2 - * - :class:`junifer.markers.TemporalSNRParcels` + * - :class:`.TemporalSNRParcels` - Calculate temporal signal-to-noise ratio using parcellations - Done - 0.0.2 - * - :class:`junifer.markers.TemporalSNRSpheres` + * - :class:`.TemporalSNRSpheres` - Calculate temporal signal-to-noise ratio using spheres placed on coordinates - Done - 0.0.2 -- 2.52.0 From d7c6dee0ee1d81087cb854d44ad6dc31cc7b337d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:16:17 +0200 Subject: [PATCH 03/63] chore: improve sphinx ref for 146.feature --- docs/changes/newsfragments/146.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/146.feature b/docs/changes/newsfragments/146.feature index a81598ded..5f48fac7b 100644 --- a/docs/changes/newsfragments/146.feature +++ b/docs/changes/newsfragments/146.feature @@ -1 +1 @@ -Expose a :func:`junifer.data.parcellations.merge_parcellations` function to merge a list of parcellations by `Leonard Sasse`_ \ No newline at end of file +Expose a :func:`.merge_parcellations` function to merge a list of parcellations by `Leonard Sasse`_ \ No newline at end of file -- 2.52.0 From 77d4ae794131936acefd4a80011e872639338aee Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:16:27 +0200 Subject: [PATCH 04/63] chore: improve sphinx ref for 147.feature --- docs/changes/newsfragments/147.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/147.feature b/docs/changes/newsfragments/147.feature index 6165f99c1..562701c7a 100644 --- a/docs/changes/newsfragments/147.feature +++ b/docs/changes/newsfragments/147.feature @@ -1 +1 @@ -Add support for HDF5 feature storage via :class:`junifer.storage.HDF5FeatureStorage` by `Synchon Mandal`_ \ No newline at end of file +Add support for HDF5 feature storage via :class:`.HDF5FeatureStorage` by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From 0b541e7d925813a756f7fc0054eeca0c0a088969 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:16:37 +0200 Subject: [PATCH 05/63] chore: improve sphinx ref for 158.change --- docs/changes/newsfragments/158.change | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/158.change b/docs/changes/newsfragments/158.change index bb85b938a..de74f17af 100644 --- a/docs/changes/newsfragments/158.change +++ b/docs/changes/newsfragments/158.change @@ -1 +1 @@ -Add ``confounds_format`` parameter to :class:`junifer.datagrabber.PatternDataGrabber` constructor for improved handling of confounds specified via ``BOLD_confounds`` data type by `Synchon Mandal`_ \ No newline at end of file +Add ``confounds_format`` parameter to :class:`.PatternDataGrabber` constructor for improved handling of confounds specified via ``BOLD_confounds`` data type by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From 975e4d55b7c58bd18fd6be9dbcd1823dfdb3b17d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:17:00 +0200 Subject: [PATCH 06/63] chore: improve sphinx ref for 160.enh --- docs/changes/newsfragments/160.enh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/160.enh b/docs/changes/newsfragments/160.enh index 0cb1334b9..270e188fd 100644 --- a/docs/changes/newsfragments/160.enh +++ b/docs/changes/newsfragments/160.enh @@ -1 +1 @@ -Allow :class:`junifer.testing.datagrabbers.PartlyCloudyTestingDataGrabber` to be accessible via ``import junifer.testing.registry`` by `Synchon Mandal`_ \ No newline at end of file +Allow :class:`.PartlyCloudyTestingDataGrabber` to be accessible via ``import junifer.testing.registry`` by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From 9d2d53eb6dbe07cc905dc48185f17d10f5c3c392 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:17:11 +0200 Subject: [PATCH 07/63] chore: improve sphinx ref for 163.enh --- docs/changes/newsfragments/163.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/163.feature b/docs/changes/newsfragments/163.feature index 7713815d5..73385163b 100644 --- a/docs/changes/newsfragments/163.feature +++ b/docs/changes/newsfragments/163.feature @@ -1 +1 @@ -Add :class:`junifer.markers.TemporalSNRParcels` and :class:`junifer.markers.TemporalSNRSpheres` by `Leonard Sasse`_ \ No newline at end of file +Add :class:`.TemporalSNRParcels` and :class:`.TemporalSNRSpheres` by `Leonard Sasse`_ \ No newline at end of file -- 2.52.0 From c740dbdab88138c5ae1cab3082699b256f389e2f Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:17:18 +0200 Subject: [PATCH 08/63] chore: improve sphinx ref for 187.bugfix --- docs/changes/newsfragments/187.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/187.bugfix b/docs/changes/newsfragments/187.bugfix index 4c852e949..2cd330024 100644 --- a/docs/changes/newsfragments/187.bugfix +++ b/docs/changes/newsfragments/187.bugfix @@ -1 +1 @@ -Fix :class:`junifer.markers.ALFFParcels`, :class:`junifer.markers.ALFFSpheres`, :class:`junifer.markers.ReHoSpheres` and :class:`junifer.markers.ReHoParcels` pass the ``extra_input`` parameter by `Fede Raimondo`_ \ No newline at end of file +Fix :class:`.ALFFParcels`, :class:`.ALFFSpheres`, :class:`.ReHoSpheres` and :class:`.ReHoParcels` pass the ``extra_input`` parameter by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From fe25f7ed75c86cbccb8860e13b30be98d71ef7db Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:17:26 +0200 Subject: [PATCH 09/63] chore: improve sphinx ref for 190.change --- docs/changes/newsfragments/190.change | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/190.change b/docs/changes/newsfragments/190.change index fd3333b23..7c844e40d 100644 --- a/docs/changes/newsfragments/190.change +++ b/docs/changes/newsfragments/190.change @@ -1 +1 @@ -Expose ``allow_overlap`` parameter in :class:`junifer.markers.SphereAggregation` and related markers by `Fede Raimondo`_ \ No newline at end of file +Expose ``allow_overlap`` parameter in :class:`.SphereAggregation` and related markers by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From ce41c3c234846a24a1d50dd9d580471382e56578 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:17:55 +0200 Subject: [PATCH 10/63] chore: improve sphinx ref for 190.enh --- docs/changes/newsfragments/190.enh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/190.enh b/docs/changes/newsfragments/190.enh index 0453d948a..24ebc90db 100644 --- a/docs/changes/newsfragments/190.enh +++ b/docs/changes/newsfragments/190.enh @@ -1 +1 @@ -Allow for empty spheres in :class:`junifer.external.nilearn.JuniferNiftiSpheresMasker`, that will result in NaNs. Also, modify the behaviour of the ``collect`` parameter in HTCondor ``queue`` function to run a collect job even if some of the previous jobs fail. This is useful to collect the results of a pipeline even if some of the jobs fail by `Fede Raimondo`_ \ No newline at end of file +Allow for empty spheres in :class:`.JuniferNiftiSpheresMasker`, that will result in NaNs. Also, modify the behaviour of the ``collect`` parameter in HTCondor ``queue`` function to run a collect job even if some of the previous jobs fail. This is useful to collect the results of a pipeline even if some of the jobs fail by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From 10044364abfb838bcab899077a237023dde74f01 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:18:05 +0200 Subject: [PATCH 11/63] chore: improve sphinx ref for 190.feature --- docs/changes/newsfragments/190.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/190.feature b/docs/changes/newsfragments/190.feature index 18386799f..0e2fc4aae 100644 --- a/docs/changes/newsfragments/190.feature +++ b/docs/changes/newsfragments/190.feature @@ -1 +1 @@ -Add aggregation function :func:`junifer.stats.count` that returns the number of elements in a given axis. This allows to count the number of voxels per sphere/parcel when used as ``method`` in markers by `Fede Raimondo`_ \ No newline at end of file +Add aggregation function :func:`.count` that returns the number of elements in a given axis. This allows to count the number of voxels per sphere/parcel when used as ``method`` in markers by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From 76c15fbf94ef93bf1159ef7f7aa0c49648d8e21b Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:18:11 +0200 Subject: [PATCH 12/63] chore: improve sphinx ref for 194.bugfix --- docs/changes/newsfragments/194.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/194.bugfix b/docs/changes/newsfragments/194.bugfix index 561bb0686..922eb87e5 100644 --- a/docs/changes/newsfragments/194.bugfix +++ b/docs/changes/newsfragments/194.bugfix @@ -1 +1 @@ -Fix a bug in which :class:`junifer.markers.ParcelAggregation` could yield duplicated column names if two or more parcels were used and label names were not unique by `Fede Raimondo`_ \ No newline at end of file +Fix a bug in which :class:`.ParcelAggregation` could yield duplicated column names if two or more parcels were used and label names were not unique by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From aacad5becd1ea85c7bb3712cba558bec2725c539 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:18:47 +0200 Subject: [PATCH 13/63] chore: improve sphinx ref for 194.enh --- docs/changes/newsfragments/194.enh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/194.enh b/docs/changes/newsfragments/194.enh index f4d4123b9..c821fc734 100644 --- a/docs/changes/newsfragments/194.enh +++ b/docs/changes/newsfragments/194.enh @@ -1 +1 @@ -Allow for empty parcels in :class:`junifer.markers.ParcelAggregation`, that will result in NaNs by `Fede Raimondo`_ \ No newline at end of file +Allow for empty parcels in :class:`.ParcelAggregation`, that will result in NaNs by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From d2e4b590386acbb4f485f32185191ba0288e18e7 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:18:56 +0200 Subject: [PATCH 14/63] chore: improve sphinx ref for 195.bugfix --- docs/changes/newsfragments/195.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/195.bugfix b/docs/changes/newsfragments/195.bugfix index f5bb6d7d6..8a89cc9da 100644 --- a/docs/changes/newsfragments/195.bugfix +++ b/docs/changes/newsfragments/195.bugfix @@ -1 +1 @@ -Fix a bug in which :func:`junifer.stats.count` will not be correctly applied across an axis by `Fede Raimondo`_ \ No newline at end of file +Fix a bug in which :func:`.count` will not be correctly applied across an axis by `Fede Raimondo`_ \ No newline at end of file -- 2.52.0 From cbb4690398ed2dbf71bded610b336696209f2bbf Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:19:06 +0200 Subject: [PATCH 15/63] chore: improve sphinx ref for 196.enh --- docs/changes/newsfragments/196.enh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/196.enh b/docs/changes/newsfragments/196.enh index 02b0a3c8d..afbe29424 100644 --- a/docs/changes/newsfragments/196.enh +++ b/docs/changes/newsfragments/196.enh @@ -1 +1 @@ -Improve metadata and data I/O for :class:`junifer.storage.HDF5FeatureStorage` by `Synchon Mandal`_ \ No newline at end of file +Improve metadata and data I/O for :class:`.HDF5FeatureStorage` by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From 761d384553628ebeb579c486c8832a6c756ca36c Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:19:14 +0200 Subject: [PATCH 16/63] chore: improve sphinx ref for 200.bugfix --- docs/changes/newsfragments/200.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/200.bugfix b/docs/changes/newsfragments/200.bugfix index f16beff4c..1785e3870 100644 --- a/docs/changes/newsfragments/200.bugfix +++ b/docs/changes/newsfragments/200.bugfix @@ -1 +1 @@ -Fix a bug in which :func:`junifer.data.masks.get_mask` fails for FunctionalConnectivityBase class, because of missing extra_input parameter by `Leonard Sasse`_ \ No newline at end of file +Fix a bug in which :func:`.get_mask` fails for FunctionalConnectivityBase class, because of missing extra_input parameter by `Leonard Sasse`_ \ No newline at end of file -- 2.52.0 From cfde22f6d80d7246540c9014454cd3586683bd8e Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:19:21 +0200 Subject: [PATCH 17/63] chore: improve sphinx ref for 214.enh --- docs/changes/newsfragments/214.enh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/214.enh b/docs/changes/newsfragments/214.enh index dcd629ae6..72f0c43e7 100644 --- a/docs/changes/newsfragments/214.enh +++ b/docs/changes/newsfragments/214.enh @@ -1 +1 @@ -Add missing ``abstractmethod`` decorators for ``get_valid_inputs`` methods of :class:`junifer.markers.BaseMarker` and :class:`junifer.preprocess.BasePreprocessor` by `Synchon Mandal`_ \ No newline at end of file +Add missing ``abstractmethod`` decorators for ``get_valid_inputs`` methods of :class:`.BaseMarker` and :class:`.BasePreprocessor` by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From c21b1422581387cf40a506b98225921a1563f0fe Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:19:38 +0200 Subject: [PATCH 18/63] chore: improve sphinx ref for 215.bugfix --- docs/changes/newsfragments/215.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/215.bugfix b/docs/changes/newsfragments/215.bugfix index 93d56dcf2..2e3885b3f 100644 --- a/docs/changes/newsfragments/215.bugfix +++ b/docs/changes/newsfragments/215.bugfix @@ -1 +1 @@ -Fix the output of :class:`junifer.markers.RSSETSMarker` to be 2D by `Synchon Mandal`_ \ No newline at end of file +Fix the output of :class:`.RSSETSMarker` to be 2D by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From b9b4d60a64973e41d0851674d29908ce0ccffe77 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:19:49 +0200 Subject: [PATCH 19/63] chore: improve sphinx ref for 216.change --- docs/changes/newsfragments/216.change | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/216.change b/docs/changes/newsfragments/216.change index 01d731587..bbd1008f2 100644 --- a/docs/changes/newsfragments/216.change +++ b/docs/changes/newsfragments/216.change @@ -1 +1 @@ -``AmplitudeLowFrequencyFluctuationParcels`` and ``AmplitudeLowFrequencyFluctuationSpheres`` are renamed to :class:`junifer.markers.ALFFParcels` and :class:`junifer.markers.ALFFSpheres` by `Synchon Mandal`_ \ No newline at end of file +Rename ``AmplitudeLowFrequencyFluctuationParcels`` and ``AmplitudeLowFrequencyFluctuationSpheres`` to :class:`.ALFFParcels` and :class:`.ALFFSpheres` by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From 625f85fe94093d8ee89bab1f406fa29365d84133 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:20:07 +0200 Subject: [PATCH 20/63] chore: improve sphinx ref for 64.feature --- docs/changes/newsfragments/64.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes/newsfragments/64.feature b/docs/changes/newsfragments/64.feature index cde4bc078..69976419e 100644 --- a/docs/changes/newsfragments/64.feature +++ b/docs/changes/newsfragments/64.feature @@ -1 +1 @@ -Add :class:`junifer.markers.EdgeCentricFCParcels` and :class:`junifer.markers.EdgeCentricFCSpheres` by `Leonard Sasse`_ \ No newline at end of file +Add :class:`.EdgeCentricFCParcels` and :class:`.EdgeCentricFCSpheres` by `Leonard Sasse`_ \ No newline at end of file -- 2.52.0 From c527b876314def2f45cf3fd1277ec1225e745c5f Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:20:15 +0200 Subject: [PATCH 21/63] chore: improve sphinx ref for coordinates.rst --- docs/extending/coordinates.rst | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/docs/extending/coordinates.rst b/docs/extending/coordinates.rst index 3ce75ba68..78206b549 100644 --- a/docs/extending/coordinates.rst +++ b/docs/extending/coordinates.rst @@ -6,11 +6,9 @@ Adding Coordinates ================== Instead of using whole-brain parcellations to aggregate voxel-wise signals from -MR images (as for example in the -:class:`junifer.markers.parcel_aggregation.ParcelAggregation` marker), Junifer +MR images (as for example in the :class:`.ParcelAggregation` marker), Junifer allows you to specify a set of coordinates around which to draw spheres to -aggregate (for example using the -:class:`junifer.markers.sphere_aggregation.SphereAggregation` marker) the MR +aggregate (for example using the :class:`.SphereAggregation` marker) the MR signals from individual voxels. Now, before you start specifying your own sets of coordinates, check the coordinates that Junifer already has :ref:`built in `. If you simply want to use a well known set of @@ -19,9 +17,8 @@ provides them already. If you checked the in-built coordinates, and they are not there already (for example if you came up with your own set of coordinates), then Junifer provides -an easy way for you to register them using the -:func:`junifer.data.coordinates.register_coordinates` function, so you can use -your own set of coordinates within a Junifer pipeline. +an easy way for you to register them using the :func:`.register_coordinates` +function, so you can use your own set of coordinates within a Junifer pipeline. From the API reference, we can see that it has 3 positional arguments (``name``, ``coordinates``, and ``voi_names``) as well as one @@ -30,10 +27,9 @@ optional keyword argument (``overwrite``). The ``name`` argument takes a string indicating the name you want to give to this set of coordinates. This ``name`` can be used to obtain and operate on a set of coordinates in Junifer. For example, you can obtain your coordinates -after registration by providing ``name`` to -:func:`junifer.data.coordinates.load_coordinates`. We could simply call it -``"my_set_of_coordinates"``, but likely you want a more descriptive and more -informative name most of the time. +after registration by providing ``name`` to :func:`.load_coordinates`. We could +simply call it ``"my_set_of_coordinates"``, but likely you want a more +descriptive and more informative name most of the time. The ``coordinates`` argument takes the actual coordinates as a 2-dimensional :class:`numpy.ndarray`. It contains one row for every location, and three @@ -116,8 +112,7 @@ you can use the ``with`` keyword provided by Junifer: Afterwards continue configuring the rest of your pipeline in this YAML file, and you will be able to use this set of coordinates using the name you gave it during registration (in our example "DMNCustom"). We can add a -:class:`junifer.markers.sphere_aggregation.SphereAggregation` to demonstrate -how this can be done: +:class:`.SphereAggregation` to demonstrate how this can be done: .. code-block:: yaml -- 2.52.0 From 49c039d0050a8fb6c3cd22ef8df8771990ad4e5a Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:20:27 +0200 Subject: [PATCH 22/63] chore: improve sphinx ref for datagrabber.rst --- docs/extending/datagrabber.rst | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/extending/datagrabber.rst b/docs/extending/datagrabber.rst index 6231d4e07..096b725ce 100644 --- a/docs/extending/datagrabber.rst +++ b/docs/extending/datagrabber.rst @@ -13,7 +13,7 @@ the structure of a dataset and provide two specific functionalities: 2) Provide the list of *elements* available in the dataset. In this section, we will see how to create a datagrabber for a dataset. Basic -aspects of datagrabbers are covered in the +aspects of datagrabbers are covered in the :ref:`Understanding Data Grabbers ` section. .. _extending_datagrabbers_think: @@ -29,7 +29,7 @@ only one of each *data type* (see :ref:`data_types`). For example, if we have a dataset from an fMRI study in which: -a) both T1w and fMRI was acquired +a) both T1w and fMRI was acquired b) 20 subjects went through an experiment twice c) the experiment included resting-stage fMRI and a task named *stroop* @@ -64,7 +64,7 @@ Junifer provides an abstract class to deal with datasets that can be thought in terms of *patterns*. A *pattern* is a string that contains placeholders that are replaced by the actual values of the element. In our BIDS example, the path to the T1w image of subject `sub-01` and session `ses-01`, relative to the -dataset location, is ``sub-01/ses-01/anat/sub-01_ses-01_T1w.nii.gz``. By +dataset location, is ``sub-01/ses-01/anat/sub-01_ses-01_T1w.nii.gz``. By replacing ``sub-01`` with ``sub-02``, we can obtain the T1w image of the first session of the second subject. Indeed, the path to the T1w images can be expressed as a pattern: @@ -105,7 +105,7 @@ in it. Before creating the datagrabber, we need to define 3 variables: -* ``types``: A list with the available :ref:`data_types` in our dataset +* ``types``: A list with the available :ref:`data_types` in our dataset * ``patterns``: A dictionary that specifies the pattern for each data type. * ``replacements``: A list indicating which of the elements in the patterns should be replaced by the values of the element. @@ -125,7 +125,7 @@ An additional fourth variable is the ``datadir``, which should be the path to where the dataset is located. For example, if the dataset is located in ``/data/project/test/data``, then ``datadir`` should be ``/data/project/test/data``. Or, if we want to allow the user to specify the -location of the dataset, we can expose the variable in the constructor, as in +location of the dataset, we can expose the variable in the constructor, as in this example With this defined, we can now create our datagrabber, we will name it @@ -147,7 +147,7 @@ With this defined, we can now create our datagrabber, we will name it replacements = ["subject", "session"] super().__init__( datadir=datadir, - types=types, + types=types, patterns=patterns, replacements=replacements, ) @@ -175,7 +175,7 @@ use the :py:func:`~junifer.api.decorators.register_datagrabber` decorator. replacements = ["subject", "session"] super().__init__( datadir=datadir, - types=types, + types=types, patterns=patterns, replacements=replacements, ) @@ -186,29 +186,29 @@ in the yaml file to ``ExampleBIDSDataGrabber``. Remember that we still need to set the ``datadir``. .. code-block:: yaml - + datagrabber: kind: ExampleBIDSDataGrabber datadir: /data/project/test/data -Optional: Using datalad +Optional: Using datalad """"""""""""""""""""""" -If you are using `datalad`_, you can use the -:py:class:`~junifer.datagrabber.PatternDataladDataGrabber` instead of the +If you are using `datalad`_, you can use the +:py:class:`~junifer.datagrabber.PatternDataladDataGrabber` instead of the :py:class:`~junifer.datagrabber.PatternDataGrabber`. This class will not only interpret patterns, but also use `datalad`_ to `clone` and `get` the data. The main difference between the two is that the ``datadir`` is not the actual -location of the dataset, but the location where the dataset will be cloned. It +location of the dataset, but the location where the dataset will be cloned. It can now be ``None``, which means that the data will be downloaded to a temporary directory. To set the location of the dataset, you can use the ``uri`` argument in the constructor. Additionally, a ``rootdir`` argument can be used to specify the path to the root directory of the dataset after doing ``datalad clone``. -In the example, the dataset is hosted in gin +In the example, the dataset is hosted in gin (``https://gin.g-node.org/juaml/datalad-example-bids``). When we clone this dataset, we will see the following structure: @@ -262,7 +262,7 @@ And we can create our datagrabber: datadir=None, uri=uri, rootdir=rootdir, - types=types, + types=types, patterns=patterns, replacements=replacements, ) @@ -287,7 +287,7 @@ implement the following methods: The ``__init__`` method could also be implemented, but it is not mandatory. This is required if the datagrabber requires any parameter. -We will now implement our BIDS example with this method. +We will now implement our BIDS example with this method. The first method, ``get_item``, needs to obtain a single item from the dataset. Since this dataset requires two variables, ``subject`` and ``session``, we will use them @@ -366,11 +366,12 @@ So, to summarize, our datagrabber will look like this: def get_element_keys(self): return ["subject", "session"] -Optional: Using datalad +Optional: Using datalad """"""""""""""""""""""" -If this dataset is in a datalad dataset, we can extend from :class:`junifer.datagrabber.DataladDataGrabber` instead of -:class:`junifer.datagrabber.BaseDataGrabber`. This will allow us to use the datalad API to obtain the data. +If this dataset is in a datalad dataset, we can extend from +:class:`.DataladDataGrabber` instead of :class:`.BaseDataGrabber`. This will +allow us to use the datalad API to obtain the data. Step 4: Optional: Adding *BOLD confounds* @@ -385,7 +386,7 @@ Thus, the ``BOLD_confounds`` element is a dictionary with the following keys: - ``format``: the format of the confounds file. Currently, this can be either ``fmriprep`` or ``adhoc``. The ``fmriprep`` format corresponds to the format of the confounds files generated by `fMRIPrep`_. The -``adhoc`` format corresponds to a format that is not standardized. +``adhoc`` format corresponds to a format that is not standardized. .. note:: The ``mappings`` key is only required if the ``format`` is ``adhoc``. If the ``format`` is ``fmriprep``, the @@ -393,9 +394,9 @@ The ``fmriprep`` format corresponds to the format of the confounds files generat Currently, Junifer provides only one confound remover step -(:class:`junifer.preprocess.fMRIPrepConfoundRemover`), which relies entirely on the ``fmriprep`` confound -variable names. Thus, if the confounds are not in ``fmriprep`` format, the user will need to provide the mappings -between the *ad-hoc* variable names and the ``fmriprep`` variable names. +(:class:`.fMRIPrepConfoundRemover`), which relies entirely on the ``fmriprep`` confound +variable names. Thus, if the confounds are not in ``fmriprep`` format, the user will need to provide the mappings +between the *ad-hoc* variable names and the ``fmriprep`` variable names. This is done by specifying the ``adhoc`` format and providing the mappings as a dictionary in the ``mappings`` key. In the following example, the confounds file has 3 variables that are not in the ``fmriprep`` format. Thus, we will @@ -418,7 +419,6 @@ provide the mappings for these variables to the ``fmriprep`` format. .. note:: Not all of the mappings need to be provided. For the moment, this is used only by the - :class:`junifer.preprocess.fMRIPrepConfoundRemover` step, which requires variables based on the + :class:`.fMRIPrepConfoundRemover` step, which requires variables based on the strategy selected. However, it is recommended to provide all the mappings, as this will allow the user to choose different strategies with the same dataset. - -- 2.52.0 From 6640daa704b7975e7a5831b2e638122e48aabe02 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:20:33 +0200 Subject: [PATCH 23/63] chore: improve sphinx ref for marker.rst --- docs/extending/marker.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/extending/marker.rst b/docs/extending/marker.rst index a9f79c1d5..9fb4c3180 100644 --- a/docs/extending/marker.rst +++ b/docs/extending/marker.rst @@ -9,14 +9,14 @@ Computing a marker (a.k.a. *feature*) is the main goal of junifer. While we aim it might be the case that the marker you are looking for is not available. In this case, you can create your own marker by following this tutorial. -Most of the functionality of a junifer marker has been taken care by the :class:`junifer.markers.BaseMarker` class. +Most of the functionality of a junifer marker has been taken care by the :class:`.BaseMarker` class. Thus, only a few methods are required: 1. ``get_valid_inputs``: a method to obtain the list of valid inputs for the marker. This is used to check that the - inputs provided by the user are valid. This method should return a list of strings, representing + inputs provided by the user are valid. This method should return a list of strings, representing :ref:`data types ` 2. ``get_output_type``: a method to obtain the kind of output of the marker. This is used to check that the output - of the marker is compatible with the storage. This method should return a string, representing + of the marker is compatible with the storage. This method should return a string, representing :ref:`storage types ` 3. ``compute``: the method that given the data, computes the marker. 4. ``__init__``: the initialization method, where the marker is configured. @@ -57,7 +57,7 @@ Step 2: Initialize the marker In this step we need to define the parameters of the marker. That is, all the parameters that the user can provide to configure how the marker will behave. -The parameters of the marker are defined in the ``__init__`` method. The :class:`junifer.markers.BaseMarker` class +The parameters of the marker are defined in the ``__init__`` method. The :class:`.BaseMarker` class requires two optional parameters: 1. ``name``: the name of the marker. This is used to identify the marker in the configuration file. @@ -71,13 +71,13 @@ In this example, the is only paramater required for the computation is the name define the ``__init__`` method as follows: .. code-block:: python - + def __init__(self, parcellation_name, on=None, name=None): self.parcellation_name = parcellation_name super().__init__(on=on, name=name) .. caution:: Parameters of the marker must be stored as object attributes without using ``_`` as prefix. This is - because any attribute that starts with ``_`` will not be considered as a parameter and not stored as + because any attribute that starts with ``_`` will not be considered as a parameter and not stored as part of the metadata of the marker. @@ -89,7 +89,7 @@ Step 3: Compute the marker In this step, we will define the method that computes the marker. This method will be called by junifer when needed, using the data provided by the datagrabber, as configured by the user. The function ``compute`` has two arguments: -* ``input``: a dictionary with the data to be used to compute the marker. This will be the corresponding element in the +* ``input``: a dictionary with the data to be used to compute the marker. This will be the corresponding element in the :ref:`Data Object` alredy indexing. Thus, the dictionary has at least two keys: ``data`` and ``path``. The first one contains the data, while the second one contains the path to the data. The dictionary can also contain other keys, depending on the data type. @@ -176,7 +176,7 @@ Finally, we need to register the marker using the ``@register_marker`` decorator def __init__(self, parcellation_name, on=None, name=None): self.parcellation_name = parcellation_name super().__init__(on=on, name=name) - + def get_valid_inputs(self): return ['BOLD', 'VBM_WM', 'VBM_GM'] @@ -235,7 +235,7 @@ Template for a custom Marker def __init__(self, on=None, name=None): # TODO: add marker-specific parameters super().__init__(on=on, name=name) - + def get_valid_inputs(self): # TODO: Complete with the valid inputs valid = [] -- 2.52.0 From 73dbce41d34c4888c51138110d4ac1cabac8ac0e Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:21:03 +0200 Subject: [PATCH 24/63] chore: improve sphinx ref for masks.rst --- docs/extending/masks.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/extending/masks.rst b/docs/extending/masks.rst index ae486ac29..1daa9a724 100644 --- a/docs/extending/masks.rst +++ b/docs/extending/masks.rst @@ -14,16 +14,16 @@ suit your needs, and you have found that they don't, you can come back here to learn how to use your own masks. The principle is fairly simple and quite similar to :ref:`adding_parcellations` -and :ref:`adding_coordinates`. Junifer provides a -:func:`junifer.data.masks.register_mask` function that lets you register your -own custom masks. It consists of two positional arguments (``name`` and -``mask_path``) and one optional keyword argument (``overwrite``). +and :ref:`adding_coordinates`. Junifer provides a :func:`.register_mask` +function that lets you register your own custom masks. It consists of two +positional arguments (``name`` and ``mask_path``) and one optional keyword +argument (``overwrite``). The ``name`` argument is a string indicating the name of the mask. This name is used to refer to that mask in Junifer internally in order to obtain the actual mask data and perform operations on it. For example, using the name you can load a mask after registration using the -:func:`junifer.data.masks.load_mask` function. +:func:`.load_mask` function. The ``mask_path`` should contain the path to a valid NIfTI image with binary voxel values (i.e. 0 or 1). This data can then be used by Junifer to mask other -- 2.52.0 From 2aad0c0cf8fa48d560c2d378e1f3aa7b99df8a11 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:21:13 +0200 Subject: [PATCH 25/63] chore: improve sphinx ref for parcellations.rst --- docs/extending/parcellations.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/extending/parcellations.rst b/docs/extending/parcellations.rst index 682cbb39c..7059719dd 100644 --- a/docs/extending/parcellations.rst +++ b/docs/extending/parcellations.rst @@ -16,9 +16,9 @@ markers to assess and validate your own parcellation. So, how can you do this? Since both of these use-cases are quite common, and not being able to use your favourite parcellation is of course quite a buzzkill, Junifer actually provides -the easy-to-use :func:`junifer.data.parcellations.register_parcellation` -function to do just that. Let's try to understand the API reference -and then use this function to register our own parcellation. +the easy-to-use :func:`.register_parcellation` function to do just that. Let's +try to understand the API reference and then use this function to register our +own parcellation. From the API reference, we can see that it has 3 positional arguments (``name``, ``parcellation_path``, and ``parcels_labels``) as well as one @@ -101,8 +101,7 @@ file, we can save the above code in a python file, say Afterwards continue configuring the rest of the pipeline in this YAML file, and you will be able to use this parcellation using the name you gave the parcellation when registering it. For example, we can add a -:class:`junifer.markers.parcel_aggregation.ParcelAggregation` marker to -demonstrate how this can be done: +:class:`.ParcelAggregation` marker to demonstrate how this can be done: .. code-block:: yaml -- 2.52.0 From 09e62b855982f37d161da0f6236e9ea435b37700 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:21:27 +0200 Subject: [PATCH 26/63] chore: improve sphinx ref for faq.rst --- docs/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index a9bc63b14..604b858de 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -21,7 +21,7 @@ The following steps are specific to VSCode and you can choose to go with it: 2. We recommend using ``conda`` to create your virtual environment - .. code-block:: console + .. code-block:: bash conda env create -n -f conda-env.yml python=3.9 conda activate -- 2.52.0 From 3ce92047360776b4e014928aec672dd2c04836b0 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:21:39 +0200 Subject: [PATCH 27/63] chore: improve sphinx ref for installation.rst --- docs/installation.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 3ed3ed335..a4164cb5f 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -11,12 +11,13 @@ junifer is compatible with `Python`_ >= 3.8 and requires the following packages: * ``click>=8.1.3,<8.2`` * ``numpy>=1.22,<1.24`` -* ``datalad>=0.15.4,<0.18`` +* ``datalad>=0.15.4,<0.19`` * ``pandas>=1.4.0,<1.6`` * ``nibabel>=3.2.0,<4.1`` -* ``nilearn>=0.9.0,<1.0`` +* ``nilearn>=0.9.0,<=0.10.0`` * ``sqlalchemy>=1.4.27,<= 1.5.0`` * ``pyyaml>=5.1.2,<7.0`` +* ``h5py>=3.8.0,<3.9`` Depending on the installation method, these packages might be installed automatically. -- 2.52.0 From 36f36b92913eb5bc01cdf4bb8ca48b79e113fce6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:21:51 +0200 Subject: [PATCH 28/63] chore: improve sphinx ref for datagrabber.rst --- docs/understanding/datagrabber.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/understanding/datagrabber.rst b/docs/understanding/datagrabber.rst index 96cd338f6..8da29f6b0 100644 --- a/docs/understanding/datagrabber.rst +++ b/docs/understanding/datagrabber.rst @@ -17,7 +17,7 @@ Datagrabbers are intended to be used as context managers. When used within a con of any pre and post steps for interacting with the dataset, for example, downloading and cleaning up. As the interface is consistent, you always use the same procedure to interact with the datagrabber. -For example, a concrete implementation of :class:`junifer.datagrabber.DataladDataGrabber` can provide junifer +For example, a concrete implementation of :class:`.DataladDataGrabber` can provide junifer with data from a Datalad dataset. Of course, datagrabbers are not only meant to work with Datalad datasets but any dataset. @@ -36,19 +36,19 @@ In this section, we showcase different abstract base classes you might want to u * - Name - Description - * - :class:`junifer.datagrabber.BaseDataGrabber` + * - :class:`.BaseDataGrabber` - | The abstract base class providing you an interface to implement your own datagrabber. | You should try to avoid using this directly and instead use - | :class:`junifer.datagrabber.PatternDataGrabber` or :class:`junifer.datagrabber.DataladDataGrabber`. + | :class:`.PatternDataGrabber` or :class:`.DataladDataGrabber`. | To build your own custom *low-level* datagrabber, you need to at least implement the ``get_elements`` method, | but most of the time you should also override other existing methods like ``__enter__`` and ``__exit__``. - * - :class:`junifer.datagrabber.PatternDataGrabber` + * - :class:`.PatternDataGrabber` - | It implements functionality to help you define the pattern of the dataset you want to get. For example, | you know that T1 images are found in a directory following this pattern ``{subject}/anat/{subject}_T1w.nii.gz`` | inside of the dataset. Now you can provide this to the **PatternDataGrabber** and it will be able to get the file. - * - :class:`junifer.datagrabber.DataladDataGrabber` + * - :class:`.DataladDataGrabber` - | It implements functionality to deal with Datalad datasets. Specifically, the ``__enter__`` and ``__exit__`` methods | take care of cloning and removing the Datalad dataset. - * - :class:`junifer.datagrabber.PatternDataladDataGrabber` - - | It is a combination of :class:`junifer.datagrabber.PatternDataladDataGrabber` and - | :class:`junifer.datagrabber.DataladDataGrabber`. This is probably the class you are looking for when using Datalad. + * - :class:`.PatternDataladDataGrabber` + - | It is a combination of :class:`.PatternDataladDataGrabber` and + | :class:`.DataladDataGrabber`. This is probably the class you are looking for when using Datalad. -- 2.52.0 From 1b4eaaf7371090776b6b89c32b7bd10dcdeccc72 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:21:58 +0200 Subject: [PATCH 29/63] chore: improve sphinx ref for datareader.rst --- docs/understanding/datareader.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/understanding/datareader.rst b/docs/understanding/datareader.rst index f4717ed4b..5449b095c 100644 --- a/docs/understanding/datareader.rst +++ b/docs/understanding/datareader.rst @@ -22,7 +22,7 @@ For data formats not supported by junifer yet, you can either make your own *Dat Currently supported file-formats -------------------------------- -We already provide a concrete implementation :class:`junifer.datareader.DefaultDataReader` which knows how to +We already provide a concrete implementation :class:`.DefaultDataReader` which knows how to read the following file formats: .. list-table:: -- 2.52.0 From 94638742c9636ec341550c4de6bdac5c596b1caf Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:34:25 +0200 Subject: [PATCH 30/63] chore: improve sphinx ref for marker.rst --- docs/understanding/marker.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/understanding/marker.rst b/docs/understanding/marker.rst index 1ccdfce12..6c97eb613 100644 --- a/docs/understanding/marker.rst +++ b/docs/understanding/marker.rst @@ -19,5 +19,5 @@ Markers are meant to be used inside the datagrabber context but you can operate as the actual data is in the memory and the Python runtime has not garbage-collected it. If you are interested in using already provided markers, please go to :doc:`../builtin`. And, if you want to implement -your own marker, you need to provide concrete implementation of :class:`junifer.markers.BaseMarker`. Specifically, you +your own marker, you need to provide concrete implementation of :class:`.BaseMarker`. Specifically, you need to override ``get_output_type``, ``store`` and ``compute`` methods. -- 2.52.0 From c2f94987e1d9297c1b42940e1fa2edacf565b5b4 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:34:33 +0200 Subject: [PATCH 31/63] chore: improve sphinx ref for preprocess.rst --- docs/understanding/preprocess.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/understanding/preprocess.rst b/docs/understanding/preprocess.rst index 99f397dc0..ae2eb0e53 100644 --- a/docs/understanding/preprocess.rst +++ b/docs/understanding/preprocess.rst @@ -23,8 +23,8 @@ The *Confound Removal* step is meant to remove *confounds* from the ``BOLD`` dat extracted from the ``BOLD_confounds`` data (must be provided by the :ref:`Data Grabber `). The confounds are then regressed out from the ``BOLD`` data using :func:`nilearn.image.clean_img`. -Currently, junifer supports only one confound removal class: -:class:`junifer.preprocess.fMRIPrepConfoundRemover`. This class is meant to remove confounds as described +Currently, junifer supports only one confound removal class: +:class:`.fMRIPrepConfoundRemover`. This class is meant to remove confounds as described before, using the output of `fMRIPrep`_ as reference. Strategy @@ -54,7 +54,7 @@ The *strategy* is defined as a dictionary, with the *noise components* as keys a Example in python format: -.. code-block:: +.. code-block:: strategy = { "motion": "basic", @@ -64,8 +64,8 @@ Example in python format: or in YAML format: -.. code-block:: - +.. code-block:: + strategy: motion: basic wm_csf: full @@ -73,7 +73,7 @@ or in YAML format: The default value is to use all the *noise components* with the ``full`` *confounds*: -.. code-block:: +.. code-block:: strategy = { "motion": "full", @@ -84,7 +84,7 @@ The default value is to use all the *noise components* with the ``full`` *confou Other parameters ~~~~~~~~~~~~~~~~ -Additionaly, the :class:`junifer.preprocess.fMRIPrepConfoundRemover` supports the following parameters: +Additionaly, the :class:`.fMRIPrepConfoundRemover` supports the following parameters: .. list-table:: :widths: 10, 30, 5 @@ -113,4 +113,4 @@ Additionaly, the :class:`junifer.preprocess.fMRIPrepConfoundRemover` supports th - from nifti header * - ``mask`` - If provided, signal is only cleaned from voxels inside the mask. If not, a mask is computed using :func:`nilearn.masking.compute_brain_mask`. - - compute \ No newline at end of file + - compute -- 2.52.0 From 7c383cc29c9efcc782cadd665063251b8c9d0ab7 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:34:39 +0200 Subject: [PATCH 32/63] chore: improve sphinx ref for storage.rst --- docs/understanding/storage.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/understanding/storage.rst b/docs/understanding/storage.rst index fb637c91b..6d02712b7 100644 --- a/docs/understanding/storage.rst +++ b/docs/understanding/storage.rst @@ -17,12 +17,12 @@ as the processed data is in the memory and the Python runtime has not garbage-co The :ref:`Markers ` are responsible for defining what *storage kind* (``matrix``, ``vector``, ``timeseries``) they support for which :ref:`data type ` by overriding its ``store`` method. The storage object in turn -declares and provides implementation for specific *storage kind*. For example, :class:`junifer.storage.SQLiteFeatureStorage` +declares and provides implementation for specific *storage kind*. For example, :class:`.SQLiteFeatureStorage` supports saving ``matrix``, ``vector`` and ``timeseries`` via ``store_matrix``, ``store_vector`` and ``store_timeseries`` methods respectively. For storage interfaces not supported by junifer yet, you can either make your own ``Storage`` by providing a concrete -implementation of :class:`junifer.storage.BaseFeatureStorage` or open an issue on `junifer Github`_ and we can help you out. +implementation of :class:`.BaseFeatureStorage` or open an issue on `junifer Github`_ and we can help you out. .. _storage_types: @@ -41,15 +41,15 @@ Currently supported storage types * - ``matrix`` - A 2D matrix with row and column names - ``col_names``, ``row_names``, ``matrix_kind``, ``diagonal`` - - :meth:`junifer.storage.BaseFeatureStorage.store_matrix` + - :meth:`.BaseFeatureStorage.store_matrix` * - ``vector`` - A vector of values with column names - ``columns``, ``row_names`` - - :meth:`junifer.storage.BaseFeatureStorage.store_vector` + - :meth:`.BaseFeatureStorage.store_vector` * - ``timeseries`` - A 2D matrix of values with column names - ``columns``, ``row_names`` - - :meth:`junifer.storage.BaseFeatureStorage.store_timeseries` + - :meth:`.BaseFeatureStorage.store_timeseries` .. _storage_interfaces: @@ -64,11 +64,11 @@ Currently supported storage interfaces - File extension - File type - Storage kinds - * - :class:`junifer.storage.SQLiteFeatureStorage` + * - :class:`.SQLiteFeatureStorage` - ``.sqlite`` - SQLite - ``matrix``, ``vector``, ``timeseries`` - * - :class:`junifer.storage.HDF5FeatureStorage` + * - :class:`.HDF5FeatureStorage` - ``.hdf5`` - HDF5 - ``matrix``, ``vector``, ``timeseries`` -- 2.52.0 From 4e4978f597217f7d6ed076bd30b574dd4bcf1d68 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:34:48 +0200 Subject: [PATCH 33/63] chore: improve sphinx ref for codeless.rst --- docs/using/codeless.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/using/codeless.rst b/docs/using/codeless.rst index 945e08397..15fcc73cd 100644 --- a/docs/using/codeless.rst +++ b/docs/using/codeless.rst @@ -11,7 +11,7 @@ achieved by using a configuration file that is written in YAML_. In this file, w As a reminder, this is how the pipeline looks like: -.. mermaid:: +.. mermaid:: flowchart LR dg[Data Grabber] @@ -70,7 +70,7 @@ Data Grabber The ``datagrabber`` section must be configured using the ``kind`` key to specify the datagrabber to use. Additional keys correspond to the parameters of the datagrabber. -For example, to use the :class:`junifer.datagrabber.DataladAOMICPIOP1` datagrabber, we just need to +For example, to use the :class:`.DataladAOMICPIOP1` datagrabber, we just need to specify its name as the ``kind`` key. .. code-block:: yaml @@ -99,7 +99,7 @@ Data Reader ^^^^^^^^^^^ As mentioned before, this section is entirely optional, as junifer only provides one data reader -(:class:`junifer.datareader.DefaultDataReader`), which is the default in case the section is not specified. +(:class:`.DefaultDataReader`), which is the default in case the section is not specified. In any case, the syntax of the section is the same as for the ``datagrabber`` section, using the ``kind`` key to specify the data reader to use, and additional keys to pass parameters to the data reader: @@ -119,7 +119,7 @@ Preprocessing is also an optional step, as it might be the case that no pre-proc preprocessing is needed, the section must be configured using the ``kind`` key to specify the preprocessor to use, and additional keys to pass parameters to the preprocessor. -For example, to use the :class:`junifer.preprocess.fMRIPrepConfoundRemover` preprocessor, we just need to specify its +For example, to use the :class:`.fMRIPrepConfoundRemover` preprocessor, we just need to specify its name as the ``kind`` key, as well as its parameters. @@ -173,7 +173,7 @@ Storage Finally, we need to define how and where the results will be stored. This is done using the ``storage`` section, which must be configured using the ``kind`` key to specify the storage to use, and additional keys to pass parameters. -For example, to use the :class:`junifer.storage.SQLiteFeatureStorage` storage, we just need to specify where we want +For example, to use the :class:`.SQLiteFeatureStorage` storage, we just need to specify where we want to store the results: .. code-block:: yaml -- 2.52.0 From 3c07d8dcb5a5b41d47edc3f0d58827220098a8c4 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:34:55 +0200 Subject: [PATCH 34/63] chore: improve sphinx ref for masks.rst --- docs/using/masks.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/using/masks.rst b/docs/using/masks.rst index dd09d1d42..fbaa64b6d 100644 --- a/docs/using/masks.rst +++ b/docs/using/masks.rst @@ -11,12 +11,12 @@ voxels that contain a certain ratio of gray matter to white matter / cerebrospin are not extracted from voxels that contain mostly white matter or cerebrospinal fluid, which could add noise to the BOLD signal. -Junifer provides a number of built-in masks, which can be listed using the :func:`junifer.data.masks.list_masks`. Some -masks are images, while other masks can be computed using :ref:`nilearn` functions. +Junifer provides a number of built-in masks, which can be listed using the :func:`.list_masks`. Some +masks are images, while other masks can be computed using :ref:`nilearn` functions. For markers and steps that accept ``masks`` as an argument, the mask can be specified as a string, which will be the -name of a built-in mask, or as a dictionary in which the **only** key is the built-in mask name and the value is a -dictionary of keyword arguments to pass to the mask function. +name of a built-in mask, or as a dictionary in which the **only** key is the built-in mask name and the value is a +dictionary of keyword arguments to pass to the mask function. For example, the following is a valid mask specification that specified the ``GM_prob0.2`` mask. @@ -29,7 +29,7 @@ with a threshold of 0.5. .. code-block:: yaml - masks: + masks: compute_brain_mask: threshold: 0.5 @@ -39,7 +39,7 @@ is a valid mask specification that specifies the intersection of the ``GM_prob0. .. code-block:: yaml - masks: + masks: - GM_prob0.2 - compute_brain_mask: threshold: 0.5 @@ -50,7 +50,7 @@ following example combines the same masks as the previous one, but computing the .. code-block:: yaml - masks: + masks: - GM_prob0.2 - compute_brain_mask: threshold: 0.5 @@ -60,9 +60,9 @@ Alternatively, we can also compute the union, even if the voxels do not form a c .. code-block:: yaml - masks: + masks: - GM_prob0.2 - compute_brain_mask: threshold: 0.5 - threshold: 0 # union - - connected: False # keep disconnected components \ No newline at end of file + - connected: False # keep disconnected components -- 2.52.0 From 66353705ce2c45ded8498ec9513b8a601615679f Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:35:09 +0200 Subject: [PATCH 35/63] chore: improve sphinx ref for running.rst --- docs/using/running.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/using/running.rst b/docs/using/running.rst index 9bd1cfad9..87257c741 100644 --- a/docs/using/running.rst +++ b/docs/using/running.rst @@ -14,7 +14,7 @@ individual results into a single file. Assuming that we have a configuration file named ``config.yaml``, the following commands will extract the features: -.. code-block:: console +.. code-block:: bash junifer run config.yaml @@ -22,20 +22,20 @@ The ``run`` command accepts the following additional arguments: * ``--help``: Show a help message. * ``--verbose`` Set the verbosity level. Options are ``warning``, ``info``, ``debug``. -* ``--element``: The *element* to run. If not specified, all elements will be run. This parameter can be specified +* ``--element``: The *element* to run. If not specified, all elements will be run. This parameter can be specified multiple times to run multiple elements. If the *element* requires several parameters, they can be specified by separating them with ``,``. Example on running two elements: -.. code-block:: console +.. code-block:: bash junifer run config.yaml --element sub-01 --element sub-02 Example on elements with multiple parameters and verbose output: -.. code-block:: console +.. code-block:: bash junifer run --verbose info config.yaml --element sub-01,ses-01 @@ -50,7 +50,7 @@ individual results into a single file. Assuming that we have a configuration file named ``config.yaml``, the following commands will collect the results: -.. code-block:: console +.. code-block:: bash junifer collect config.yaml -- 2.52.0 From 152e2761f697b0c36e77535f62d2d8bc2153d6b8 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:37:19 +0200 Subject: [PATCH 36/63] chore: improve sphinx ref for whats_new.rst --- docs/whats_new.rst | 104 ++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/docs/whats_new.rst b/docs/whats_new.rst index 4434cfc72..912a8d9b4 100644 --- a/docs/whats_new.rst +++ b/docs/whats_new.rst @@ -20,13 +20,12 @@ API Changes Bugfixes ^^^^^^^^ -- Fix a bug in which a :class:`junifer.datagrabber.PatternDataGrabber` would - now work with relative ``datadir`` paths (reported by `Leonard Sasse`_, - fixed by `Fede Raimondo`_) (:gh:`96`, :gh:`98`) +- Fix a bug in which a :class:`.PatternDataGrabber` would now work with + relative ``datadir`` paths (reported by `Leonard Sasse`_, fixed by + `Fede Raimondo`_) (:gh:`96`, :gh:`98`) -- Fix a bug in which :class:`junifer.datagrabber.DataladAOMICPIOP2` datagrabber - did not use user input to constrain elements based on tasks by - `Leonard Sasse`_ (:gh:`105`) +- Fix a bug in which :class:`.DataladAOMICPIOP2` datagrabber did not use user + input to constrain elements based on tasks by `Leonard Sasse`_ (:gh:`105`) - Fix a bug in which a datalad dataset could remove a user-cloned dataset by `Fede Raimondo`_ (:gh:`53`) @@ -53,9 +52,9 @@ Improved Documentation Enhancements ^^^^^^^^^^^^ -- Add comments to :class:`junifer.datagrabber.DataladDataGrabber` datagrabber - and change to use ``datalad-clone`` instead of ``datalad-install`` by - `Benjamin Poldrack`_ (:gh:`55`) +- Add comments to :class:`.DataladDataGrabber` datagrabber and change to use + ``datalad-clone`` instead of ``datalad-install`` by `Benjamin Poldrack`_ + (:gh:`55`) - Upgrade storage interface for storage-like objects by `Synchon Mandal`_ (:gh:`84`) @@ -65,65 +64,64 @@ Enhancements - Refactor markers ``on`` attribute and ``get_valid_inputs`` to verify that the marker can be computed on the input data types by `Fede Raimondo`_ -- Add test for :class:`junifer.datagrabber.DataladHCP1200` datagrabber by - `Synchon Mandal`_ (:gh:`93`) +- Add test for :class:`.DataladHCP1200` datagrabber by `Synchon Mandal`_ + (:gh:`93`) + +- Refactor :class:`.DataladAOMICID1000` slightly by `Leonard Sasse`_ (:gh:`94`) - Rename "atlas" to "parcellation" by `Fede Raimondo`_ (:gh:`116`) -- Refactor the :class:`junifer.datagrabber.BaseDataGrabber` class to allow for - easier subclassing by `Fede Raimondo`_ (:gh:`123`) +- Refactor the :class:`.BaseDataGrabber` class to allow for easier subclassing + by `Fede Raimondo`_ (:gh:`123`) -- Allow custom aggregation method for :class:`junifer.markers.SphereAggregation` - by `Synchon Mandal`_ (:gh:`102`) +- Allow custom aggregation method for :class:`.SphereAggregation` by + `Synchon Mandal`_ (:gh:`102`) - Add support for "masks" by `Fede Raimondo`_ (:gh:`79`) -- Allow :class:`junifer.markers.ParcelAggregation` to apply multiple - parcellations at once by `Fede Raimondo`_ (:gh:`131`) +- Allow :class:`.ParcelAggregation` to apply multiple parcellations at once by + `Fede Raimondo`_ (:gh:`131`) -- Refactor :class:`junifer.pipeline.PipelineStepMixin` to improve its - implementation and validation for pipeline steps by `Synchon Mandal`_ - (:gh:`152`) +- Refactor :class:`.PipelineStepMixin` to improve its implementation and + validation for pipeline steps by `Synchon Mandal`_ (:gh:`152`) Features ^^^^^^^^ -- Implement :class:`junifer.testing.datagrabbers.SPMAuditoryTestingDatagrabber` - datagrabber by `Fede Raimondo`_ (:gh:`52`) +- Implement :class:`.SPMAuditoryTestingDatagrabber` datagrabber by + `Fede Raimondo`_ (:gh:`52`) - Implement matrix storage in SQliteFeatureStorage by `Fede Raimondo`_ (:gh:`42`) -- Implement :class:`junifer.markers.FunctionalConnectivityParcels` marker for - functional connectivity using a parcellation by `Amir Omidvarnia`_ and +- Implement :class:`.FunctionalConnectivityParcels` marker for functional + connectivity using a parcellation by `Amir Omidvarnia`_ and `Kaustubh R. Patil`_ (:gh:`41`) -- Implement coordinate register, list and load by `Fede Raimondo`_ (:gh:`11`) +- Implement :func:`register_coordinates`, :func:`list_coordinates` and + :func:`load_coordinates` by `Fede Raimondo`_ (:gh:`11`) -- Add :class:`junifer.datagrabber.DataladAOMICID1000` datagrabber for AOMIC - ID1000 dataset including tests and creation of mock dataset for testing by +- Add :class:`.DataladAOMICID1000` datagrabber for AOMIC ID1000 dataset + including tests and creation of mock dataset for testing by `Vera Komeyer`_ and `Xuan Li`_ (:gh:`60`) - Add support to access other input in the data object in the ``compute`` method by `Fede Raimondo`_ -- Implement :class:`junifer.markers.RSSETSMarker` marker by `Leonard Sasse`_, - `Nicolas Nieto`_ and `Sami Hamdan`_ (:gh:`51`) +- Implement :class:`.RSSETSMarker` marker by `Leonard Sasse`_, `Nicolas Nieto`_ + and `Sami Hamdan`_ (:gh:`51`) -- Implement :class:`junifer.markers.SphereAggregation` marker by - `Fede Raimondo`_ +- Implement :class:`.SphereAggregation` marker by `Fede Raimondo`_ (:gh:`83`) -- Implement :class:`junifer.datagrabber.DataladAOMICPIOP1` and - :class:`junifer.datagrabber.DataladAOMICPIOP2` datagrabbers for AOMIC PIOP1 - and PIOP2 datasets respectively and refactor - :class:`junifer.datagrabber.DataladAOMICID1000` slightly by `Leonard Sasse`_ - (:gh:`94`) +- Implement :class:`.DataladAOMICPIOP1` and :class:`.DataladAOMICPIOP2` + datagrabbers for AOMIC PIOP1 and PIOP2 datasets respectively by + `Leonard Sasse`_ (:gh:`94`) -- Implement :class:`junifer.configs.juseless.datagrabbers.JuselessDataladCamCANVBM` - datagrabber by `Leonard Sasse`_ (:gh:`99`) +- Implement :class:`.JuselessDataladCamCANVBM` datagrabber by `Leonard Sasse`_ + (:gh:`99`) -- Implement :class:`junifer.configs.juseless.datagrabbers.JuselessDataladIXIVBM` - CAT output datagrabber for juseless by `Leonard Sasse`_ (:gh:`48`) +- Implement :class:`.JuselessDataladIXIVBM` CAT output datagrabber for juseless + by `Leonard Sasse`_ (:gh:`48`) - Add ``junifer wtf`` to report environment details by `Synchon Mandal`_ (:gh:`33`) @@ -131,27 +129,27 @@ Features - Add ``junifer selftest`` to report environment details by `Synchon Mandal`_ (:gh:`9`) -- Implement :class:`junifer.configs.juseless.datagrabbers.JuselessDataladAOMICID1000VBM` - datagrabber for accessing AOMIC ID1000 VBM from juseless by `Felix Hoffstaedter`_ - and `Synchon Mandal`_ (:gh:`57`) +- Implement :class:`.JuselessDataladAOMICID1000VBM` datagrabber for accessing + AOMIC ID1000 VBM from juseless by `Felix Hoffstaedter`_ and `Synchon Mandal`_ + (:gh:`57`) -- Add :class:`junifer.preprocess.fMRIPrepConfoundRemover` by `Fede Raimondo`_ - and `Leonard Sasse`_ (:gh:`111`) +- Add :class:`.fMRIPrepConfoundRemover` by `Fede Raimondo`_ and `Leonard Sasse`_ + (:gh:`111`) -- Implement :class:`junifer.markers.CrossParcellationFC` marker by - `Leonard Sasse`_ and `Kaustubh R. Patil`_ (:gh:`85`) +- Implement :class:`.CrossParcellationFC` marker by `Leonard Sasse`_ and + `Kaustubh R. Patil`_ (:gh:`85`) -- Add :class:`junifer.configs.juseless.datagrabbers.JuselessUCLA` datagrabber - for the UCLA dataset available on juseless by `Leonard Sasse`_ (:gh:`118`) +- Add :class:`.JuselessUCLA` datagrabber for the UCLA dataset available on + juseless by `Leonard Sasse`_ (:gh:`118`) - Introduce a singleton decorator for marker computations by `Synchon Mandal`_ (:gh:`151`) -- Implement :class:`junifer.markers.ReHoParcels` and - :class:`junifer.markers.ReHoSpheres` markers by `Synchon Mandal`_ (:gh:`36`) +- Implement :class:`.ReHoParcels` and :class:`.ReHoSpheres` markers by + `Synchon Mandal`_ (:gh:`36`) -- Implement :class:`junifer.markers.ALFFParcels` and - :class:`junifer.markers.ALFFSpheres` markers by `Fede Raimondo`_ (:gh:`35`) +- Implement :class:`.ALFFParcels` and :class:`.ALFFSpheres` markers by + `Fede Raimondo`_ (:gh:`35`) Misc ^^^^ -- 2.52.0 From 4e9bbd492c0c0bdde47bc841f53c29ddbea484c5 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:37:28 +0200 Subject: [PATCH 37/63] chore: improve sphinx ref for parcellations.py --- junifer/data/parcellations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junifer/data/parcellations.py b/junifer/data/parcellations.py index 490cf6408..88973dc55 100644 --- a/junifer/data/parcellations.py +++ b/junifer/data/parcellations.py @@ -167,7 +167,7 @@ def load_parcellation( ---------- name : str The name of the parcellation. Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. parcellations_dir : str or pathlib.Path, optional Path where the parcellations files are stored. The default location is "$HOME/junifer/data/parcellations" (default None). -- 2.52.0 From 95956b4a5b7f01046bdb2e8d955b170c5f31a51d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:37:42 +0200 Subject: [PATCH 38/63] chore: improve sphinx ref for ets_rss.py --- junifer/markers/ets_rss.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/ets_rss.py b/junifer/markers/ets_rss.py index bb4eeef5d..971d017a3 100644 --- a/junifer/markers/ets_rss.py +++ b/junifer/markers/ets_rss.py @@ -25,13 +25,13 @@ class RSSETSMarker(BaseMarker): ---------- parcellation : str or list of str The name(s) of the parcellation(s). Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. agg_method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). masks : str, dict or list of dict or str, optional The specification of the masks to apply to regions before extracting signals. Check :ref:`Using Masks ` for more details. -- 2.52.0 From 8ab059f52cd8f38c0940eba3fcd954ac40cbb032 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:37:52 +0200 Subject: [PATCH 39/63] chore: improve sphinx ref for falff_estimator.py --- junifer/markers/falff/falff_estimator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/falff/falff_estimator.py b/junifer/markers/falff/falff_estimator.py index e1070f1af..ef651d485 100644 --- a/junifer/markers/falff/falff_estimator.py +++ b/junifer/markers/falff/falff_estimator.py @@ -33,8 +33,8 @@ class ALFFEstimator: by caching the voxel-wise ALFF map for a given set of file path and computation parameters. - .. warning:: This class can only be used via - :class:`junifer.markers.falff.ALFFBase` as it serves a specific purpose. + .. warning:: This class can only be used via :class:`.ALFFBase` as it + serves a specific purpose. Parameters ---------- -- 2.52.0 From 3bc9bb62a136e07cd23f46e5ba61e2ba5c2c107d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:38:02 +0200 Subject: [PATCH 40/63] chore: improve sphinx ref for falff_parcels.py --- junifer/markers/falff/falff_parcels.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/falff/falff_parcels.py b/junifer/markers/falff/falff_parcels.py index 2e02e368d..1c8a73a7a 100644 --- a/junifer/markers/falff/falff_parcels.py +++ b/junifer/markers/falff/falff_parcels.py @@ -20,7 +20,7 @@ class ALFFParcels(ALFFBase): ---------- parcellation : str or list of str The name(s) of the parcellation(s). Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. fractional : bool Whether to compute fractional ALFF. highpass : positive float, optional @@ -40,10 +40,10 @@ class ALFFParcels(ALFFBase): If None, will not apply any mask (default None). method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name`. + :func:`.get_aggfunc_by_name`. name : str, optional The name of the marker. If None, will use the class name (default None). -- 2.52.0 From 8a112b0a979e985dc49af3c3fbe0f5d5762e1d3c Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:38:18 +0200 Subject: [PATCH 41/63] chore: improve sphinx ref for falff_spheres.py --- junifer/markers/falff/falff_spheres.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/falff/falff_spheres.py b/junifer/markers/falff/falff_spheres.py index 2d38a195d..51132ef03 100644 --- a/junifer/markers/falff/falff_spheres.py +++ b/junifer/markers/falff/falff_spheres.py @@ -20,7 +20,7 @@ class ALFFSpheres(ALFFBase): ---------- coords : str The name of the coordinates list to use. See - :func:`junifer.data.coordinates.list_coordinates` for options. + :func:`.list_coordinates` for options. radius : float, optional The radius of the sphere in mm. If None, the signal will be extracted from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker` @@ -47,10 +47,10 @@ class ALFFSpheres(ALFFBase): If None, will not apply any mask (default None). method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name`. + :func:`.get_aggfunc_by_name`. name : str, optional The name of the marker. If None, will use the class name (default None). -- 2.52.0 From c8ef44f869549700007e12eaf21ffa09021409e1 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:38:28 +0200 Subject: [PATCH 42/63] chore: improve sphinx ref for edge_functional_connectivity_parcels.py --- .../edge_functional_connectivity_parcels.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py b/junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py index 38f1d8425..5873a2b0f 100644 --- a/junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +++ b/junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py @@ -20,14 +20,14 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase): ---------- parcellation : str or list of str The name(s) of the parcellation(s). Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. agg_method : str, optional The method to perform aggregation of BOLD time series. - Check valid options in :func:`junifer.stats.get_aggfunc_by_name` + Check valid options in :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). cor_method : str, optional The method to perform correlation. Check valid options in :class:`nilearn.connectome.ConnectivityMeasure` -- 2.52.0 From 09d00c6efc05a281c5ce635a53bc0edfaea2bbc2 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:38:48 +0200 Subject: [PATCH 43/63] chore: improve sphinx ref for edge_functional_connectivity_spheres.py --- .../edge_functional_connectivity_spheres.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py b/junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py index 22aae75b2..60554752d 100644 --- a/junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +++ b/junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py @@ -20,7 +20,7 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase): ---------- coords : str The name of the coordinates list to use. See - :func:`junifer.data.coordinates.list_coordinates` for options. + :func:`.list_coordinates` for options. radius : float, optional The radius of the sphere in mm. If None, the signal will be extracted from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker` @@ -30,7 +30,7 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase): the spheres overlap (default is False). agg_method : str, optional The aggregation method to use. - See :func:`junifer.stats.get_aggfunc_by_name` for more information + See :func:`.get_aggfunc_by_name` for more information (default None). agg_method_params : dict, optional The parameters to pass to the aggregation method (default None). -- 2.52.0 From 0104fa81bb355ae5bffbeb77b34125b5d690550a Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:39:28 +0200 Subject: [PATCH 44/63] chore: improve sphinx ref for functional_connectivity_base.py --- .../functional_connectivity/functional_connectivity_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/functional_connectivity/functional_connectivity_base.py b/junifer/markers/functional_connectivity/functional_connectivity_base.py index 72f7ad135..d893baa3c 100644 --- a/junifer/markers/functional_connectivity/functional_connectivity_base.py +++ b/junifer/markers/functional_connectivity/functional_connectivity_base.py @@ -21,10 +21,10 @@ class FunctionalConnectivityBase(BaseMarker): ---------- agg_method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). cor_method : str, optional The method to perform correlation using. Check valid options in :class:`nilearn.connectome.ConnectivityMeasure` -- 2.52.0 From 70b707d56547dc354029cf6b0e8fe1b16525e8d6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:39:41 +0200 Subject: [PATCH 45/63] chore: improve sphinx ref for functional_connectivity_parcels.py --- .../functional_connectivity_parcels.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/functional_connectivity/functional_connectivity_parcels.py b/junifer/markers/functional_connectivity/functional_connectivity_parcels.py index b77927312..935af35da 100644 --- a/junifer/markers/functional_connectivity/functional_connectivity_parcels.py +++ b/junifer/markers/functional_connectivity/functional_connectivity_parcels.py @@ -20,13 +20,13 @@ class FunctionalConnectivityParcels(FunctionalConnectivityBase): ---------- parcellation : str or list of str The name(s) of the parcellation(s). Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. agg_method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). cor_method : str, optional The method to perform correlation using. Check valid options in :class:`nilearn.connectome.ConnectivityMeasure` -- 2.52.0 From 2c37466f6857576a36a76f27bfbb5a1b73cd79c0 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:39:54 +0200 Subject: [PATCH 46/63] chore: improve sphinx ref for functional_connectivity_spheres.py --- .../functional_connectivity_spheres.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/functional_connectivity/functional_connectivity_spheres.py b/junifer/markers/functional_connectivity/functional_connectivity_spheres.py index 517eb1820..8ad915926 100644 --- a/junifer/markers/functional_connectivity/functional_connectivity_spheres.py +++ b/junifer/markers/functional_connectivity/functional_connectivity_spheres.py @@ -21,7 +21,7 @@ class FunctionalConnectivitySpheres(FunctionalConnectivityBase): ---------- coords : str The name of the coordinates list to use. See - :func:`junifer.data.coordinates.list_coordinates` for options. + :func:`.list_coordinates` for options. radius : float, optional The radius of the sphere in mm. If None, the signal will be extracted from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker` @@ -31,7 +31,7 @@ class FunctionalConnectivitySpheres(FunctionalConnectivityBase): the spheres overlap (default is False). agg_method : str, optional The aggregation method to use. - See :func:`junifer.stats.get_aggfunc_by_name` for more information + See :func:`.get_aggfunc_by_name` for more information (default None). agg_method_params : dict, optional The parameters to pass to the aggregation method (default None). -- 2.52.0 From b53ba1ccba103583f4b28ca527dc507b18fde0d5 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:40:11 +0200 Subject: [PATCH 47/63] chore: improve sphinx ref for parcel_aggregation.py --- junifer/markers/parcel_aggregation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/parcel_aggregation.py b/junifer/markers/parcel_aggregation.py index 20d0a7257..3cd3cae65 100644 --- a/junifer/markers/parcel_aggregation.py +++ b/junifer/markers/parcel_aggregation.py @@ -25,13 +25,13 @@ class ParcelAggregation(BaseMarker): ---------- parcellation : str or list of str The name(s) of the parcellation(s). Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. method : str The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name`. + :func:`.get_aggfunc_by_name`. method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name`. + :func:`.get_aggfunc_by_name`. time_method : str, optional The method to use to aggregate the time series over the time points, after applying :term:`method` (only applicable to BOLD data). If None, -- 2.52.0 From 150d5996bc8ec6730f14355f63126416e4822535 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:40:20 +0200 Subject: [PATCH 48/63] chore: improve sphinx ref for reho_parcels.py --- junifer/markers/reho/reho_parcels.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/reho/reho_parcels.py b/junifer/markers/reho/reho_parcels.py index fdc0c5f0c..69dbb6bd0 100644 --- a/junifer/markers/reho/reho_parcels.py +++ b/junifer/markers/reho/reho_parcels.py @@ -22,7 +22,7 @@ class ReHoParcels(ReHoBase): ---------- parcellation : str The name of the parcellation. Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. use_afni : bool, optional Whether to use AFNI for computing. If None, will use AFNI only if available (default None). @@ -70,10 +70,10 @@ class ReHoParcels(ReHoBase): agg_method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). masks : str, dict or list of dict or str, optional The specification of the masks to apply to regions before extracting signals. Check :ref:`Using Masks ` for more details. -- 2.52.0 From 194bfd25a32f81078131fda44d45b7c06892cf76 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:40:29 +0200 Subject: [PATCH 49/63] chore: improve sphinx ref for reho_spheres.py --- junifer/markers/reho/reho_spheres.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/reho/reho_spheres.py b/junifer/markers/reho/reho_spheres.py index 4db4ed928..773db71c4 100644 --- a/junifer/markers/reho/reho_spheres.py +++ b/junifer/markers/reho/reho_spheres.py @@ -22,7 +22,7 @@ class ReHoSpheres(ReHoBase): ---------- coords : str The name of the coordinates list to use. See - :func:`junifer.data.coordinates.list_coordinates` for options. + :func:`.list_coordinates` for options. radius : float, optional The radius of the sphere in millimeters. If None, the signal will be extracted from a single voxel. See @@ -78,7 +78,7 @@ class ReHoSpheres(ReHoBase): agg_method : str, optional The aggregation method to use. - See :func:`junifer.stats.get_aggfunc_by_name` for more information + See :func:`.get_aggfunc_by_name` for more information (default None). agg_method_params : dict, optional The parameters to pass to the aggregation method (default None). -- 2.52.0 From 1c2b2813b3ea913194beb4b4d5907419c6f68fe1 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:40:38 +0200 Subject: [PATCH 50/63] chore: improve sphinx ref for sphere_aggregation.py --- junifer/markers/sphere_aggregation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/sphere_aggregation.py b/junifer/markers/sphere_aggregation.py index 1a30bccdb..8aad154ec 100644 --- a/junifer/markers/sphere_aggregation.py +++ b/junifer/markers/sphere_aggregation.py @@ -22,7 +22,7 @@ class SphereAggregation(BaseMarker): ---------- coords : str The name of the coordinates list to use. See - :func:`junifer.data.coordinates.list_coordinates` for options. + :func:`.list_coordinates` for options. radius : float, optional The radius of the sphere in millimeters. If None, the signal will be extracted from a single voxel. See @@ -33,7 +33,7 @@ class SphereAggregation(BaseMarker): the spheres overlap (default is False). method : str, optional The aggregation method to use. - See :func:`junifer.stats.get_aggfunc_by_name` for more information + See :func:`.get_aggfunc_by_name` for more information (default "mean"). method_params : dict, optional The parameters to pass to the aggregation method (default None). -- 2.52.0 From 9f8ed03e99fbcd1a7a2c3290d216f09dd7d7e6d0 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:40:45 +0200 Subject: [PATCH 51/63] chore: improve sphinx ref for temporal_snr_base.py --- junifer/markers/temporal_snr/temporal_snr_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/temporal_snr/temporal_snr_base.py b/junifer/markers/temporal_snr/temporal_snr_base.py index 7679c6c8e..3809d0fad 100644 --- a/junifer/markers/temporal_snr/temporal_snr_base.py +++ b/junifer/markers/temporal_snr/temporal_snr_base.py @@ -20,10 +20,10 @@ class TemporalSNRBase(BaseMarker): ---------- agg_method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). masks : str, dict or list of dict or str, optional The specification of the masks to apply to regions before extracting signals. Check :ref:`Using Masks ` for more details. -- 2.52.0 From 09cbfc32b10e18f96d55de7a090e413dd88de978 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:40:58 +0200 Subject: [PATCH 52/63] chore: improve sphinx ref for temporal_snr_parcels.py --- junifer/markers/temporal_snr/temporal_snr_parcels.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/markers/temporal_snr/temporal_snr_parcels.py b/junifer/markers/temporal_snr/temporal_snr_parcels.py index 0521527de..3c18ceccf 100644 --- a/junifer/markers/temporal_snr/temporal_snr_parcels.py +++ b/junifer/markers/temporal_snr/temporal_snr_parcels.py @@ -18,13 +18,13 @@ class TemporalSNRParcels(TemporalSNRBase): ---------- parcellation : str or list of str The name(s) of the parcellation(s). Check valid options by calling - :func:`junifer.data.parcellations.list_parcellations`. + :func:`.list_parcellations`. agg_method : str, optional The method to perform aggregation using. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default "mean"). + :func:`.get_aggfunc_by_name` (default "mean"). agg_method_params : dict, optional Parameters to pass to the aggregation function. Check valid options in - :func:`junifer.stats.get_aggfunc_by_name` (default None). + :func:`.get_aggfunc_by_name` (default None). masks : str, dict or list of dict or str, optional The specification of the masks to apply to regions before extracting signals. Check :ref:`Using Masks ` for more details. -- 2.52.0 From 152842a0dcf228ed41fef6084d24ce25489b9aa0 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:41:09 +0200 Subject: [PATCH 53/63] chore: improve sphinx ref for temporal_snr_spheres.py --- junifer/markers/temporal_snr/temporal_snr_spheres.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/temporal_snr/temporal_snr_spheres.py b/junifer/markers/temporal_snr/temporal_snr_spheres.py index 712a1b713..34ec1101a 100644 --- a/junifer/markers/temporal_snr/temporal_snr_spheres.py +++ b/junifer/markers/temporal_snr/temporal_snr_spheres.py @@ -19,7 +19,7 @@ class TemporalSNRSpheres(TemporalSNRBase): ---------- coords : str The name of the coordinates list to use. See - :func:`junifer.data.coordinates.list_coordinates` for options. + :func:`.list_coordinates` for options. radius : float, optional The radius of the sphere in mm. If None, the signal will be extracted from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker` @@ -29,7 +29,7 @@ class TemporalSNRSpheres(TemporalSNRBase): the spheres overlap (default is False). agg_method : str, optional The aggregation method to use. - See :func:`junifer.stats.get_aggfunc_by_name` for more information + See :func:`.get_aggfunc_by_name` for more information (default None). agg_method_params : dict, optional The parameters to pass to the aggregation method (default None). -- 2.52.0 From 566ba475d160dbf19fd5cb2972346b414d79de45 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:41:22 +0200 Subject: [PATCH 54/63] chore: improve sphinx ref for stats.py --- junifer/stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/stats.py b/junifer/stats.py index 06862335e..bf4b133e2 100644 --- a/junifer/stats.py +++ b/junifer/stats.py @@ -28,8 +28,8 @@ def get_aggfunc_by_name( * ``mean`` -> :func:`numpy.mean` * ``std`` -> :func:`numpy.std` * ``trim_mean`` -> :func:`scipy.stats.trim_mean` - * ``count`` -> :func:`junifer.stats.count` - * ``select`` -> :func:`junifer.stats.select` + * ``count`` -> :func:`.count` + * ``select`` -> :func:`.select` func_params : dict, optional Parameters to pass to the function. -- 2.52.0 From 14a6b9e9c9c448f8921d43aa20d5853683281682 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:41:28 +0200 Subject: [PATCH 55/63] chore: improve sphinx ref for base.py --- junifer/storage/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/storage/base.py b/junifer/storage/base.py index 04cdcb71f..506758c1a 100644 --- a/junifer/storage/base.py +++ b/junifer/storage/base.py @@ -95,8 +95,8 @@ class BaseFeatureStorage(ABC): ------- dict List of features in the storage. The keys are the feature MD5 to - be used in :meth:`junifer.storage.BaseFeatureStorage.read_df` - and the values are the metadata of each feature. + be used in :meth:`.read_df` and the values are the metadata of each + feature. """ raise_error( -- 2.52.0 From 4de2d3d2fdc01916b346d9c07e98d8be32991afa Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:41:34 +0200 Subject: [PATCH 56/63] chore: improve sphinx ref for hdf5.py --- junifer/storage/hdf5.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/junifer/storage/hdf5.py b/junifer/storage/hdf5.py index cce9a5fdf..d9d7aa81a 100644 --- a/junifer/storage/hdf5.py +++ b/junifer/storage/hdf5.py @@ -114,8 +114,8 @@ class HDF5FeatureStorage(BaseFeatureStorage): values are found (default True). chunk_size : int, optional The chunk size to use when collecting data from element files in - :meth:`junifer.storage.HDF5FeatureStorage.collect`. If the file count - is smaller than the value, the minimum is used (default 100). + :meth:`.collect`. If the file count is smaller than the value, the + minimum is used (default 100). See Also -------- @@ -262,8 +262,8 @@ class HDF5FeatureStorage(BaseFeatureStorage): ------- dict List of features in the storage. The keys are the feature MD5 to - be used in :meth:`junifer.storage.HDF5FeatureStorage.read_df` - and the values are the metadata of each feature. + be used in :meth:`.read_df` and the values are the metadata of each + feature. """ # Read metadata @@ -496,9 +496,7 @@ class HDF5FeatureStorage(BaseFeatureStorage): ) -> None: """Write processed data to HDF5 (should not be called directly). - This is used primarily in - :func:`junifer.storage.HDF5FeatureStorage.store_metadata` and - ``_store_data``. + This is used primarily in :meth:`.store_metadata` and ``_store_data``. Parameters ---------- -- 2.52.0 From a8cd9c29a61f7c6c283e52503358c56d43fffd1c Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:41:40 +0200 Subject: [PATCH 57/63] chore: improve sphinx ref for sqlite.py --- junifer/storage/sqlite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/storage/sqlite.py b/junifer/storage/sqlite.py index e511c9e49..5621e8e69 100644 --- a/junifer/storage/sqlite.py +++ b/junifer/storage/sqlite.py @@ -213,8 +213,8 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage): ------- dict List of features in the storage. The keys are the feature MD5 to - be used in :meth:`junifer.storage.SQLiteFeatureStorage.read_df` - and the values are the metadata of each feature. + be used in :meth:`.read_df` and the values are the metadata of each + feature. """ # Retrieve meta table from storage -- 2.52.0 From 2f760ad12375b2bdf68a8de9587007e6d65fd912 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:42:25 +0200 Subject: [PATCH 58/63] chore: black --- junifer/api/functions.py | 5 +++-- junifer/markers/tests/test_markers_base.py | 2 +- junifer/pipeline/registry.py | 5 +---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/junifer/api/functions.py b/junifer/api/functions.py index 725a2636f..6c1a2a7cc 100644 --- a/junifer/api/functions.py +++ b/junifer/api/functions.py @@ -515,10 +515,11 @@ def _queue_condor( collect_pre_fname = jobdir / "collect_pre.sh" dag_file.write( f"SCRIPT PRE collect {collect_pre_fname.as_posix()} " - "$DAG_STATUS\n") + "$DAG_STATUS\n" + ) with open(collect_pre_fname, "w") as pre_file: pre_file.write("#!/bin/bash\n\n") - pre_file.write("if [ \"${1}\" == \"4\" ]; then\n") + pre_file.write('if [ "${1}" == "4" ]; then\n') pre_file.write(" exit 1\n") pre_file.write("fi\n") diff --git a/junifer/markers/tests/test_markers_base.py b/junifer/markers/tests/test_markers_base.py index 59dbefbd4..ff2d7771c 100644 --- a/junifer/markers/tests/test_markers_base.py +++ b/junifer/markers/tests/test_markers_base.py @@ -99,7 +99,7 @@ def test_base_marker_subclassing() -> None: "element": "elem", "datareader": "dr", }, - } + }, } marker = MyBaseMarker(on=["BOLD"]) output = marker.fit_transform(input=input_) # process diff --git a/junifer/pipeline/registry.py b/junifer/pipeline/registry.py index f0f384ef3..4d482ec69 100644 --- a/junifer/pipeline/registry.py +++ b/junifer/pipeline/registry.py @@ -141,10 +141,7 @@ def build( object_ = klass(**init_params) except Exception as e: raise_error( - msg=( - f"Failed to create {step} ({name}). " - f"Error: {e}" - ), + msg=(f"Failed to create {step} ({name}). " f"Error: {e}"), klass=RuntimeError, exception=e, ) -- 2.52.0 From b76c9156ec9bf212916715a1d96252f753dc21d4 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:44:55 +0200 Subject: [PATCH 59/63] chore: add black badge in README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 43150b113..6c5f218fd 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ ![PyPI - Wheel](https://img.shields.io/pypi/wheel/junifer?style=flat-square) ![GitHub](https://img.shields.io/github/license/juaml/junifer?style=flat-square) ![Codecov](https://img.shields.io/codecov/c/github/juaml/junifer?style=flat-square) +![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) ## About -- 2.52.0 From b2d4baa9065758b493f90771b3fbea782b2d8a66 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:48:48 +0200 Subject: [PATCH 60/63] fix: correct sphinx ref in whats_new.rst --- docs/whats_new.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/whats_new.rst b/docs/whats_new.rst index 912a8d9b4..0d1e8c262 100644 --- a/docs/whats_new.rst +++ b/docs/whats_new.rst @@ -98,8 +98,8 @@ Features connectivity using a parcellation by `Amir Omidvarnia`_ and `Kaustubh R. Patil`_ (:gh:`41`) -- Implement :func:`register_coordinates`, :func:`list_coordinates` and - :func:`load_coordinates` by `Fede Raimondo`_ (:gh:`11`) +- Implement :func:`.register_coordinates`, :func:`.list_coordinates` and + :func:`.load_coordinates` by `Fede Raimondo`_ (:gh:`11`) - Add :class:`.DataladAOMICID1000` datagrabber for AOMIC ID1000 dataset including tests and creation of mock dataset for testing by -- 2.52.0 From 77fe7bdfe14b0ad9ae88bb076b0cacaabb06fc93 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 13:52:33 +0200 Subject: [PATCH 61/63] chore: add changelog 218.doc --- docs/changes/newsfragments/218.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/218.doc diff --git a/docs/changes/newsfragments/218.doc b/docs/changes/newsfragments/218.doc new file mode 100644 index 000000000..62f6da514 --- /dev/null +++ b/docs/changes/newsfragments/218.doc @@ -0,0 +1 @@ +Shorten Sphinx references across code and docs, and add ``black`` shield in README by `Synchon Mandal`_ \ No newline at end of file -- 2.52.0 From e29ea7fb050fcbe7b70c5585d5f6205b3e32d50d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 14:17:35 +0200 Subject: [PATCH 62/63] fix: correct link for black badge in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c5f218fd..4498fcc22 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ![PyPI - Wheel](https://img.shields.io/pypi/wheel/junifer?style=flat-square) ![GitHub](https://img.shields.io/github/license/juaml/junifer?style=flat-square) ![Codecov](https://img.shields.io/codecov/c/github/juaml/junifer?style=flat-square) -![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) ## About -- 2.52.0 From 1c3b323fc222e19960b69157faa357a5629dd7b6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 31 Mar 2023 14:22:57 +0200 Subject: [PATCH 63/63] chore: fix remaining sphinx ref in datagrabber.rst --- docs/extending/datagrabber.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/extending/datagrabber.rst b/docs/extending/datagrabber.rst index 096b725ce..e7e8b714c 100644 --- a/docs/extending/datagrabber.rst +++ b/docs/extending/datagrabber.rst @@ -195,9 +195,8 @@ set the ``datadir``. Optional: Using datalad """"""""""""""""""""""" -If you are using `datalad`_, you can use the -:py:class:`~junifer.datagrabber.PatternDataladDataGrabber` instead of the -:py:class:`~junifer.datagrabber.PatternDataGrabber`. This class will not only +If you are using `datalad`_, you can use the :class:`.PatternDataladDataGrabber` +instead of the :class:`.PatternDataGrabber`. This class will not only interpret patterns, but also use `datalad`_ to `clone` and `get` the data. The main difference between the two is that the ``datadir`` is not the actual -- 2.52.0