Skip to content

Commit a0a3bef

Browse files
authored
Merge pull request NeuralEnsemble#1363 from guptadivyansh/gainfix
Gain calculation for Neuropixel 2.0 might be wrong
2 parents e023577 + 7b1074b commit a0a3bef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

neo/rawio/spikeglxrawio.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,12 @@ def extract_stream_info(meta_file, meta):
408408
# https://github.com/billkarsh/SpikeGLX/blob/15ec8898e17829f9f08c226bf04f46281f106e5f/Markdown/Metadata_30.md#imec
409409
# We allow also LF streams for NP2.0 because CatGT can produce them
410410
# See: https://github.com/SpikeInterface/spikeinterface/issues/1949
411-
per_channel_gain[:-1] = 1 / 80.
412-
gain_factor = float(meta['imAiRangeMax']) / 8192
411+
if 'imChan0apGain' in meta:
412+
per_channel_gain[:-1] = 1 / float(meta['imChan0apGain'])
413+
else:
414+
per_channel_gain[:-1] = 1 / 80.
415+
max_int = int(meta['imMaxInt']) if 'imMaxInt' in meta else 8192
416+
gain_factor = float(meta['imAiRangeMax']) / max_int
413417
channel_gains = gain_factor * per_channel_gain * 1e6
414418
else:
415419
raise NotImplementedError('This meta file version of spikeglx'

0 commit comments

Comments
 (0)