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

Offen
#4,980 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend, data

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
883
Forks
291
Ø Merge
3 T. 17 Std.
Gemergte PRs (30 T.)
40

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus SpikeInterface/spikeinterface

Alle Issues in SpikeInterface/spikeinterface

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.