9.2.7. Testing¶
Testing DataGrabbers.
- pydantic model junifer.testing.datagrabbers.ADHDTestingDataGrabber¶
DataGrabber for ADHD dataset.
Wrapper for
nilearn.datasets.fetch_adhd(). The BOLD images are truncated to the firstn_timepoints, resampled to the requested resolution on the MNI152NLin6Asym (FSL) grid and cached (uncompressed) next to the original files in the nilearn data directory.- Parameters:
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "ADHDTestingDataGrabber", "description": "DataGrabber for ADHD dataset.\n\nWrapper for :func:`nilearn.datasets.fetch_adhd`. The BOLD images are\ntruncated to the first ``n_timepoints``, resampled to the requested\nresolution on the MNI152NLin6Asym (FSL) grid and cached (uncompressed)\nnext to the original files in the nilearn data directory.\n\nParameters\n----------\nresolution : float, optional\n The resolution (in mm) of the BOLD images. The original data is in\n 3mm, so other resolutions are resampled (default 3.0).\nn_timepoints : int or None, optional\n The number of timepoints to keep. If None, all the 176 timepoints\n are kept (default 50).", "type": "object", "properties": { "types": { "default": [ "BOLD" ], "items": { "$ref": "#/$defs/DataType" }, "title": "Types", "type": "array" }, "datadir": { "default": "/tmp/tmp5u84on0q", "format": "path", "title": "Datadir", "type": "string" }, "resolution": { "default": 3.0, "title": "Resolution", "type": "number" }, "n_timepoints": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": 50, "title": "N Timepoints" } }, "$defs": { "DataType": { "description": "Accepted data type.", "enum": [ "T1w", "T2w", "BOLD", "Warp", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", "GCOR", "LCOR", "DWI", "FreeSurfer" ], "title": "DataType", "type": "string" } }, "additionalProperties": false }
- Config:
extra: str = forbid
use_enum_values: bool = True
- Fields:
- pydantic model junifer.testing.datagrabbers.OasisVBMTestingDataGrabber¶
DataGrabber for Oasis VBM testing data.
Wrapper for
nilearn.datasets.fetch_oasis_vbm().Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "OasisVBMTestingDataGrabber", "description": "DataGrabber for Oasis VBM testing data.\n\nWrapper for :func:`nilearn.datasets.fetch_oasis_vbm`.", "type": "object", "properties": { "types": { "default": [ "VBM_GM" ], "items": { "$ref": "#/$defs/DataType" }, "title": "Types", "type": "array" }, "datadir": { "default": "/tmp/tmpbogz3olo", "format": "path", "title": "Datadir", "type": "string" } }, "$defs": { "DataType": { "description": "Accepted data type.", "enum": [ "T1w", "T2w", "BOLD", "Warp", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", "GCOR", "LCOR", "DWI", "FreeSurfer" ], "title": "DataType", "type": "string" } }, "additionalProperties": false }
- Config:
extra: str = forbid
use_enum_values: bool = True
- Fields:
- get_item(subject)¶
Implement indexing support.
- model_post_init(context)¶
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- enum junifer.testing.datagrabbers.PartlyCloudyAgeGroup(value)¶
Age group to fetch.
Adult: fetch adults only (n=33, ages 18-39)Child: fetch children only (n=122, ages 3-12)Both: fetch full sample (n=155)
- Member Type:
Valid values are as follows:
- Adult = <PartlyCloudyAgeGroup.Adult: 'adult'>¶
- Child = <PartlyCloudyAgeGroup.Child: 'child'>¶
- Both = <PartlyCloudyAgeGroup.Both: 'both'>¶
- pydantic model junifer.testing.datagrabbers.PartlyCloudyTestingDataGrabber¶
DataGrabber for Partly Cloudy dataset.
Wrapper for
nilearn.datasets.fetch_development_fmri().- Parameters:
- reduce_confoundsbool, optional
If True, the returned confounds only include 6 motion parameters, mean framewise displacement, signal from white matter, csf, and 6 anatomical compcor parameters. This selection only serves the purpose of having realistic examples. Depending on your research question, other confounds might be more appropriate. If False, returns all fMRIPrep confounds (default True).
- age_group{“adult”, “child”, “both”}, optional
Age group to fetch (default
PartlyCloudyAgeGroup.Both).- n_subjects
int, optional The number of subjects to use (default 10).
- n_timepoints
intorNone, optional The number of timepoints to keep. The truncated BOLD images and confounds are cached next to the original files in the nilearn data directory. If None, all the 168 timepoints are kept (default None).
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "PartlyCloudyTestingDataGrabber", "description": "DataGrabber for Partly Cloudy dataset.\n\nWrapper for :func:`nilearn.datasets.fetch_development_fmri`.\n\nParameters\n----------\nreduce_confounds : bool, optional\n If True, the returned confounds only include 6 motion parameters,\n mean framewise displacement, signal from white matter, csf, and\n 6 anatomical compcor parameters. This selection only serves the\n purpose of having realistic examples. Depending on your research\n question, other confounds might be more appropriate.\n If False, returns all :term:`fMRIPrep` confounds (default True).\nage_group : {\"adult\", \"child\", \"both\"}, optional\n Age group to fetch (default ``PartlyCloudyAgeGroup.Both``).\nn_subjects : int, optional\n The number of subjects to use (default 10).\nn_timepoints : int or None, optional\n The number of timepoints to keep. The truncated BOLD images and\n confounds are cached next to the original files in the nilearn data\n directory. If None, all the 168 timepoints are kept (default None).", "type": "object", "properties": { "types": { "default": [ "BOLD" ], "items": { "$ref": "#/$defs/DataType" }, "title": "Types", "type": "array" }, "datadir": { "default": "/tmp/tmp5l7xuyal", "format": "path", "title": "Datadir", "type": "string" }, "reduce_confounds": { "default": true, "title": "Reduce Confounds", "type": "boolean" }, "age_group": { "$ref": "#/$defs/PartlyCloudyAgeGroup", "default": "both" }, "n_subjects": { "default": 10, "title": "N Subjects", "type": "integer" }, "n_timepoints": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "N Timepoints" } }, "$defs": { "DataType": { "description": "Accepted data type.", "enum": [ "T1w", "T2w", "BOLD", "Warp", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", "GCOR", "LCOR", "DWI", "FreeSurfer" ], "title": "DataType", "type": "string" }, "PartlyCloudyAgeGroup": { "description": "Age group to fetch.\n\n* ``Adult`` : fetch adults only (n=33, ages 18-39)\n* ``Child`` : fetch children only (n=122, ages 3-12)\n* ``Both`` : fetch full sample (n=155)", "enum": [ "adult", "child", "both" ], "title": "PartlyCloudyAgeGroup", "type": "string" } }, "additionalProperties": false }
- Config:
extra: str = forbid
use_enum_values: bool = True
- Fields:
- field age_group: PartlyCloudyAgeGroup = PartlyCloudyAgeGroup.Both¶
- pydantic model junifer.testing.datagrabbers.SPMAuditoryTestingDataGrabber¶
DataGrabber for SPM Auditory dataset.
Wrapper for
nilearn.datasets.fetch_spm_auditory(). The dataset has a single subject, which is provided for each of the elements.- Parameters:
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "SPMAuditoryTestingDataGrabber", "description": "DataGrabber for SPM Auditory dataset.\n\nWrapper for :func:`nilearn.datasets.fetch_spm_auditory`. The dataset has\na single subject, which is provided for each of the elements.\n\nParameters\n----------\nn_timepoints : int or None, optional\n The number of BOLD timepoints to keep. If None, all the 84\n timepoints are kept (default None).", "type": "object", "properties": { "types": { "default": [ "BOLD", "T1w" ], "items": { "$ref": "#/$defs/DataType" }, "title": "Types", "type": "array" }, "datadir": { "default": "/tmp/tmpal3h61cf", "format": "path", "title": "Datadir", "type": "string" }, "n_timepoints": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "N Timepoints" } }, "$defs": { "DataType": { "description": "Accepted data type.", "enum": [ "T1w", "T2w", "BOLD", "Warp", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", "GCOR", "LCOR", "DWI", "FreeSurfer" ], "title": "DataType", "type": "string" } }, "additionalProperties": false }
- Config:
extra: str = forbid
use_enum_values: bool = True
- Fields:
- pydantic model junifer.testing.datagrabbers.UCLACNPVBMTestingDataGrabber¶
DataGrabber for UCLA CNP VBM testing data.
Grey matter probability maps (computed with fMRIPrep) of 10 control subjects of the UCLA Consortium for Neuropsychiatric Phenomics LA5c study (OpenNeuro ds000030, release R1.0.4), downloaded with
nilearn.datasets.fetch_openneuro_dataset().The maps are in MNI152NLin2009cAsym at 1mm. Other resolutions are resampled (linear interpolation) to the corresponding templateflow grid, so templates and masks at that resolution do not need resampling. They are cached (uncompressed) next to the original files in the nilearn data directory.
- Parameters:
- resolution
float, optional The resolution (in mm) of the maps (default 2.0).
- resolution
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "UCLACNPVBMTestingDataGrabber", "description": "DataGrabber for UCLA CNP VBM testing data.\n\nGrey matter probability maps (computed with fMRIPrep) of 10 control\nsubjects of the UCLA Consortium for Neuropsychiatric Phenomics LA5c\nstudy (OpenNeuro ds000030, release R1.0.4), downloaded with\n:func:`nilearn.datasets.fetch_openneuro_dataset`.\n\nThe maps are in MNI152NLin2009cAsym at 1mm. Other resolutions are\nresampled (linear interpolation) to the corresponding templateflow grid,\nso templates and masks at that resolution do not need resampling. They\nare cached (uncompressed) next to the original files in the nilearn data\ndirectory.\n\nParameters\n----------\nresolution : float, optional\n The resolution (in mm) of the maps (default 2.0).", "type": "object", "properties": { "types": { "default": [ "VBM_GM" ], "items": { "$ref": "#/$defs/DataType" }, "title": "Types", "type": "array" }, "datadir": { "default": "/tmp/tmpmc101b16", "format": "path", "title": "Datadir", "type": "string" }, "resolution": { "default": 2.0, "title": "Resolution", "type": "number" } }, "$defs": { "DataType": { "description": "Accepted data type.", "enum": [ "T1w", "T2w", "BOLD", "Warp", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", "GCOR", "LCOR", "DWI", "FreeSurfer" ], "title": "DataType", "type": "string" } }, "additionalProperties": false }
- Config:
extra: str = forbid
use_enum_values: bool = True
- Fields:
- get_item(subject)¶
Implement indexing support.
- get_participants()¶
Get the participants information.
- Returns:
pandas.DataFrameThe participants information (e.g. age and gender), indexed by subject.