9.2.7. Testing

Testing DataGrabbers.

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/tmp41tyqwjw",
         "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"
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field datadir: Path = PosixPath('/tmp/tmp41tyqwjw')
field types: list[DataType] = [<DataType.VBM_GM: 'VBM_GM'>]
get_element_keys()

Get element keys.

Returns:
list of str

The element keys.

get_elements()

Get elements.

Returns:
list of str

List of elements that can be grabbed.

get_item(subject)

Implement indexing support.

Parameters:
subjectstr

The subject to retrieve.

Returns:
dict

The data along with the metadata.

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:

str

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_groupPartlyCloudyAgeGroup, optional

Age group to fetch (default PartlyCloudyAgeGroup.Both).

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 : :enum:`.PartlyCloudyAgeGroup`, optional\n   Age group to fetch (default PartlyCloudyAgeGroup.Both).",
   "type": "object",
   "properties": {
      "types": {
         "default": [
            "BOLD"
         ],
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "default": "/tmp/tmp5ibdoyq3",
         "format": "path",
         "title": "Datadir",
         "type": "string"
      },
      "reduce_confounds": {
         "default": true,
         "title": "Reduce Confounds",
         "type": "boolean"
      },
      "age_group": {
         "$ref": "#/$defs/PartlyCloudyAgeGroup",
         "default": "both"
      }
   },
   "$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"
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field age_group: PartlyCloudyAgeGroup = PartlyCloudyAgeGroup.Both
field datadir: Path = PosixPath('/tmp/tmp5ibdoyq3')
field reduce_confounds: bool = True
field types: list[DataType] = [<DataType.BOLD: 'BOLD'>]
get_element_keys()

Get element keys.

Returns:
list of str

The element keys.

get_elements()

Get elements.

Returns:
list of str

List of elements that can be grabbed.

get_item(subject)

Implement indexing support.

Parameters:
subjectstr

The subject to retrieve.

Returns:
dict

The data along with the metadata.

pydantic model junifer.testing.datagrabbers.SPMAuditoryTestingDataGrabber

DataGrabber for SPM Auditory dataset.

Wrapper for nilearn.datasets.fetch_spm_auditory().

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`.",
   "type": "object",
   "properties": {
      "types": {
         "default": [
            "BOLD",
            "T1w"
         ],
         "items": {
            "$ref": "#/$defs/DataType"
         },
         "title": "Types",
         "type": "array"
      },
      "datadir": {
         "default": "/tmp/tmpf7c8v3r_",
         "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"
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field datadir: Path = PosixPath('/tmp/tmpf7c8v3r_')
field types: list[DataType] = [<DataType.BOLD: 'BOLD'>, <DataType.T1w: 'T1w'>]
get_element_keys()

Get element keys.

Returns:
list of str

The element keys.

get_elements()

Get elements.

Returns:
list of str

List of elements that can be grabbed.

get_item(subject)

Implement indexing support.

Parameters:
subjectstr

The subject to retrieve.

Returns:
dict

The data along with the metadata.