From 91ce28cc1924d55e3ba5fa253835678f73294ec6 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Mon, 22 Jun 2026 11:23:21 +0200 Subject: [PATCH] fix: None dtype should be replaced by actual dtype in write_binary --- src/spikeinterface/core/time_series_tools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/spikeinterface/core/time_series_tools.py b/src/spikeinterface/core/time_series_tools.py index efdedc8282..50242dc0ee 100644 --- a/src/spikeinterface/core/time_series_tools.py +++ b/src/spikeinterface/core/time_series_tools.py @@ -62,6 +62,10 @@ def write_binary( if add_file_extension: file_path_list = [add_suffix(file_path, ["raw", "bin", "dat"]) for file_path in file_path_list] + # Resolve dtype to a concrete type. This is important because the (possibly None) dtype is + # passed to the workers, and `np.dtype(None)` resolves to float64, which would corrupt the output. + dtype = dtype if dtype is not None else time_series.get_dtype() + sample_size_bytes = time_series.get_sample_size_in_bytes(dtype=dtype) file_path_dict = {segment_index: file_path for segment_index, file_path in enumerate(file_path_list)}