Compare LPP amplitudes for recalled versus unrecalled items within a category.
This analysis splits items by recall outcome within a reference category, comparing LPP amplitudes at each study position for items that were subsequently recalled versus those that were not. A subsequent memory effect appears when recalled items show higher LPP than unrecalled items.
Workflow
Code
import os
import matplotlib.pyplot as plt
import warnings
from jaxcmr.analyses.cat_lpp_by_recall import plot_cat_lpp_by_recall
from jaxcmr.helpers import find_project_root, generate_trial_mask, load_data, save_figure
warnings.filterwarnings("ignore" )
Code
data_path = "data/TalmiEEG.h5"
figure_dir = "results/figures"
figure_str = ""
ylim = None
trial_query = "data['subject'] > 0"
category_field = "condition"
category_value = 1
lpp_field = "EarlyLPP"
labels = ["Recalled" , "Unrecalled" ]
contrast_name = "Negative Items"
Code
project_root = find_project_root()
figure_dir = os.path.join(project_root, figure_dir)
data_path = os.path.join(project_root, data_path)
data = load_data(data_path)
trial_mask = generate_trial_mask(data, trial_query)
Code
plot_cat_lpp_by_recall(
data, trial_mask,
category_field= category_field,
category_value= category_value,
lpp_field= lpp_field,
labels= labels,
contrast_name= contrast_name,
)
if ylim is not None :
for ax in plt.gcf().axes:
ax.set_ylim(ylim)
save_figure(figure_dir, figure_str)
Interpretation
Two curves show mean LPP amplitude across study positions for recalled and unrecalled items.
Recalled > Unrecalled : subsequent memory effect — higher encoding-related neural activity predicts recall.
No separation : LPP does not predict recall for this category.
API Details
Notebook parameters
data_path — path to an HDF5 file containing a RecallDataset with EEG fields.
figure_dir — directory for saving figures.
figure_str — base filename for the saved figure. Leave empty to display without saving.
ylim — y-axis limits as a tuple, or None for automatic scaling.
trial_query — a Python expression evaluated against the dataset to select trials.
category_field — dataset field containing category labels.
category_value — the category to analyze.
lpp_field — dataset field containing LPP amplitudes per study position.
labels — legend labels for recalled and unrecalled conditions.
contrast_name — legend title.