Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion spikeinterface/extractors/extractorlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
MaxwellRecordingExtractor, read_maxwell, MaxwellEventExtractor, read_maxwell_event,
NixRecordingExtractor, read_nix,
SpikeGadgetsRecordingExtractor, read_spikegadgets,

BiocamRecordingExtractor, read_biocam,
)

# NWB sorting/recording/event
Expand Down
1 change: 1 addition & 0 deletions spikeinterface/extractors/neoextractors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
from .maxwell import MaxwellRecordingExtractor, read_maxwell, MaxwellEventExtractor, read_maxwell_event
from .nix import NixRecordingExtractor, read_nix
from .spikegadgets import SpikeGadgetsRecordingExtractor, read_spikegadgets
from .biocam import BiocamRecordingExtractor, read_biocam
47 changes: 47 additions & 0 deletions spikeinterface/extractors/neoextractors/biocam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import probeinterface as pi
from .neobaseextractor import NeoBaseRecordingExtractor, NeoBaseSortingExtractor


class BiocamRecordingExtractor(NeoBaseRecordingExtractor):
"""
Class for reading data from a Biocam file from 3Brain.

Based on neo.rawio.BiocamRawIO

Parameters
----------
file_path: str

stream_id: str or None

mea_pitch: float or None

electrode_width: float or None

"""
mode = 'file'
NeoRawIOClass = 'BiocamRawIO'

def __init__(self, file_path, stream_id=None, mea_pitch=None, electrode_width=None):
neo_kwargs = {'filename': str(file_path)}
NeoBaseRecordingExtractor.__init__(self, stream_id=stream_id, **neo_kwargs)

# load probe from probeinterface
probe_kwargs = {}
if mea_pitch is not None:
probe_kwargs["mea_pitch"] = mea_pitch
if electrode_width is not None:
probe_kwargs["electrode_width"] = electrode_width
probe = pi.read_3brain(file_path, **probe_kwargs)
self.set_probe(probe, in_place=True)
self.set_property("row", self.get_property("contact_vector")["row"])
self.set_property("col", self.get_property("contact_vector")["col"])
self._kwargs = dict(file_path=str(file_path), stream_id=stream_id, mea_pitch=mea_pitch)


def read_biocam(*args, **kwargs):
recording = BiocamRecordingExtractor(*args, **kwargs)
return recording


read_biocam.__doc__ = BiocamRecordingExtractor.__doc__
4 changes: 2 additions & 2 deletions spikeinterface/extractors/neoextractors/neobaseextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def __init__(self, stream_id=None, **neo_kwargs):

# check channel groups
chan_ids = signal_channels['id']
raw_dtypes = signal_channels['dtype']

sampling_frequency = self.neo_reader.get_signal_sampling_rate(stream_index=self.stream_index)
dtype = signal_channels['dtype'][0]
Expand All @@ -76,6 +75,7 @@ def __init__(self, stream_id=None, **neo_kwargs):

self.set_property('gain_to_uV', final_gains)
self.set_property('offset_to_uV', final_offsets)
self.set_property('channel_name', signal_channels["name"])

nseg = self.neo_reader.segment_count(block_index=0)
for segment_index in range(nseg):
Expand Down Expand Up @@ -160,7 +160,7 @@ def _auto_guess_sampling_frequency(self):
that signal it do not make sens to have spikes at 50kHz sample
when the sig is 10kHz.
neo handle this but not spieinterface

In neo spikes can have diffrents sampling rate than signals so conversion from
signals frames to times is format dependent
"""
Expand Down
9 changes: 9 additions & 0 deletions spikeinterface/extractors/tests/test_neoextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ class SpikeGadgetsRecordingTest(RecordingCommonTestSuite, unittest.TestCase):
]


@pytest.mark.skip(reason='Biocam not merged into neo yet')
class BiocamRecordingTest(RecordingCommonTestSuite, unittest.TestCase):
ExtractorClass = BiocamRecordingExtractor
downloads = ['biocam/biocam_hw3.0_fw1.6.brw']
entities = [
'biocam/biocam_hw3.0_fw1.6.brw'
]


if __name__ == '__main__':
#~ test = MearecRecordingTest()
# ~ test = MearecSortingTest()
Expand Down