Treatment of epochs in BaseRawIO

27 views
Skip to first unread message

Peter N. Steinmetz

unread,
Aug 2, 2022, 2:27:07 PM8/2/22
to Neural Ensemble
I am wondering now about the best way to treat and present epochs which are derived from a continuously recorded channel with the BaseRawIO derived classes.

More specifically, I have a RawIO derived from BaseRawIO which has a specific continuously sampled channel which just turns on and off to some arbitrary value to denote events occurring in the experiment. (I imagine this is a common use case.)

So how best to present these epochs within the Neo RawIO and IO model? 

I cannot find support for epochs per se in BaseRawIO, though it seems like the Events and Epochs may be run together there. 

Peter N. Steinmetz

unread,
Aug 3, 2022, 11:32:22 AM8/3/22
to Neural Ensemble
I see also that io.basefromrawio throws unimplemented on accessing epochs. 

Is there an extent core io or rawio that deals with epochs? 

Jeffrey Gill

unread,
Aug 3, 2022, 3:15:39 PM8/3/22
to neurale...@googlegroups.com
Hi Peter,

I believe you are right to say that epochs and events are somewhat run together in BaseRawIO. Both use "event channels", just with the "type" set to either 'epoch' or 'event'. See _event_channel_dtype:


Depending on whether the third column entry in your RawIO's header['event_channels'] is set to 'epoch' or 'event', BaseFromRaw will interpret a channel as a Neo Epoch or a Neo Event. You can see that happening here:


AxographRawIO is an example of an extant rawio that I built which handles both epochs and events:
  1. Here I initialized two channels in header['event_channels'], one for events ("tags" in AxoGraph terms) and one for epochs ("intervals").
  2. Previously parsed timestamps (for events and epochs) and durations (for epochs only), along with labels, are stored internally in a manner that parallels the defined event/epoch channels here.
  3. These are accessed via AxographRawIO's _get_event_timestamps, which does indeed handle epochs too, and which is made public via BaseRawIO's get_event_timestamps.
  4. Finally, get_event_timestamps is called when Epoch or Event proxy objects are loaded here.
From your description of your epochs derived from a continuous signal, I think it should definitely be possible to build a rawio that extracts those and presents them as Neo Epochs in a convenient way for the user!

I hope this helps!

Jeff Gill



--
You received this message because you are subscribed to the Google Groups "Neural Ensemble" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neuralensembl...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/neuralensemble/9b66fcf4-b9b1-4b33-bf3e-da7d21cfc329n%40googlegroups.com.

Samuel Garcia

unread,
Aug 22, 2022, 6:16:14 AM8/22/22
to neurale...@googlegroups.com
Hi Peter and Jeff,
I think the explanation from Jeffrey are perfect. Peter tell us if you need more info.
I do not remember why exactly I decided to handle event/epoch with the same methods in rawio api.
They are similar except that there is no duration for event.
Bonne journée
Sam
Reply all
Reply to author
Forward
0 new messages