int-brain-lab / iblapps

pyqt5 dependent applications for IBL sessions
MIT License
25 stars 15 forks source link

Bandpassed power plot does not change in Electrophysiology Atlas GUI #119

Open cspurandare opened 7 months ago

cspurandare commented 7 months ago

Hi, I am using the IBL ephys alignment GUI and have tested the sample data provided as well as my own data. Things are looking good, in terms of spike related properties and RMS of LFP and AP channels seems reasonable. But when I try to extract more information using the "Probe plots" by switching between different frequency bands (0-4Hz vs 80-200Hz) the resultant plot is unchanged. This happens with my data, but the GUI behaves well with the sample data. I tried to look through the code and couldn't figure it out. I tried to open the raw npy files in MATLAB, and noticed that the sample data is 513x385, whereas my data was 513x384 (1 for each of the NP1.0 channels). Perhaps that is the cause of the difference? What does the 385th channel do, and how does one get that information?

Also as an aside, the output plot is a (4x N_Channels) color matrix in dB. I am curious how it reaches that dimensions, specifically how does it choose which 4 bins to plot at? My data files and 2 screenshots for the issue are at the link below - https://drive.google.com/drive/folders/1OFNksUzYOTsWKy3cAvNcT-kA0NSjjX-U?usp=sharing Thanks, Chinmay

mayofaulkner commented 7 months ago

Hello!

The 385th channel is the sync channel that contains the 1Hz signal from spikeglx/openephys that can be used to align the probe to other recordings devices. It isn't a problem that this is present as this is accounted for by the channels.rawInd.npy file that only contains the 384 channels that have the neural signal on them.

I've just loaded in your data and looked at the plot with the spectrum across frequency and it seems to be the case that the LFP spectrum is the same across all frequency bands.

Screen Shot 2024-04-05 at 9 12 00 AM

If you look at the raw LFP data is it very noisy? Just looking at the rms LFP plot the units seem to be crazy compared to the sample data...?

Screen Shot 2024-04-05 at 9 19 30 AM
cspurandare commented 7 months ago

Hi Mayo, Thank you for your prompt email. I think I have figured out the problem - I think there are 3 separate issues going

  1. The noisy nature of the LFP is somewhat expected to me, because I am subsampling 10 second chunks (every 300 seconds, since I record for 10hr+) and to get going quickly, I didnt sample as much.
  2. The rms LFP units are massive in 10^6 uV, I think because I have some issue with scaling the uint16/int16 data for uV. Do you know if your code has an inherent conversion/scale up factor? I tried fixing it based on the factor I knew from Open-Ephys, but it still doesn't look right.
  3. The LFP spectrum looking the same across frequency bands seems to be a silly problem I created - I saved the .npy file as 1x513 single, vs the code requires it to be 513x1. Doing that makes the line plots look good. But I have 1 remaining question about what the different boxes along the x-axis in the line plots mean? (there are typically 4 values per channel) Thanks and apart from these 2 questions (scaling factor and 4 values per channels), I think I have it figured out so you can close this issue? Thanks again, Chinmay

On Fri, Apr 5, 2024 at 3:21 AM mayofaulkner @.***> wrote:

Hello!

The 385th channel is the sync channel that contains the 1Hz signal from spikeglx/openephys that can be used to align the probe to other recordings devices. It isn't a problem that this is present as this is accounted for by the channels.rawInd.npy file that only contains the 384 channels that have the neural signal on them.

I've just loaded in your data and looked at the plot with the spectrum across frequency and it seems to be the case that the LFP spectrum is the same across all frequency bands. Screen.Shot.2024-04-05.at.9.12.00.AM.png (view on web) https://github.com/int-brain-lab/iblapps/assets/11440465/a745593f-fc3a-4e9e-aa62-fe8f8dc7df38

If you look at the raw LFP data is it very noisy? Just looking at the rms LFP plot the units seem to be crazy compared to the sample data...? Screen.Shot.2024-04-05.at.9.19.30.AM.png (view on web) https://github.com/int-brain-lab/iblapps/assets/11440465/c68566f1-e8d9-4d19-8c9c-49df7a905ec0

— Reply to this email directly, view it on GitHub https://github.com/int-brain-lab/iblapps/issues/119#issuecomment-2039228745, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKCRY4NJUIRY6YL4AHEPO3Y3ZNHXAVCNFSM6AAAAABFUP3AR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGIZDQNZUGU . You are receiving this because you authored the thread.Message ID: @.***>

mayofaulkner commented 7 months ago

The code in the extract data uses the spikeglx reader module under the hood, which basically used the ADC conversion factor to translate the data from bits into volts. So on your side you should not need to do any conversion. Was your data recorded using spikeglx or openephys?

For the 4 values per channel, I'm not sure I fully understand the question, but the probe plot basically shows the data on the individual channels as they are arranged on the neuropixel probe. Does that clear things up?

cspurandare commented 7 months ago

Hi Mayo, My data is from OpenEphys, so I might be off in my calculation due to one storing int16 vs another storing uint16? But I can check up the respective codes and figure it out, should be tractable. Regarding the probe plot, the plot is actually a matrix right? One of its dimensions is 384 (or the number of channels) and the other dimension seems to be 4 (since there are 4 blocks of colors at each y position (y positions are depths, or the number of channels effectively). So I am curious what these 4 values at each channel mean. Attached is a plot, basically my question is what the x-axis mean in the probe plots? Thanks, Chinmay

On Mon, Apr 8, 2024 at 4:23 AM mayofaulkner @.***> wrote:

The code in the extract data uses the spikeglx reader module under the hood, which basically used the ADC conversion factor to translate the data from bits into volts. So on your side you should not need to do any conversion. Was your data recorded using spikeglx or openephys?

For the 4 values per channel, I'm not sure I fully understand the question, but the probe plot basically shows the data on the individual channels as they are arranged on the neuropixel probe. Does that clear things up?

— Reply to this email directly, view it on GitHub https://github.com/int-brain-lab/iblapps/issues/119#issuecomment-2042386463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKCRY2LMNJ7MNEINBY7PTTY4JVZPAVCNFSM6AAAAABFUP3AR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBSGM4DMNBWGM . You are receiving this because you authored the thread.Message ID: @.***>

mayofaulkner commented 7 months ago

Hello,

Okay, let me know if you get to the bottom of the conversion issue.

For the probe plot display, each little rectangle represents an electrode on the shank. For the NP1.0 geometry, the electrodes are arranged in a checkerboard pattern with 96 rows (seperated by 20um) and 4 columns (seperated by 11um). This is basically what that plot is displaying. So the columns are the location of the electrodes in the x direction of the shank.