rsatoolbox.io.meadows module

Covers import of data downloaded from the Meadows online behavior platform.

For information on available file types see the meadows documentation on downloads.

rsatoolbox.io.meadows.extract_filename_segments(fpath: str) InfoDict[source]

Get information from the name of a downloaded results file

Will determine:
  • participant_scope: ‘single’ or ‘multiple’, how many participant

    sessions this file covers.

  • task_scope: ‘single’ or ‘multiple’, how many experiment tasks this

    file covers.

  • participant: the Meadows nickname of the participant, if this is a

    single participation file.

  • task_index: the 1-based index of the task in the experiment, if

    this is a single participant file.

  • task_name: the name of the task in the experiment, if

    this is not a single participant file.

  • version: the experiment version as a string.

  • experiment_name: name of the experiment on Meadows.

  • structure: the structure of the data contained, one of ‘tree’,

    ‘events’, ‘1D’, ‘2D’, etc.

  • filetype: the file extension and file format used to serialize the

    data.

Parameters:

fpath (str) – File system path to downloaded file

Returns:

Dictionary with the fields described above.

Return type:

dict

rsatoolbox.io.meadows.is_petname(segment: str) bool[source]

Check whether the given string matches a name as generated by Petname

Parameters:

segment (str) – potential name

Returns:

True if the string is a petname

Return type:

bool

rsatoolbox.io.meadows.load_rdms(fpath: str, sort: bool = True) RDMs[source]

Read a Meadows results file and return any RDMs as an rsatoolbox object

Parameters:
  • fpath (str) – path to .mat Meadows results file

  • sort (bool) – whether to sort the RDM based on the stimulus names

Raises:

ValueError – Will raise an error if the file is missing an expected variable. This can happen if the file does not contain MA task data.

Returns:

All rdms found in the data file as an RDMs object

Return type:

RDMs

rsatoolbox.io.meadows.load_rdms_comps_json(fpath: str, info: InfoDict) RdmsComps[source]

Load rdms components from a Meadows json file

Parameters:
  • fpath (str) – full file path

  • info (InfoDict) – dictionary describing the file name

Raises:
  • ValueError – Multi-participant json files not supported yet

  • ValueError – Single-task json files not supported yet

  • ValueError – Unexpected structure in json file

Returns:

tuple of rdms components

Return type:

Tuple[NDArray, List[str], List[str], List[str], List[int]]

rsatoolbox.io.meadows.load_rdms_comps_mat(fpath: str, info: InfoDict) RdmsComps[source]

Load rdms components from a Meadows mat file

Parameters:
  • fpath (str) – full file path

  • info (InfoDict) – dictionary describing the file name

Raises:

ValueError – File missing variable: X

Returns:

tuple of rdms components

Return type:

Tuple[NDArray, List[str], List[str], List[str], List[int]]