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 voltage conversion equations to Neuropixels DataFrame docs #367

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions OpenEphys.Onix1/NeuropixelsV1DataFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,25 @@ public NeuropixelsV1DataFrame(ulong[] clock, ulong[] hubClock, int[] frameCount,
/// Gets the spike-band data as a <see cref="Mat"/> object.
/// </summary>
/// <remarks>
/// Spike-band data has 384 rows (channels) with columns representing the samples acquired at 30 kHz. Each sample is a
/// 10-bit, offset binary value encoded as a <see cref="ushort"/>.
/// Spike-band data has 384 electrodes (rows) with columns representing the samples acquired at 30 kHz.
/// Each sample is a 10-bit, offset binary value encoded as a <see cref="ushort"/>. To convert to
/// microvolts, the following equation can be used:
/// <code>
/// V_electrode (uV) = 1171.875 uV / AP Gain × (ADC result – 512)
/// </code>
/// </remarks>
public Mat SpikeData { get; }

/// <summary>
/// Gets the LFP band data as a <see cref="Mat"/> object.
/// </summary>
/// <remarks>
/// LFP data has 32 rows (channels) with columns representing the samples acquired at 2.5 kHz. Each sample is a
/// 10-bit, offset binary value encoded as a <see cref="ushort"/>.
/// LFP-band data has 384 electrodes (rows) with columns representing the samples acquired at 2.5 kHz.
/// Each sample is a 10-bit, offset binary value encoded as a <see cref="ushort"/>. To convert to
/// microvolts, the following equation can be used:
/// <code>
/// V_electrode (uV) = 1171.875 uV / LFP Gain × (ADC result – 512)
/// </code>
/// </remarks>
public Mat LfpData { get; }
}
Expand Down
8 changes: 8 additions & 0 deletions OpenEphys.Onix1/NeuropixelsV2eBetaDataFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ public NeuropixelsV2eBetaDataFrame(ulong[] clock, ulong[] hubClock, Mat amplifie
/// <summary>
/// Gets the amplifier data array.
/// </summary>
/// <remarks>
/// Wide band (0.5 Hz - 10 kHz) electophysiology data array. Each element is a amplified sample from
/// 384 electrodes (rows) acquired at 30 kHz (columns). Each sample is a 14-bit, offset binary value
/// encoded as a <see cref="ushort"/>. To convert to microvolts, the following equation can be used:
/// <code>
/// V_electrode (uV) = 0.91553 uV × (ADC result – 8192)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equation I've been using is 1/80/pow(2,14)*1e6 = 0.7629 uV

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, not sure where I got my number from tbh.

/// </code>
/// </remarks>
public Mat AmplifierData { get; }

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions OpenEphys.Onix1/NeuropixelsV2eDataFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ public NeuropixelsV2eDataFrame(ulong[] clock, ulong[] hubClock, Mat amplifierDat
/// <summary>
/// Gets the amplifier data array.
/// </summary>
/// <remarks>
/// Wide band (0.5 Hz - 10 kHz) electophysiology data array. Each element is a amplified sample from
/// 384 electrodes (rows) acquired at 30 kHz (columns). Each sample is a 12-bit, offset binary value
/// encoded as a <see cref="ushort"/>. To convert to microvolts, the following equation can be used:
/// <code>
/// V_electrode (uV) = 2.44141 uV × (ADC result – 2048)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above...

1/80/pow(2,12)*1e6 = 3.05176 uV

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Volts per bit should be exactly 4x higher than for the beta probes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the 4x thing (14->12 bit) but I see this on the data sheet:

image

is it 80 or 100 for the public version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was confused about that as well – but I confirmed that there is exactly a 4x difference by putting beta and commercial probes in the same saline bath

/// </code>
/// </remarks>
public Mat AmplifierData { get; }

internal static unsafe ushort GetProbeIndex(oni.Frame frame)
Expand Down