Fix hardcoded sample count in Intan RHD file reader#102
Merged
Conversation
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.
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
…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
| % | ||
| [filename,parentdir,isdirectory,fileMode] = intan_rhd_obj.filenamefromepochfiles(epochstreams); | ||
|
|
||
| if iscell(channeltype), |
| 'ndr:reader:intan_rhd:readchannels_epochsamples:HeterogeneousChannelTypes', ... | ||
| 'channeltype cell array must be uniform; intan_rhd reads one type per call.'); | ||
| channeltype = channeltype{1}; | ||
| end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
60withheader.fileinfo.num_samples_per_data_blockwhen calculating total samplesImplementation 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