Recording with too little events

I’ve got a pipelne for ERP analysis which creates metadata for each participant. I have one recording where I forgot to start recording for the first few events.

I’m now getting this error message → ValueError: metadata must have the same number of rows (176) as events (170).

I had one recording with too many events which was an easy fix, but I’m not sure how reduce the amount of metadata rows. I know this may not be too obvious from this little info and can post the code if need be.

Hello @julesneuro,

metadata is just a Pandas DataFrame, so to omit the first n rows of metadata, simply do something like

metadata_subset = metadata_original.iloc[n:]

Best wishes,
Richard

1 Like

Unfortunately, the constructor for the metadata:

metadata, events, event_id = mne.epochs.make_metadata(events=events, event_id=event_dict,
                            tmin=tmin, tmax=tmax, sfreq=raw.info['sfreq'], 
                            row_events = row_events)

Is where the error message occurs:

ValueError: metadata must have the same number of rows (176) as events (170)

Does this clarify where I may be making a mistake?

I honestly doubt that, this error looks like it occurs when creating the epochs, not when calling make_metadata(). When posting error messages, please be sure to always include the entire traceback: this will make it easier to understand the context in which an error occurred.

1 Like

aaaaand you’re absolutely correct. My mistake Richard!