Skip to content

Header not exposed through events #6

Open

Description

@KylePoe

Hi, while I can't comment on whether this is true for all cases, the header is not exposed when loading events. Importantly, the sample rate is nowhere to be found in the recording object. As an example, let data_dir be a path pointing to a directory with .continuous and .events files.

from open_ephys.analysis import Session

session = Session(data_dir)
session.load_events()

At this point, it seems the user should be able to determine the sample rate information, as this information is contained within the header for the .events file, however it is apparently discarded:

def load_events(self):
events_file = os.path.join(self.directory, 'all_channels' + self.experiment_id + ".events")
timestamps, processor_id, state, channel, header = load(events_file, self.recording_index)
self._events = pd.DataFrame(data = {'channel' : channel + 1,
'timestamp' : timestamps,
'processor_id' : processor_id,
'subprocessor_id' : [0] * len(timestamps),
'state' : state})

Certainly, the header information from this events file should be accessible through a recording object. I am unsure what the best way to address is, or if it is already being worked on, but I thought I would bring attention to the problem.

EDIT: I have temporarily solved this for my personal requirements by simply storing the header dict returned by load in self.header.

Activity

  1. jsiegle commented on Jun 14, 2021

    @jsiegle
    Member

    Hi Kyle, thanks for bringing this up. We definitely want this info to be accessible in the Session object, but I'm not sure about the best place to put it.

    Would it make sense to add a top-level metadata property that stores general information about the recording (e.g., start time), as well as info about individual processors? For example, the sample rate for each processor could be accessed via:

    processor_id = 101
    subprocessor_id  = 0
    sample_rate = session.metadata.processors[processor_id][subprocessor_id].sample_rate
    
  2. KylePoe commented on Jun 23, 2021

    @KylePoe
    ContributorAuthor

    I think that would be a very natural way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions