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

Using open ephys python tools to monitor for errors #24

Closed
timsainb opened this issue Jul 13, 2023 · 3 comments
Closed

Using open ephys python tools to monitor for errors #24

timsainb opened this issue Jul 13, 2023 · 3 comments

Comments

@timsainb
Copy link

Hello,

I was wondering if it is possible to use open ephys python tools to monitor for an error that I'm having with the open ephys GUI.

Basically, I am recording 24/7 ephys and sending a TTL signal every 5 seconds as a 'sync' through an intan board. This works 99% of the time, but some small percentage of the time (say, once every 72 hours) my recording is corrupted because of the following error "Error in Rhd2000EvalBoard::readDataBlock: Incorrect header". I've tried to solve the error but since it's so rare I have trouble tracking it down.

Why I would like to do is programatically watch for the error, and kill / restart open ephys recordings when the header becomes corrupted. Is this possible?

@jsiegle
Copy link
Member

jsiegle commented Jul 13, 2023

There's not a way to do this out of the box, but it could achieved with a small modification to the Acquisition Board plugin.

In this section, before calling break, I think you'd just need to add the following lines of code:

uint64 ttlEventWord = 1 << 7;
int64 timestamp = 0;

sourceBuffers[0]->addToBuffer(thisSample,
                              &timestamp,
                              &ts,
                              &ttlEventWord,
                              1);

This will add a TTL event on line 8 (assuming that hardware input line is not used), which could be sent using the Event Broadcaster plugin and received using the streaming module. The callback from the streaming module could close and re-open the GUI.

Let me know if that makes sense!

@jsiegle
Copy link
Member

jsiegle commented Jul 13, 2023

At some point we will update the Event Broadcaster plugin to relay broadcast messages (instead of just TTL events and spikes) to external listeners, which would make this a lot simpler: open-ephys-plugins/event-broadcaster#3

@timsainb
Copy link
Author

Thanks Josh! I think while I wait for that feature I will do something a bit simpler and just write the output of open-ephys to a log and when the error prints, just restart the recording! Feel free to close unless you want to leave this open as a feature request.

@jsiegle jsiegle closed this as completed Jul 14, 2023
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