NIRs data with varying trial length

MNE-Python (and by extension MNE-NIRS) does not support variable-length epochs. This is a fundamental limitation of how we’ve chosen to represent epoched data (as NumPy arrays, which makes many computations much faster than if we stored epochs in, e.g., a list instead of an array).

That doesn’t mean it’s impossible: you can manually do this by, e.g., repeatedly copying and cropping a continuous Raw file, and appending each “epoch” to a list. A lot of the speed and convenience of the Epochs data structure will be unavailable, but depending on how complicated your analysis plan is, it might be a OK. You can also consider a subsequent step of padding the beginning and/or end of all the shorter trials with np.nan and then stacking the padded trials into a NumPy array; you can even then use mne.EpochsArray() to get it back into an Epochs data structure.

cross-references to similar questions: