Skip to content

Fix read_mclust returning zero units for .t files#4626

Merged
alejoe91 merged 2 commits into
SpikeInterface:mainfrom
h-mayorquin:fix_mclust_t_file_reading
Jun 25, 2026
Merged

Fix read_mclust returning zero units for .t files#4626
alejoe91 merged 2 commits into
SpikeInterface:mainfrom
h-mayorquin:fix_mclust_t_file_reading

Conversation

@h-mayorquin

Copy link
Copy Markdown
Collaborator

Two bugs in MClustSortingExtractor made read_mclust silently return a sorting with zero units for plain .t files (reported in #4602). First, the extension search relied on the truthiness of Path.glob(...), which returns a generator and is therefore always truthy, so the format was always detected as t64 regardless of which files were present; materializing the glob with sorted(...) makes the check reflect what is actually on disk. Second, MClust 3.x writes big-endian uint64 timestamps into the plain .t suffix while the reader assigns uint32 to any non-64 extension, so each 64-bit value was read as two 32-bit words; dropping the zero high words (only for the t family read as uint32) recovers the timestamps, matching the community reference loader.

Closes #4602.

@h-mayorquin h-mayorquin self-assigned this Jun 24, 2026
@h-mayorquin h-mayorquin added the bug Something isn't working label Jun 24, 2026
@h-mayorquin h-mayorquin requested a review from alejoe91 June 24, 2026 23:49

@alejoe91 alejoe91 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thasnk @h-mayorquin !!!

@alejoe91 alejoe91 merged commit 8640030 into SpikeInterface:main Jun 25, 2026
15 checks passed
@alejoe91 alejoe91 added the extractors Related to extractors module label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working extractors Related to extractors module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_mclust returns zero units for .t files (extension never detected; uint64 .t misread)

2 participants