Skip to content

Fix hardcoded sample count in Intan RHD file reader#102

Merged
stevevanhooser merged 3 commits into
mainfrom
claude/fix-intan-file-type-zXQTj
May 10, 2026
Merged

Fix hardcoded sample count in Intan RHD file reader#102
stevevanhooser merged 3 commits into
mainfrom
claude/fix-intan-file-type-zXQTj

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Summary

Updated the Intan RHD file reader to use the actual samples-per-block value from the file header instead of a hardcoded constant when calculating total samples.

Key Changes

  • Replaced hardcoded value 60 with header.fileinfo.num_samples_per_data_block when calculating total samples
  • This allows the reader to correctly handle Intan RHD files with different data block configurations

Implementation Details

The change ensures that the total sample count calculation is dynamic and based on the actual file header information rather than assuming a fixed 60 samples per data block. This makes the code more robust and compatible with various Intan RHD file formats.

https://claude.ai/code/session_01NxdzGAgrpo8tJE1J4PY6XJ

Intan v2+ RHD files use 128 samples per data block (only v1 uses 60),
so the hardcoded 60 in intan_rhd.t0_t1 undercounted the epoch duration
by a factor of 60/128 on v2+ recordings. Pull the value from
header.fileinfo.num_samples_per_data_block, matching what
read_Intan_RHD2000_datafile already does.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

Test Results

128 tests  ±0   128 ✅ ±0   5s ⏱️ ±0s
 16 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit dc1ee9a. ± Comparison against base commit a06afbc.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 34.23%. Comparing base (a06afbc) to head (4e99882).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #102   +/-   ##
=======================================
  Coverage   34.23%   34.23%           
=======================================
  Files          94       94           
  Lines        4927     4927           
=======================================
  Hits         1687     1687           
  Misses       3240     3240           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…samples

Other ndr readers (neuropixelsGLX, axon_abf, tdt_sev) and ndr.reader's own
readevents_epochsamples internals pass cell arrays of identical channel-type
strings down to readchannels_epochsamples. intan_rhd previously assumed a
scalar string, which crashed the switch in mfdaqchanneltype2intanchanneltype
when called via the NDI probe path with one entry per channel.

https://claude.ai/code/session_01NxdzGAgrpo8tJE1J4PY6XJ
Comment thread +ndr/+reader/intan_rhd.m
%
[filename,parentdir,isdirectory,fileMode] = intan_rhd_obj.filenamefromepochfiles(epochstreams);

if iscell(channeltype),
Comment thread +ndr/+reader/intan_rhd.m
'ndr:reader:intan_rhd:readchannels_epochsamples:HeterogeneousChannelTypes', ...
'channeltype cell array must be uniform; intan_rhd reads one type per call.');
channeltype = channeltype{1};
end;
@stevevanhooser stevevanhooser merged commit 7ec372f into main May 10, 2026
@stevevanhooser stevevanhooser deleted the claude/fix-intan-file-type-zXQTj branch May 10, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants