[ENH]: Consistent DataGrabber naming in testing #222

Merged
synchon merged 11 commits from refactor/consistent-dg-naming into main 2023-05-05 10:46:11 +00:00
25 changed files with 80 additions and 72 deletions

View file

@ -0,0 +1 @@
Rename ``junifer.testing.datagrabbers.SPMAuditoryTestingDatagrabber`` to :class:`.SPMAuditoryTestingDataGrabber` and ``junifer.testing.datagrabbers.OasisVBMTestingDatagrabber`` to :class:`.OasisVBMTestingDataGrabber` by `Synchon Mandal`_

View file

@ -0,0 +1 @@
Rename instances of "Datagrabber" to "DataGrabber" especially in ``junifer.testing`` to be consistent by `Synchon Mandal`_

View file

@ -26,12 +26,12 @@ step only contains information about the datagrabber used.
.. code-block:: python .. code-block:: python
{'BOLD': {'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDatagrabber', {'BOLD': {'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDataGrabber',
'types': ['BOLD', 'T1w']}, 'types': ['BOLD', 'T1w']},
'dependencies': set(), 'dependencies': set(),
'element': {'subject': 'sub001'}}, 'element': {'subject': 'sub001'}},
'path': PosixPath('/var/folders/dv/2lbr8f8j0q12zrx3mz3ll5m40000gp/T/tmpgxcyjfo1/sub001_bold.nii.gz')}, 'path': PosixPath('/var/folders/dv/2lbr8f8j0q12zrx3mz3ll5m40000gp/T/tmpgxcyjfo1/sub001_bold.nii.gz')},
'T1w': {'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDatagrabber', 'T1w': {'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDataGrabber',
'types': ['BOLD', 'T1w']}, 'types': ['BOLD', 'T1w']},
'dependencies': set(), 'dependencies': set(),
'element': {'subject': 'sub001'}}, 'element': {'subject': 'sub001'}},
@ -44,14 +44,14 @@ adds information about the datareader used to read the data.
.. code-block:: python .. code-block:: python
{'BOLD': {'data': <nibabel.nifti1.Nifti1Image object at 0x16b5d8910>, {'BOLD': {'data': <nibabel.nifti1.Nifti1Image object at 0x16b5d8910>,
'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDatagrabber', 'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDataGrabber',
'types': ['BOLD', 'T1w']}, 'types': ['BOLD', 'T1w']},
'datareader': {'class': 'DefaultDataReader'}, 'datareader': {'class': 'DefaultDataReader'},
'dependencies': {'nilearn'}, 'dependencies': {'nilearn'},
'element': {'subject': 'sub001'}}, 'element': {'subject': 'sub001'}},
'path': PosixPath('/var/folders/dv/2lbr8f8j0q12zrx3mz3ll5m40000gp/T/tmpe49321ce/sub001_bold.nii.gz')}, 'path': PosixPath('/var/folders/dv/2lbr8f8j0q12zrx3mz3ll5m40000gp/T/tmpe49321ce/sub001_bold.nii.gz')},
'T1w': {'data': <nibabel.nifti1.Nifti1Image object at 0x16b5d78d0>, 'T1w': {'data': <nibabel.nifti1.Nifti1Image object at 0x16b5d78d0>,
'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDatagrabber', 'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDataGrabber',
'types': ['BOLD', 'T1w']}, 'types': ['BOLD', 'T1w']},
'datareader': {'class': 'DefaultDataReader'}, 'datareader': {'class': 'DefaultDataReader'},
'dependencies': set(), 'dependencies': set(),
@ -70,7 +70,7 @@ and adds further keys needed for the storage, for example, ``col_names``.
{'BOLD': {'col_names': ['root_sum_of_squares_ets'], {'BOLD': {'col_names': ['root_sum_of_squares_ets'],
'data': ..., 'data': ...,
'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDatagrabber', 'meta': {'datagrabber': {'class': 'SPMAuditoryTestingDataGrabber',
'types': ['BOLD', 'T1w']}, 'types': ['BOLD', 'T1w']},
'datareader': {'class': 'DefaultDataReader'}, 'datareader': {'class': 'DefaultDataReader'},
'dependencies': {'nilearn'}, 'dependencies': {'nilearn'},

View file

@ -100,7 +100,7 @@ In the ``Oasis VBM Testing dataset`` example, the section will look like this:
.. code-block:: yaml .. code-block:: yaml
datagrabber: datagrabber:
kind: OasisVBMTestingDatagrabber kind: OasisVBMTestingDataGrabber
Data Reader Data Reader
@ -212,7 +212,7 @@ looks like:
workdir: /tmp workdir: /tmp
datagrabber: datagrabber:
kind: OasisVBMTestingDatagrabber kind: OasisVBMTestingDataGrabber
markers: markers:
- name: Schaefer100x7_mean - name: Schaefer100x7_mean

View file

@ -220,7 +220,7 @@ Enhancements
Features Features
^^^^^^^^ ^^^^^^^^
- Implement :class:`.SPMAuditoryTestingDatagrabber` datagrabber by - Implement :class:`.SPMAuditoryTestingDataGrabber` datagrabber by
`Fede Raimondo`_ (:gh:`52`) `Fede Raimondo`_ (:gh:`52`)
- Implement matrix storage in SQliteFeatureStorage by `Fede Raimondo`_ - Implement matrix storage in SQliteFeatureStorage by `Fede Raimondo`_

View file

@ -27,7 +27,7 @@ configure_logging(level="INFO")
############################################################################## ##############################################################################
# Define the datagrabber interface # Define the datagrabber interface
datagrabber = { datagrabber = {
"kind": "SPMAuditoryTestingDatagrabber", "kind": "SPMAuditoryTestingDataGrabber",
} }
############################################################################### ###############################################################################

View file

@ -75,7 +75,7 @@ with tempfile.TemporaryDirectory() as tmpdir:
# run the defined junifer feature extraction pipeline # run the defined junifer feature extraction pipeline
run( run(
workdir="/tmp", workdir="/tmp",
datagrabber={"kind": "OasisVBMTestingDatagrabber"}, datagrabber={"kind": "OasisVBMTestingDataGrabber"},
markers=marker_dicts, markers=marker_dicts,
storage=storage, storage=storage,
) )

View file

@ -13,7 +13,7 @@ from junifer.api import run
datagrabber = { datagrabber = {
"kind": "OasisVBMTestingDatagrabber", "kind": "OasisVBMTestingDataGrabber",
} }
markers = [ markers = [

View file

@ -2,7 +2,7 @@ with: junifer.testing.registry
workdir: /tmp workdir: /tmp
datagrabber: datagrabber:
kind: OasisVBMTestingDatagrabber kind: OasisVBMTestingDataGrabber
elements: elements:
markers: markers:
- name: Schaefer1000x7_TrimMean80 - name: Schaefer1000x7_TrimMean80
@ -22,4 +22,3 @@ markers:
storage: storage:
kind: SQLiteFeatureStorage kind: SQLiteFeatureStorage
uri: /Users/fraimondo/dev/tbox/junifer/scratch/db/test.sqlite uri: /Users/fraimondo/dev/tbox/junifer/scratch/db/test.sqlite

View file

@ -2,7 +2,7 @@ with: junifer.testing.registry
workdir: /tmp workdir: /tmp
datagrabber: datagrabber:
kind: OasisVBMTestingDatagrabber kind: OasisVBMTestingDataGrabber
markers: markers:
- name: Schaefer1000x7_Mean - name: Schaefer1000x7_Mean
kind: ParcelAggregation kind: ParcelAggregation

View file

@ -2,7 +2,7 @@ with: junifer.testing.registry
workdir: /tmp workdir: /tmp
datagrabber: datagrabber:
kind: OasisVBMTestingDatagrabber kind: OasisVBMTestingDataGrabber
elements: [1, 2] elements: [1, 2]
markers: markers:
- name: Schaefer1000x7_Mean - name: Schaefer1000x7_Mean
@ -12,4 +12,3 @@ markers:
storage: storage:
kind: SQLiteFeatureStorage kind: SQLiteFeatureStorage
uri: /Users/fraimondo/dev/tbox/junifer/scratch/db/test.sqlite uri: /Users/fraimondo/dev/tbox/junifer/scratch/db/test.sqlite

View file

@ -2,7 +2,7 @@ with: junifer.testing.registry
workdir: /tmp workdir: /tmp
datagrabber: datagrabber:
kind: OasisVBMTestingDatagrabber kind: OasisVBMTestingDataGrabber
markers: markers:
- name: Schaefer1000x7_Mean - name: Schaefer1000x7_Mean
kind: ParcelAggregation kind: ParcelAggregation

View file

@ -21,7 +21,7 @@ from junifer.pipeline.registry import build
# Define datagrabber # Define datagrabber
datagrabber = { datagrabber = {
"kind": "OasisVBMTestingDatagrabber", "kind": "OasisVBMTestingDataGrabber",
} }
# Define markers # Define markers

View file

@ -30,8 +30,8 @@ from junifer.data.masks import (
) )
from junifer.datareader import DefaultDataReader from junifer.datareader import DefaultDataReader
from junifer.testing.datagrabbers import ( from junifer.testing.datagrabbers import (
OasisVBMTestingDatagrabber, OasisVBMTestingDataGrabber,
SPMAuditoryTestingDatagrabber, SPMAuditoryTestingDataGrabber,
) )
@ -181,7 +181,7 @@ def test_vickery_patil() -> None:
def test_get_mask() -> None: def test_get_mask() -> None:
"""Test the get_mask function.""" """Test the get_mask function."""
reader = DefaultDataReader() reader = DefaultDataReader()
with OasisVBMTestingDatagrabber() as dg: with OasisVBMTestingDataGrabber() as dg:
input = dg["sub-01"] input = dg["sub-01"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
vbm_gm = input["VBM_GM"] vbm_gm = input["VBM_GM"]
@ -209,7 +209,7 @@ def test_mask_callable() -> None:
_available_masks["identity"] = {"family": "Callable", "func": ident} _available_masks["identity"] = {"family": "Callable", "func": ident}
reader = DefaultDataReader() reader = DefaultDataReader()
with OasisVBMTestingDatagrabber() as dg: with OasisVBMTestingDataGrabber() as dg:
input = dg["sub-01"] input = dg["sub-01"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
vbm_gm = input["VBM_GM"] vbm_gm = input["VBM_GM"]
@ -224,7 +224,7 @@ def test_mask_callable() -> None:
def test_get_mask_errors() -> None: def test_get_mask_errors() -> None:
"""Test passing wrong parameters to get_mask.""" """Test passing wrong parameters to get_mask."""
reader = DefaultDataReader() reader = DefaultDataReader()
with OasisVBMTestingDatagrabber() as dg: with OasisVBMTestingDataGrabber() as dg:
input = dg["sub-01"] input = dg["sub-01"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
vbm_gm = input["VBM_GM"] vbm_gm = input["VBM_GM"]
@ -306,7 +306,7 @@ def test_nilearn_compute_masks(
Whether to resample the mask to the target data. Whether to resample the mask to the target data.
""" """
reader = DefaultDataReader() reader = DefaultDataReader()
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
input = dg["sub001"] input = dg["sub001"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
bold = input["BOLD"] bold = input["BOLD"]
@ -339,7 +339,7 @@ def test_nilearn_compute_masks(
def test_get_mask_inherit() -> None: def test_get_mask_inherit() -> None:
"""Test using the inherit mask functionality.""" """Test using the inherit mask functionality."""
reader = DefaultDataReader() reader = DefaultDataReader()
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
input = dg["sub001"] input = dg["sub001"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
# Compute brain mask using nilearn # Compute brain mask using nilearn
@ -394,7 +394,7 @@ def test_get_mask_multiple(
Parameters to pass to the intersect_masks function. Parameters to pass to the intersect_masks function.
""" """
reader = DefaultDataReader() reader = DefaultDataReader()
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
input = dg["sub001"] input = dg["sub001"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
if not isinstance(masks, list): if not isinstance(masks, list):

View file

@ -11,7 +11,7 @@ from nilearn import image
from junifer.markers.functional_connectivity import CrossParcellationFC from junifer.markers.functional_connectivity import CrossParcellationFC
from junifer.storage import SQLiteFeatureStorage from junifer.storage import SQLiteFeatureStorage
from junifer.testing.datagrabbers import SPMAuditoryTestingDatagrabber from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
parcellation_ONE = "Schaefer100x17" parcellation_ONE = "Schaefer100x17"
@ -21,7 +21,7 @@ parcellation_TWO = "Schaefer200x17"
def test_compute() -> None: def test_compute() -> None:
"""Test CrossParcellationFC compute().""" """Test CrossParcellationFC compute()."""
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
out = dg["sub001"] out = dg["sub001"]
niimg = image.load_img(str(out["BOLD"]["path"].absolute())) niimg = image.load_img(str(out["BOLD"]["path"].absolute()))
input_dict = { input_dict = {
@ -53,7 +53,7 @@ def test_store(tmp_path: Path) -> None:
""" """
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
input_dict = dg["sub001"] input_dict = dg["sub001"]
niimg = image.load_img(str(input_dict["BOLD"]["path"].absolute())) niimg = image.load_img(str(input_dict["BOLD"]["path"].absolute()))

View file

@ -12,7 +12,7 @@ from scipy.stats import pearsonr
from junifer.markers.reho.reho_parcels import ReHoParcels from junifer.markers.reho.reho_parcels import ReHoParcels
from junifer.pipeline.utils import _check_afni from junifer.pipeline.utils import _check_afni
from junifer.storage.sqlite import SQLiteFeatureStorage from junifer.storage.sqlite import SQLiteFeatureStorage
from junifer.testing.datagrabbers import SPMAuditoryTestingDatagrabber from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
PARCELLATION = "Schaefer100x7" PARCELLATION = "Schaefer100x7"
@ -20,7 +20,7 @@ PARCELLATION = "Schaefer100x7"
def test_reho_parcels_computation() -> None: def test_reho_parcels_computation() -> None:
"""Test ReHoParcels fit-transform.""" """Test ReHoParcels fit-transform."""
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Use first subject # Use first subject
subject_data = dg["sub001"] subject_data = dg["sub001"]
# Load image to memory # Load image to memory
@ -51,7 +51,7 @@ def test_reho_parcels_computation() -> None:
) )
def test_reho_parcels_computation_comparison() -> None: def test_reho_parcels_computation_comparison() -> None:
"""Test ReHoParcels fit-transform implementation comparison..""" """Test ReHoParcels fit-transform implementation comparison.."""
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Use first subject # Use first subject
subject_data = dg["sub001"] subject_data = dg["sub001"]
# Load image to memory # Load image to memory
@ -96,7 +96,7 @@ def test_reho_parcels_storage(tmp_path: Path) -> None:
The path to the test directory. The path to the test directory.
""" """
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Use first subject # Use first subject
subject_data = dg["sub001"] subject_data = dg["sub001"]
# Load image to memory # Load image to memory

View file

@ -12,7 +12,7 @@ from scipy.stats import pearsonr
from junifer.markers.reho.reho_spheres import ReHoSpheres from junifer.markers.reho.reho_spheres import ReHoSpheres
from junifer.pipeline.utils import _check_afni from junifer.pipeline.utils import _check_afni
from junifer.storage.sqlite import SQLiteFeatureStorage from junifer.storage.sqlite import SQLiteFeatureStorage
from junifer.testing.datagrabbers import SPMAuditoryTestingDatagrabber from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
COORDINATES = "DMNBuckner" COORDINATES = "DMNBuckner"
@ -20,7 +20,7 @@ COORDINATES = "DMNBuckner"
def test_reho_spheres_computation() -> None: def test_reho_spheres_computation() -> None:
"""Test ReHoSpheres fit-transform.""" """Test ReHoSpheres fit-transform."""
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Use first subject # Use first subject
subject_data = dg["sub001"] subject_data = dg["sub001"]
# Load image to memory # Load image to memory
@ -51,7 +51,7 @@ def test_reho_spheres_computation() -> None:
) )
def test_reho_spheres_computation_comparison() -> None: def test_reho_spheres_computation_comparison() -> None:
"""Test ReHoSpheres fit-transform implementation comparison..""" """Test ReHoSpheres fit-transform implementation comparison.."""
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Use first subject # Use first subject
subject_data = dg["sub001"] subject_data = dg["sub001"]
# Load image to memory # Load image to memory
@ -96,7 +96,7 @@ def test_reho_spheres_storage(tmp_path: Path) -> None:
The path to the test directory. The path to the test directory.
""" """
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Use first subject # Use first subject
subject_data = dg["sub001"] subject_data = dg["sub001"]
# Load image to memory # Load image to memory

View file

@ -19,7 +19,7 @@ from junifer.pipeline import PipelineStepMixin
from junifer.preprocess import fMRIPrepConfoundRemover from junifer.preprocess import fMRIPrepConfoundRemover
from junifer.storage import SQLiteFeatureStorage from junifer.storage import SQLiteFeatureStorage
from junifer.testing.datagrabbers import ( from junifer.testing.datagrabbers import (
OasisVBMTestingDatagrabber, OasisVBMTestingDataGrabber,
PartlyCloudyTestingDataGrabber, PartlyCloudyTestingDataGrabber,
) )
@ -69,7 +69,7 @@ def test_marker_collection() -> None:
assert isinstance(mc._datareader, DefaultDataReader) assert isinstance(mc._datareader, DefaultDataReader)
# Create testing datagrabber # Create testing datagrabber
dg = OasisVBMTestingDatagrabber() dg = OasisVBMTestingDataGrabber()
mc.validate(dg) mc.validate(dg)
with dg: with dg:
@ -168,7 +168,7 @@ def test_marker_collection_storage(tmp_path: Path) -> None:
), ),
] ]
# Test storage # Test storage
dg = OasisVBMTestingDatagrabber() dg = OasisVBMTestingDataGrabber()
uri = tmp_path / "test_marker_collection_storage.sqlite" uri = tmp_path / "test_marker_collection_storage.sqlite"
storage = SQLiteFeatureStorage(uri=uri) storage = SQLiteFeatureStorage(uri=uri)

View file

@ -14,7 +14,7 @@ from nilearn.maskers import NiftiLabelsMasker
from junifer.data import load_parcellation from junifer.data import load_parcellation
from junifer.markers.ets_rss import RSSETSMarker from junifer.markers.ets_rss import RSSETSMarker
from junifer.storage import SQLiteFeatureStorage from junifer.storage import SQLiteFeatureStorage
from junifer.testing.datagrabbers import SPMAuditoryTestingDatagrabber from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
# Set parcellation # Set parcellation
@ -23,7 +23,7 @@ PARCELLATION = "Schaefer100x17"
def test_compute() -> None: def test_compute() -> None:
"""Test RSS ETS compute().""" """Test RSS ETS compute()."""
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Fetch element # Fetch element
out = dg["sub001"] out = dg["sub001"]
# Load BOLD image # Load BOLD image
@ -61,7 +61,7 @@ def test_store(tmp_path: Path) -> None:
The path to the test directory. The path to the test directory.
""" """
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
# Fetch element # Fetch element
elem = dg["sub001"] elem = dg["sub001"]
# Load BOLD image # Load BOLD image

View file

@ -19,7 +19,7 @@ from junifer.datareader import DefaultDataReader
from junifer.preprocess.confounds import fMRIPrepConfoundRemover from junifer.preprocess.confounds import fMRIPrepConfoundRemover
from junifer.testing import get_testing_data from junifer.testing import get_testing_data
from junifer.testing.datagrabbers import ( from junifer.testing.datagrabbers import (
OasisVBMTestingDatagrabber, OasisVBMTestingDataGrabber,
PartlyCloudyTestingDataGrabber, PartlyCloudyTestingDataGrabber,
) )
@ -327,7 +327,7 @@ def test_fMRIPrepConfoundRemover__validate_data() -> None:
"""Test fMRIPrepConfoundRemover validate data.""" """Test fMRIPrepConfoundRemover validate data."""
confound_remover = fMRIPrepConfoundRemover(strategy={"wm_csf": "full"}) confound_remover = fMRIPrepConfoundRemover(strategy={"wm_csf": "full"})
reader = DefaultDataReader() reader = DefaultDataReader()
with OasisVBMTestingDatagrabber() as dg: with OasisVBMTestingDataGrabber() as dg:
input = dg["sub-01"] input = dg["sub-01"]
input = reader.fit_transform(input) input = reader.fit_transform(input)
new_input = input["VBM_GM"] new_input = input["VBM_GM"]

View file

@ -14,8 +14,12 @@ from nilearn import datasets, image
from ..datagrabber.base import BaseDataGrabber from ..datagrabber.base import BaseDataGrabber
class OasisVBMTestingDatagrabber(BaseDataGrabber): class OasisVBMTestingDataGrabber(BaseDataGrabber):
"""Data Grabber for Oasis VBM testing data.""" """Data Grabber for Oasis VBM testing data.
Wrapper for :func:`nilearn.datasets.fetch_oasis_vbm`
LeSasse commented 2023-05-04 08:09:15 +00:00 (Migrated from github.com)

Should there be a whitespace here in the docstring i.e. Data Grabber or DataGrabber?

Should there be a whitespace here in the docstring i.e. `Data Grabber` or `DataGrabber`?
synchon commented 2023-05-04 09:40:03 +00:00 (Migrated from github.com)

For consistency in code, maybe it's better to remove the whitespace.

For consistency in code, maybe it's better to remove the whitespace.
"""
def __init__(self) -> None: def __init__(self) -> None:
# Create temporary directory # Create temporary directory
@ -55,12 +59,12 @@ class OasisVBMTestingDatagrabber(BaseDataGrabber):
return out return out
def __enter__(self) -> "OasisVBMTestingDatagrabber": def __enter__(self) -> "OasisVBMTestingDataGrabber":
"""Implement context entry. """Implement context entry.
Returns Returns
------- -------
OasisVBMTestingDatagrabber OasisVBMTestingDataGrabber
""" """
self._dataset = datasets.fetch_oasis_vbm(n_subjects=10) self._dataset = datasets.fetch_oasis_vbm(n_subjects=10)
@ -78,7 +82,7 @@ class OasisVBMTestingDatagrabber(BaseDataGrabber):
return [f"sub-{x:02d}" for x in list(range(1, 11))] return [f"sub-{x:02d}" for x in list(range(1, 11))]
class SPMAuditoryTestingDatagrabber(BaseDataGrabber): class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
"""Data Grabber for SPM Auditory dataset. """Data Grabber for SPM Auditory dataset.
Wrapper for :func:`nilearn.datasets.fetch_spm_auditory`. Wrapper for :func:`nilearn.datasets.fetch_spm_auditory`.

View file

@ -6,23 +6,23 @@
from ..pipeline.registry import register from ..pipeline.registry import register
from .datagrabbers import ( from .datagrabbers import (
OasisVBMTestingDatagrabber, OasisVBMTestingDataGrabber,
PartlyCloudyTestingDataGrabber, PartlyCloudyTestingDataGrabber,
SPMAuditoryTestingDatagrabber, SPMAuditoryTestingDataGrabber,
) )
# Register testing datagrabber # Register testing datagrabber
register( register(
step="datagrabber", step="datagrabber",
name="OasisVBMTestingDatagrabber", name="OasisVBMTestingDataGrabber",
klass=OasisVBMTestingDatagrabber, klass=OasisVBMTestingDataGrabber,
) )
register( register(
step="datagrabber", step="datagrabber",
name="SPMAuditoryTestingDatagrabber", name="SPMAuditoryTestingDataGrabber",
klass=SPMAuditoryTestingDatagrabber, klass=SPMAuditoryTestingDataGrabber,
) )
register( register(

View file

@ -3,10 +3,10 @@
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de> # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# License: AGPL # License: AGPL
from junifer.testing.datagrabbers import OasisVBMTestingDatagrabber from junifer.testing.datagrabbers import OasisVBMTestingDataGrabber
def test_OasisVBMTestingDatagrabber() -> None: def test_OasisVBMTestingDataGrabber() -> None:
"""Test Oasis VBM Testing datagrabber.""" """Test Oasis VBM Testing datagrabber."""
expected_elements = [ expected_elements = [
"sub-01", "sub-01",
LeSasse commented 2023-05-04 08:10:22 +00:00 (Migrated from github.com)

Should it be DataGrabber in the docstring here?

Should it be `DataGrabber` in the docstring here?
synchon commented 2023-05-04 09:40:33 +00:00 (Migrated from github.com)

I see your point, I'll update the docstrings.

I see your point, I'll update the docstrings.
@ -20,7 +20,7 @@ def test_OasisVBMTestingDatagrabber() -> None:
"sub-09", "sub-09",
"sub-10", "sub-10",
] ]
with OasisVBMTestingDatagrabber() as dg: with OasisVBMTestingDataGrabber() as dg:
all_elements = dg.get_elements() all_elements = dg.get_elements()
assert set(all_elements) == set(expected_elements) assert set(all_elements) == set(expected_elements)
out = dg["sub-01"] out = dg["sub-01"]

View file

@ -3,10 +3,10 @@
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de> # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# License: AGPL # License: AGPL
from junifer.testing.datagrabbers import SPMAuditoryTestingDatagrabber from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
def test_SPMAuditoryTestingDatagrabber() -> None: def test_SPMAuditoryTestingDataGrabber() -> None:
"""Test SPM Auditory datagrabber.""" """Test SPM Auditory datagrabber."""
expected_elements = [ expected_elements = [
"sub001", "sub001",
LeSasse commented 2023-05-04 08:11:13 +00:00 (Migrated from github.com)

datagrabber -> DataGrabber?

`datagrabber` -> `DataGrabber`?
@ -20,7 +20,7 @@ def test_SPMAuditoryTestingDatagrabber() -> None:
"sub009", "sub009",
"sub010", "sub010",
] ]
with SPMAuditoryTestingDatagrabber() as dg: with SPMAuditoryTestingDataGrabber() as dg:
all_elements = dg.get_elements() all_elements = dg.get_elements()
assert set(all_elements) == set(expected_elements) assert set(all_elements) == set(expected_elements)
out = dg["sub001"] out = dg["sub001"]

View file

@ -12,9 +12,13 @@ def test_testing_registry() -> None:
importlib.reload(junifer.pipeline.registry) importlib.reload(junifer.pipeline.registry)
importlib.reload(junifer) importlib.reload(junifer)
assert "OasisVBMTestingDatagrabber" not in get_step_names("datagrabber") assert "OasisVBMTestingDataGrabber" not in get_step_names("datagrabber")
assert "SPMAuditoryTestingDatagrabber" not in get_step_names("datagrabber") assert "SPMAuditoryTestingDataGrabber" not in get_step_names("datagrabber")
assert "PartlyCloudyTestingDataGrabber" not in get_step_names(
"datagrabber"
)
importlib.reload(junifer.testing.registry) # type: ignore importlib.reload(junifer.testing.registry) # type: ignore
assert "OasisVBMTestingDatagrabber" in get_step_names("datagrabber") assert "OasisVBMTestingDataGrabber" in get_step_names("datagrabber")
assert "SPMAuditoryTestingDatagrabber" in get_step_names("datagrabber") assert "SPMAuditoryTestingDataGrabber" in get_step_names("datagrabber")
assert "PartlyCloudyTestingDataGrabber" in get_step_names("datagrabber")