Open bburan opened 6 years ago
Some recent conversations with @crheller about using masks for epoch selection without actually applying the mask. I think this takes care of a lot of this issues raised here. Basic sequence of operations is to define a mask and then pass that mask to a select_epochs call.
What could still use a bit of work is operations on the mask (like clearing).
We have explored multiple approaches for selecting subsets of a signal including
RasterizedSignalSubset
. After a conversation with @svdavid where he filled me in on the masking approach that @svdavid and @crheller set up, I think we should migrate towards the masking approach for everything. To summarize what we discussed in pseudocode.Here, the
_data
attribute on the signals ine1
,e2
,e3
,e4
,e5
,est
andval
are basically references to the_data
attribute on the signals inrecording
(i.e., they all share the same data array and it will be set to immutable to prevent accidental manipulation). However, each recording will have an independent mask that indicates the portion of the recording that can be used for analysis. Recordings/Signals will support the following primitive methods. Methods that acceptinplace
as a parameter will return a copy when the argument is False or modify the existing object if True:By default, return a copy of data containing only the masked portions. Set
mask=False
to get the full dataset.Set the mask on the signal.
Remove the mask from the signal
Perform the appropriate boolean operation between the current mask and the new mask, and set that as the mask for the object.
As before, but returns only epochs that are not masked. Need to clarify behavior for partially masked epochs, but this should be user-configurable (e.g., add a parameter
partial
to indicate whether partial epochs are OK or not).All other methods will then use these methods to manipulate the mask. For example,
select_epochs(mask_mode='and')
should create a mask and then useand_mask
to modify the mask,select_epochs(mask_mode='replace')
would replace the mask entirely (e.g., ignoring any mask created by an est/val split).