read_tdt / TdtRawIO: stitched TDT blocks with time gaps lose their gaps and timing, float32 streams are mislabeled as µV with gain 1, and SEV-flagged stores without .sev files block opening

Aperta
#4,980 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, data

Direzione di ricerca

Start with read_tdt and Neo’s TdtRawIO in neo/rawio/tdtrawio.py, especially the header parsing and timestamp handling described in the report. Reproduce the four failures with the supplied environment and compare stitched-block timing and float32 values against the tdt package. Done means blocks without .Tdx open or produce a clear error, gaps retain correct timing, float32 units are reported correctly, and a missing .sev store does not prevent reading the requested stream.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment: spikeinterface 0.106.0, neo 0.14.6 (also checked neo 0.13.4), numpy 2.4.6, Python 3.11, macOS. The reference reader is the tdt package 0.7.6.

Context: I record a single session as several TDT blocks and concatenate them into one stitched block, so the stitched block's .tsq/.tev hold the chunks of every source block with their original timestamps, including long real-time gaps between blocks. I tested whether si.read_tdt can read the stitched block directly in place of my own binary writer. The data are 32-channel float32 streams at 12,207.03125 Hz, and the stores report Scale: Unity in TDT's StoresListing.

1. A block without a .Tdx file fails with an IndexError

UserWarning: Could not find any data set belonging to .../rec0
  File ".../neo/rawio/tdtrawio.py", line 193, in _parse_header
    self._global_t_start = self._seg_t_starts[0]
IndexError: list index out of range

A block made outside Synapse may have .tsq/.tev but no .Tdx. Adding an empty .Tdx (through a symlink view) makes it open. Expected behavior: open from .tsq/.tev alone, or raise a clear error that names the missing file.

2. Time gaps inside a block are dropped and the time axis is wrong after each gap
When the .tsq chunk timestamps jump (here by 134.854 s and 4,290.876 s), TdtRawIO reports one segment and simply concatenates the chunks: 141,986,816 samples (11,631.56 s), when the timestamps span 15,922.39 s. Every sample after a jump has the wrong time, early by exactly the gap length. The samples themselves are bit-identical to the tdt package's (max abs diff 0.0). Expected behavior: split into segments at timestamp discontinuities larger than one chunk (each with the correct t_start), or at least warn. Opening the parent tank folder of the unstitched source blocks gives correct segments and t_start values.

3. Float32 streams are labeled µV with gain 1, but the values are volts
TdtRawIO hard-codes units "uV", gain 1.0 and offset 0.0. For these stores (Scale: Unity, float32), the values are volts, so the reported µV are wrong by exactly 1e6, which silently affects amplitude-based metrics and thresholds. Expected behavior: report units V (gain 1e6 to µV), or read the store's scale/format.

4. neo 0.14.6 refuses to open a block where an unused store is flagged as SEV-mode but has no .sev files
A block whose eye-tracker store eyeL is flagged SEV in the .tsq with no .sev files present fails to open in neo 0.14.6, even when only the RAW stream is requested. neo 0.13.4 opens the same block, and its samples match the reference reader. Expected behavior: skip or warn on that store, not refuse the whole block.

I can share small .tsq/StoresListing excerpts or a reproducer script if that helps. Issues 1, 3 and 4 may belong in python-neo (TdtRawIO); I'm filing here first because I hit them through read_tdt. Happy to move or cross-post them.

Lingua principale
Python
Stelle
883
Fork
291
Merge medio
3g 17h
PR unite (30g)
40

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SpikeInterface/spikeinterface

Tutte le issue di SpikeInterface/spikeinterface

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.