Really view just one subprocessor in the LFP viewer, and also view events not corresponding to any data channels#303
Conversation
|
Thanks for this! The only thing I'm not convinced is using a 0 sample rate as indicator that the event is "standalone" Using a zero-timestamp as a marker not only feels hackish, it also prevents having this information stored anywhere. I'd advocate using a different approach. Maybe adding some fields to the Event class itself to register if the source processor had associated continuous data or not. Although I'm generally against adding stuff to the base classes, this could justify it. |
|
@aacuevas OK, good point. I didn't realize the sample rate on event channels was used for that purpose. What I had previously, before changing it at the last minute to setting the sample rate to 0 since I thought it was simpler, was that event channels with no source data would set all fields of the metadata |
|
I was thinking on adding a field in Event telling if the source processor has continuous data or not. It could also be useful to add some |
|
OK, I'm not sure I see the full picture yet but it makes sense to me to make this information available in a less hacky way than in the metadata field. So do you want to just leave the PR open for now pending base class changes? I'm going to revert the last commit that added the check for sample rate = 0, since it seems like we agree that was a bad idea. |
|
I guess when you create the A little convoluted, but it would be flexible in that changes to the timestamp source or to the data channel backing an event channel would be reflected in any subsequently created events without making a new |
|
I left this for a while, sorry, but I believe it is time to revive it. I would want these changes to get into the next release I am preparing.
Could you please check the changes and update this PR accordingly if needed? |
|
This is great, thanks! Working on updating the PR. Is it me or are the new getter functions not yet implemented? I can't see them in |
|
@aacuevas: Should we still keep a separate TTL state for each subprocessor? As in, for this line:
I'm not sure what should happen if the event is linked to the global timestamp source and not any specific data channel/subprocessor. It seems like having just one global TTL state might be less confusing. Is there a use case for maintaining separate TTL namespaces/states for different data sources? |
|
Yes, the method bodies were missing from the commits, my bad. They are on the repo now. Regarding your second question, the truth is that the LFP viewers still rely on old core, before event channel objects were a thing. That is also why they only support 8 TTLs with no distinction of source. |
|
OK, so I guess TTL events not linked to a specific data channel could alter the TTL state of all sources? Does that seem logical? |
|
Or if you really wanted to restructure things, another way would be to make Maybe not what you want to do since subprocessors are still being phased out, right? Or maybe "streams" will work something like this? |
|
Do you mean throughout the system or just for the LFP viewer? For the whole system we have to take into considerations the limitations of the JUCE library, as well as make it general enough. "ttl states" is only relevant to visualization, as TTL events have value on their own. Mixing them for visualization is actually a non desirable side effect of the viewers being based on an old architecture. Ideally we should be able to select which TTL events to visualize. But that is an extensive patch outside of the scope of this PR. For the sake of getting this PR working, I have added a new Since for visualization we are, indeed, mixing all ttl events with a shared timestamp source into a single state, for events with I would like this PR to be integrated into development as soon as possible, as we are planning a new release soon and I feel this should be into it. Thanks for all the help! |
I was talking about the whole system, but also I was just trying to throw out more ideas because I wasn't sure if the silence for a couple of days meant you were stuck/confused about the issue I was asking about. But I now see that I had some misconceptions....
OK, interesting, I didn't realize this. So regardless of whether they are grouped or independent, my main issue was that giving each subprocessor its own set of TTL channels that don't interact with each other seemed needlessly complex and I couldn't figure out how a generic TTL input not associated with any particular data would fit into that framework. On the other hand, I realize that you designed it that way on purpose and I'm not really trying to suggest this PR should trigger a big architectural change and reversing that design decision. Allowing a non-data-linked TTL event to operate on the TTL channels of the global sample rate source (in preference to any other sources) still doesn't make complete sense to me, but I can implement it that way with the help of the new method you added (thank you). -Ethan |
|
I do believe there is amisconception with ttls and data links. And now we get to the third type. Stuff like the network processor creates events (which may be TTL, text messages or binary events) with no relation to any source whatsoever. But when recording (which is the priority) we need to be aware of when they were generated. That is where the global timestamps come into action. Global timestamps are actually "timestamps for processors which do not produce their own but produce events", nothing more. By default they are interpolated from the first continuous source, but it can be selected with Edit/Timestamp source. For recording, there no issue at all. Everything get recorded with their timestamps that can, in turn, be converted to seconds, synchronized with other sources, etc... Keep in mind that the priority is always recording, and having all the data present in the recordings. Now, the LFP viewer on itself is in an incomplete state related to that. Right now it just lets you see "8 channels" which originally corresponded to the hardware TTLs. In a ideal scenario, there would be 8 (or N) visualization "channels" whose actual event source could be selected. |
|
Thanks for explaining your perspective on this in detail. I think it all makes sense. So if I understand correctly, you'd rather keep every single TTL event channel's state separate and individually visualizable, but because of the limitations we have now, we're going to combine all channels with a common timestamp source into one state?
I believe this will actually be how it works in this PR. I should be able to finish it tonight. |
…0 (simpler)" This reverts commit bdd664f.
58a72ba to
ce9a7ba
Compare
|
OK, should be working now. See also open-ephys-plugins/ZMQPlugins#4. |
|
Great, thanks! |
This resolves #302. To summarize, the LFP viewer currently has the weird behavior of showing data from all subprocessors with a given index in their source nodes, rather than just one single subprocessor. This is convenient and works sometimes, but the incoming data from different sources could have different sample rates or different amounts of samples per buffer even with the same sample rate; dealing with this is complex and currently causes display glitches in some cases, and maybe instability.
This changes the combobox to let you choose a specific source node/subprocessor combination - for example, "File Reader 111/0" is the first subprocessor of the File Reader with node ID 111. Because there is now only one subprocessor being drawn, we only have to keep track of one current sample rate rather than an array of one per channel; however, I also added maps from subprocessor ID to sample rate and # of channels in the node, so that switching from one subproc to another works correctly.
As a side effect, we can now easily fix the issue brought up in #277 of Network Events TTLs not showing up, because we can use the information (i.e. # of samples) from the subprocessor that is being drawn to infer how to draw events with no associated continuous data. A simple way to do this is to treat any event channels with a sample rate of 0 as "standalone" events not corresponding to continuous data. I'm also making open-ephys-plugins/ZMQPlugins#2 that changes the Network Events event channels to have sample rate 0 so that this will work.
There are a bunch of changes, including some style things I did just to get rid of warnings in the process of working through the LFP Viewer code, so definitely ask if some parts don't look right/make sense!