Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header not exposed through events #6

Open
KylePoe opened this issue Jun 11, 2021 · 2 comments
Open

Header not exposed through events #6

KylePoe opened this issue Jun 11, 2021 · 2 comments

Comments

@KylePoe
Copy link
Contributor

KylePoe commented Jun 11, 2021

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.

@jsiegle
Copy link
Member

jsiegle commented Jun 14, 2021

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

@KylePoe
Copy link
Contributor Author

KylePoe commented Jun 23, 2021

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants