File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pytest
22import numpy as np
33from pathlib import Path
4+ import pickle
45
56from spikeinterface .extractors import WhiteMatterRecordingExtractor , BinaryRecordingExtractor
67from spikeinterface .core .numpyextractors import NumpyRecording
8+ from spikeinterface .core .testing import check_recordings_equal
79from spikeinterface import get_global_dataset_folder , download_dataset
810
911
@@ -57,3 +59,22 @@ def test_on_data():
5759 assert recording .get_sampling_frequency () == sampling_frequency
5860 assert recording .get_num_channels () == num_channels
5961 assert recording .get_duration () == 1.0
62+
63+
64+ def test_pickling ():
65+ file_path = download_dataset (
66+ repo = gin_repo , remote_path = remote_path , local_folder = local_folder , update_if_exists = True
67+ )
68+
69+ sampling_frequency = 25_000.0
70+ num_channels = 64
71+ recording = WhiteMatterRecordingExtractor (
72+ file_path = file_path ,
73+ sampling_frequency = sampling_frequency ,
74+ num_channels = num_channels ,
75+ is_filtered = True ,
76+ )
77+ pickled_recording = pickle .dumps (recording )
78+ unpickled_recording = pickle .loads (pickled_recording )
79+
80+ check_recordings_equal (recording , unpickled_recording )
Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ def __init__(
5959 channel_ids = channel_ids ,
6060 )
6161
62+ self ._kwargs = {
63+ "file_path" : file_path ,
64+ "sampling_frequency" : sampling_frequency ,
65+ "num_channels" : num_channels ,
66+ "channel_ids" : channel_ids ,
67+ "is_filtered" : is_filtered ,
68+ }
69+
6270
6371# Define function equivalent for convenience
6472read_whitematter = define_function_from_class (source_class = WhiteMatterRecordingExtractor , name = "read_whitematter" )
You can’t perform that action at this time.
0 commit comments