Skip to content

Preventing losing/altering events when downsampling #1028

Open
@skjerns

Description

I have the following problem

Our trigger channel sometimes doesn't switch on all bits simultaneously, producing events in the STI101 channel (1000 Hz) like

0, 0, 0, 4, 5, 5, 5, 5, 5, 0, 0, 0

when I downsample these data using mne-bids-pipeline to 100 Hz, the resulting trigger channel values are downsampled to 0, 4, 0, such that the event is interpreted as a 4 instead of a 5.

Usually I would avoid this by extracting events beforehand with appropriate min_duration and shortest_event and resampling jointly (raw, events = raw.resample(100, events=events)). However, when using mne-bids-pipeline I don't have this option. The events are correctly inserted as annotations into the resampled pipeline data. However, converting back from annotations to events via mne.events_from_annotations(raw) will scramble the trigger code values, unless manually specified.

Is there any way to avoid this without relying on the _events.json sidecar (in which the correct event information is saved)?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions