AllenNeuralDynamics / AllenNeuralDynamics/aind-ephys-preprocessing

Preprocessing capsule fails with TypeError when zarr NWB stores starting_time as a 1-d array

Aberta
#33 3 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
2
Forks
3
Merge médio
1min
PRs com merge (30d)
1

Descrição

Hi,
I'm getting an error with the preprocessing capsule when saving preprocessed data, if the input NWB file was written by `hdmf_zarr` with `starting_time` stored as a shape-(1,) array rather than a true scalar. The failure occurs deep in `SpikeInterface's BinaryRecordingExtractor.__init__`:

> "TypeError: only 0-dimensional arrays can be converted to Python scalars"

### Technical Context:
- Pipeline: aind-ephys-pipeline (revision `07b42a1a04`)
- Capsule: aind-ephys-preprocessing (commit 6a093b1)
- Container: `ghcr.io/allenneuraldynamics/aind-ephys-preprocessing:si-0.103.2`
- SpikeInterface version: 0.103.2
- Input format: Zarr-backed NWB (.nwb read via SI's zarr NWB backend)

### Issue Details
The zarr NWB backend reads starting_time from the zarr store using:
```
# spikeinterface/extractors/nwbextractors.py
t_start = electrical_series["starting_time"][()]
```
When hdmf_zarr writes an NWB file, it marks scalar fields with a zarr_dtype: scalar attribute, but older versions of the library (present in the si-0.103.2 container) do not honor this attribute on read. As a result, [()] returns a numpy ndarray of shape (1,) instead of a 0-d array or Python float.

This propagates to recording_processed.save(), which internally constructs a BinaryRecordingExtractor and calls:
```
# spikeinterface/core/binaryrecordingextractor.py, line 84
t_starts = [float(t_start) for t_start in t_starts]
```
Python's built-in float() raises a TypeError for any array with ndim >= 1.

Full traceback:
```
File "capsule/code/run_capsule.py", line 469, in
recording_bin = recording_processed.save(folder=preprocessing_output_folder)
File ".../spikeinterface/core/base.py", line 865, in save
loaded_extractor = self.save_to_folder(**kwargs)
File ".../spikeinterface/core/base.py", line 972, in save_to_folder
cached = self._save(folder=folder, verbose=verbose, **save_kwargs)
File ".../spikeinterface/core/baserecording.py", line 595, in _save
binary_rec = BinaryRecordingExtractor(
File ".../spikeinterface/core/binaryrecordingextractor.py", line 84, in __init__
t_starts = [float(t_start) for t_start in t_starts]
File ".../spikeinterface/core/binaryrecordingextractor.py", line 84, in
t_starts = [float(t_start) for t_start in t_starts]
TypeError: only 0-dimensional arrays can be converted to Python scalars
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.