psifr.fr.check_data#

psifr.fr.check_data(df)#

Run checks on free recall data.

Parameters:

df (pandas.DataFrame) –

Contains one row for each trial (study and recall). Must have fields:
subjectnumber or str

Subject identifier.

listnumber

List identifier. This applies to both study and recall trials.

trial_typestr

Type of trial; may be ‘study’ or ‘recall’.

positionnumber

Position within the study list or recall sequence.

itemstr

Item that was either presented or recalled on this trial.

Examples

>>> from psifr import fr
>>> import pandas as pd
>>> raw = pd.DataFrame(
...     {'subject': [1, 1], 'list': [1, 1], 'position': [1, 2], 'item': ['a', 'b']}
... )
>>> fr.check_data(raw)
Traceback (most recent call last):
  File "psifr/fr.py", line 253, in check_data
    assert col in df.columns, f'Required column {col} is missing.'
AssertionError: Required column trial_type is missing.