Skip to content

Commit f976557

Browse files
authored
Merge pull request #4008 from h-mayorquin/allow_white_matter_gain
Allow white matter recording to pass gain_to_uV
2 parents fde7709 + 47e159e commit f976557

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

src/spikeinterface/extractors/matlabhelpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020

2121
class MatlabHelper:
22-
mode = "file"
2322
installation_mesg = (
2423
"To use the MATSortingExtractor install h5py and scipy: " "\n\n pip install h5py scipy\n\n"
2524
) # error message when not installed

src/spikeinterface/extractors/neoextractors/alphaomega.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class AlphaOmegaEventExtractor(NeoBaseEventExtractor):
7777
The folder path to the AlphaOmega events.
7878
"""
7979

80-
mode = "folder"
8180
NeoRawIOClass = "AlphaOmegaRawIO"
8281
handle_event_frame_directly = True
8382

src/spikeinterface/extractors/whitematterrecordingextractor.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,31 @@ class WhiteMatterRecordingExtractor(BinaryRecordingExtractor):
2424
A list of channel ids. If None, channel_ids = list(range(num_channels)).
2525
is_filtered : bool or None, default: None
2626
If True, the recording is assumed to be filtered. If None, `is_filtered` is not set.
27-
"""
27+
gain_to_uV : float | None, default: 0.190734863
28+
Micro-volt conversion factor (ADC count → µV).
29+
30+
Where to look
31+
-------------
32+
• **Head-stage files** (64 neural chan.):
33+
*settingsHeadstages.xml* →
34+
`<CHANNEL … voltsperbit="1.907348633e-7" />`
35+
→ 0.190 734 863 µV per count.
36+
37+
• **Analog-panel files** (32 aux chan., ±10 V range in our example):
38+
*settingsAnalogPanel.xml* →
39+
`<CHANNEL … voltsperbit="3.0517578125e-4" />`
40+
→ 305.175 781 µV per count.
2841
29-
mode = "file"
42+
Use the value from the corresponding XML file when loading data.
43+
If *gain_to_uV* is left as *None* the extractor assumes the
44+
head-stage constant (0.190734863 µV/bit). Different hardware
45+
ranges will have different *voltsperbit* numbers, so always double-check
46+
for your specific setup.
47+
"""
3048

3149
# Specific parameters for WhiteMatter format
3250
DTYPE = "int16"
33-
GAIN_TO_UV = 6.25e3 / 32768
51+
HEADSTAGE_GAIN_TO_UV = 0.190734863
3452
OFFSET_TO_UV = 0.0
3553
FILE_OFFSET = 8
3654
TIME_AXIS = 0
@@ -45,15 +63,19 @@ def __init__(
4563
num_channels: int,
4664
channel_ids: Optional[List] = None,
4765
is_filtered: Optional[bool] = None,
66+
gain_to_uV: Optional[float] = None,
4867
):
68+
69+
gain_to_uV = gain_to_uV if gain_to_uV is not None else self.HEADSTAGE_GAIN_TO_UV
70+
4971
super().__init__(
5072
file_paths=[file_path],
5173
sampling_frequency=sampling_frequency,
5274
num_channels=num_channels,
5375
dtype=self.DTYPE,
5476
time_axis=self.TIME_AXIS,
5577
file_offset=self.FILE_OFFSET,
56-
gain_to_uV=self.GAIN_TO_UV,
78+
gain_to_uV=gain_to_uV,
5779
offset_to_uV=self.OFFSET_TO_UV,
5880
is_filtered=is_filtered,
5981
channel_ids=channel_ids,
@@ -65,6 +87,7 @@ def __init__(
6587
"num_channels": num_channels,
6688
"channel_ids": channel_ids,
6789
"is_filtered": is_filtered,
90+
"gain_to_uV": gain_to_uV,
6891
}
6992

7093

0 commit comments

Comments
 (0)