Newer
Older
notebooks / icom / nback_structure_extractor.py
# install pyreadr package to read RData file
import pyreadr
import pandas as pd

dataset_file = './data/CL2015.rData'

def count_targets(row):
  print(row)
  return 12

# read n-back dataset
datasets = pyreadr.read_r(dataset_file, use_objects="NB")
dataset = datasets["NB"]

# number of trials to look back for local varibilities
window_size = 8

dataset[dataset.participant=='P1'] \
    .rolling(window_size).apply(count_targets)

#dataset \
#  .groupby(['participant','condition']) \

#group by participant and condition
#mark lures
# targets in the block (X_t column)
# lures in the block (X_l column)
# X_v
# recent targets (X_tl)
# recetnt