Many of the utility epoch functions take Nx2 arrays. I think it might be useful to have an Epoch object with overloaded operators. So, rather than doing:
a = epoch_intersection(z, y)
c = epoch_union(a, b)
e = epoch_difference(c, d)
You can do
e = ((z & y) + b) - d
You'd create the epoch:
recording_duration = 30 # duration of recording in seconds
epoch_name = 'TRIAL'
times = [
[5, 10],
[20, 25],
]
z = Epoch(times, epoch_name)
Note that we can do things like invert the epochs. For example:
m = ~z
m.times # now will be [[0, 5], [10, 20], [25, np.inf]]
Note that we now have a placeholder for the end of the last inverted epoch as np.inf (meaning that the epoch is essentially infinite).
When needed, we can convert it to a mask:
mask = z.as_mask(fs, duration) # provide sampling rate and duration to generate mask
Many of the utility epoch functions take Nx2 arrays. I think it might be useful to have an
Epoch
object with overloaded operators. So, rather than doing:You can do
e = ((z & y) + b) - d
You'd create the epoch:
Note that we can do things like invert the epochs. For example:
Note that we now have a placeholder for the end of the last inverted epoch as
np.inf
(meaning that the epoch is essentially infinite).When needed, we can convert it to a mask: