moabb
moabb copied to clipboard
Make a dataset return epochs directly
For a lot of datasets sometimes we often already have the data in epochs. Sometimes the data is given to us only in epochs (my case). I would like to start a discussion on this subject. I tried to investigate today.
I think that the paradigm object expects continuous data and that is why datasets can not return epochs and are often forced to build a "continuous" signal that is later converted back into epochs making the whole process cumbersome the least and prone to errors.
Is it possible that here: https://github.com/NeuroTechX/moabb/blob/719f541540263c767fa393e477eed37653bb5825/moabb/paradigms/base.py#L293 the code check if the dataset is "is_epochs_only". Then instead of calling dataset.get_data() we can call a new method called dataset.get_data_np_epochs(). dataset.get_data_np_epochs() will return (epochs, channels, samples). This data is for all selected subjects in dataset.get_data_np_epochs().
So these epochs provided by dataset.get_data_np_epochs() should be used by the code that follows (always in paradigm_get_data() method) When I say "epochs" it is an np array (epochs, channels, data per channel) that will be used to generate the current output of paradigm.get_data().
How does this sound?