rsagroup/rsatoolbox

definition at wrong place

pgupta013 opened this issue · 2 comments

In demo_meg_mne.ipynb:

get condition name per event and parse the factor levels

rev_event_id = {v: k for k, v in epochs.event_id.items()}
event_names = np.array([rev_event_id[i] for i in epochs.events[:, 2]])

should be earlier to avoid error here,

residuals = np.zeros_like(epochs.get_data(picks=picks))

get condition name per event and parse the factor levels

rev_event_id = {v: k for k, v in epochs.event_id.items()}
event_names = np.array([rev_event_id[i] for i in epochs.events[:, 2]])

loop over event_id and compute residuals

for event_id, trigger in epochs.event_id.items():
events_data = epochs[event_id].get_data(picks=picks) # n_repetitions x n_channels x n_times
residuals[event_id == event_names, :, :] = events_data - np.mean(events_data, axis=0, keepdims=True)

print(f'{residuals.shape=} = (n_events, n_channels, n_timepoints)')

Confirmed

Thanks for reporting these issues @pgupta013 , I've addressed these in #364 and this should be packaged with release 0.1.5