CerebusOSS / CereLink

Blackrock Microsystems Cerebus Link for Neural Signal Processing
BSD 2-Clause "Simplified" License
53 stars 22 forks source link

Does CereLink enable functionality similar to Central's "SingleNeuralChannel"? #71

Open cboulay opened 7 years ago

cboulay commented 7 years ago

Hi all,

In Central, there's an app to display activity from a single neural channel. This window is very useful and has 90% of the functionality that I need but unfortunately not quite enough; I have to write my own app. I'm curious about how this window achieves a couple different things.

  1. Even if a channel is not configured to acquire continuous data, the window still displays the continuous data at the bottom. Even if this window is open and displaying continuous data, continuous data does not appear in the raster plot.
  2. Even if a channel is not configured to acquired high-pass filtered data, this window still displays a high-pass filtered signal in the 'Strip' tab from which the threshold can be set.

How is (1) achieved? Does CereLink expose that functionality?

I guess that (2) can be achieved by filtering (1), though this seems dangerous if the filters don't match exactly those used by the NSP because then the threshold set by the user wouldn't perform exactly as expected on the NSP.

dashesy commented 7 years ago

There is some for-display data (i.e. low sample rate) that are sent cbPKT_STREAMPREV but CereLink currently does not do anything with it, it is good for display because eye refresh rate us slower. Also, there is a raw channel cbRAWGROUP that can be configured along with the normal sample rate (both at the same time).

Everything should be in cbhwlib somewhere.

cboulay commented 7 years ago

FYI, the reason I'm pursuing this is because I'm running into performance problems trying to plot 8 channels at 30 kHz + 4 channels at 2 kHz.

Central does not allow configuring a channel to transmit both SDK_SMPGRP_RAW and SDK_SMPGRP_RATE_30k, but RAW and something less than 30kHz is allowed. Is that a limitation of the NSP or just Central?

cbPKT_STREAMPREV sounds interesting. In its definition I don't see any fields that would hold data. Can you indicate which?

The code comments suggest that cbPKT_STREAMPREV.chid should be 0x8000 + channel identifier. It seems like this chid doesn't meet any logical checks in ProcessIncomingPackets (there is no corresponding else for that second if). Would this be the right place to put it? I can attempt this, but I will only bother doing so if this gets me closer to getting easy-to-plot data.

zeeMonkeez commented 7 years ago

Analysing the package traffic it seems like Central sends out a cbPKTTYPE_PREVSET every some 250ms. I didn't see a definition of the packet, but it just seems to be 0x8000 + chid, and empty payload. That gets confirmed by the NSP with cbPKTTYPE_PREVREP, followed by cbPKT_STREAMPREV every 20 ms. I guess Central then calculates the displayed value from rawmin and rawmax? After the last cbPKTTYPE_PREVSET package was sent from Central (before closing the preview window), cbPKT_STREAMPREV were sent for 1 second, so perhaps cbPKTTYPE_PREVSET don't have to be sent that often.

dashesy commented 7 years ago

The comments describe what each field is. For example rawmin and rawmax are the minimum and maximum of the raw channel (the additional raw channel) for that time period (I think around 250ms). Or envmin and envmin are enevelope's min and max (that is shown in threshold). To plot, just plot a bar with those values, and it will look like zoomed-out version of the high sample rate data. (I think) It is sent only for one channel currently under preview, Central sends some packet to tell which channel is currently open.

Central not configuring SDK_SMPGRP_RAW could be to avoid going above bandwidth I think.

dashesy commented 7 years ago

I think monsource is the channel to be monitored

cboulay commented 7 years ago

Thanks, I'll give it a try later this week.