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

Add TTL Word option to store integer event codes #6

Open
joschaschmiedt opened this issue Jun 19, 2024 · 3 comments
Open

Add TTL Word option to store integer event codes #6

joschaschmiedt opened this issue Jun 19, 2024 · 3 comments

Comments

@joschaschmiedt
Copy link

joschaschmiedt commented Jun 19, 2024

Hi everyone,

I've just started working with OpenEphys and am setting up a new neuropixels lab. So far, I'm really happy with the customizability and design of OE! Thanks to all the developers.

Our experimental control software produces 16-bit integer codes for events, which we previously have sent as digital words to our recording systems. I'd like to be able to send these codes also via the Network Events plugin.

At the moment the TTL [Line=1-256] [State=0/1] command emulates actual TTL lines, which have to be turned on an off individually (and are limited to 256). I'd like to propose adding a command to send a word at once, which is stored as a time-stamped event, e.g.

TTL Word=uint64

As far as I've seen, this is not possible yet. I'd go ahead and add handling such a message NetworkEvents::handleSpecialMessages. Does it make sense to create these events using the TTLEvent's factory method createTTLEvent(const EventChannel* channelInfo, int64 sampleNumber, uint8 line, bool state, uint64 word)?

@anjaldoshi
Copy link
Collaborator

Hi @joschaschmiedt,

Yes, currently it is not possible to send TTL words directly via Network Events. But, you're on the right track. It should be able to receive and add TTL word events if you implement your mentioned changes. The TTLEvent factory method you mentioned for TTL words should work here.

You can see an example of how to use that method in the SourceNode::process code here: https://github.com/open-ephys/plugin-GUI/blob/main/Source/Processors/SourceNode/SourceNode.cpp#L335-L359

Feel free to ask any further questions!

@joschaschmiedt
Copy link
Author

joschaschmiedt commented Jul 2, 2024

Hi @anjaldoshi,

Thanks for the hint. I implemented the new TTL Word=<word> command (commit 82fc006) . Would you mind having a look a the pull request (#7) and checking whether this is in the right direction? I still would like to do some proper testing before actually merging this.

I also fixed the windows GitHub pipeline. Would you mind enabling the GitHub Actions on this repository?

@joschaschmiedt
Copy link
Author

I updated my PR for the implementation of the TTL Word=<word> option (#7) for the upcoming 1.0.

I have a remaining design question. The new overload for TTL words TTLEvent::createTTLEvent returns an array of TTLEvent pointers, one for each bit that has changed. This leads to several identical words and timestamps in the resulting binary recording. E.g. when sending a 97 (=b01100001) after a 0 via TTL Word=97 this results in

full_words = np.array([97, 97, 97]])
sample_numbers = np.array([114298, 114298, 114298])
states = np.array([1, 6, 7], dtype=int16)

While this is correct, it is a bit redundant and potentially confusing for a user analyzing the data. Do you have an opinion on this?

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