Repository navigation
Add check_identical_time_series and check_redundant_time_series_copies - #794
Open
bendichter wants to merge 2 commits into
Open
bendichter wants to merge 2 commits into
bendichter wants to merge 2 commits into
Conversation
…pies` Added `check_identical_time_series` and `check_redundant_time_series_copies`, which flag TimeSeries in one file that hold identical data. The first (CRITICAL) covers series of different kinds, such as a processed series identical to one in acquisition, and the second (BEST_PRACTICE_VIOLATION) covers redundant copies of the same kind, which should be stored once and linked. HDF5 links to the same dataset are not reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #794 +/- ##
==========================================
+ Coverage 86.46% 88.24% +1.78%
==========================================
Files 48 49 +1
Lines 2046 2246 +200
==========================================
+ Hits 1769 1982 +213
+ Misses 277 264 -13
🚀 New features to boost your workflow:
|
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.
Motivation
Before: two TimeSeries in one file can hold identical data without the inspector noticing. Sometimes this is a wrong-data bug, such as an LFP that is really the raw signal written again, and sometimes it is a redundant copy that should have been a link.
After: two checks share one comparison.
check_identical_time_series(CRITICAL) covers identical series of different kinds: a processed series identical to one inacquisition, different neurodata types or units, or two constant event-like series that share explicit timestamps under different names.check_redundant_time_series_copies(BEST_PRACTICE_VIOLATION) covers identical series of the same kind, which are more often redundant copies.The cases come from our Encore project: a reward series identical to a lick series in 000231, and LFP identical to the acquisition signal in 001539 and 000447 (Encore findings for 000231, 001539 and 000447). An example of the second check is 000041, where
UPDecompositionSeriesandSpindleDecompositionSeriesare identical and both descriptions say channel 13.How
Series are grouped by data shape and dtype, so most pairs never read data. Candidates are then compared on a hash of a 64 KB block at the start, and only series that agree there are hashed in full (up to 32 MB) or on five sampled 1 MB blocks, in which case the message says so. The grouping is computed once per file and cached for the second check. Pairs whose data are the same HDF5 object (a link) are not reported, nor are constant data on a rate-based time base, such as two empty channels.
The two checks have different importance because the same finding can mean different things, and I could not find a cleaner way to express that than splitting by whether the two series are of the same kind.
This is one of seven PRs split out of a single draft that added checks for data stored twice within one NWB file. Each PR stands on its own and branches off
dev. They all carry the same copy of a small helper module,utils/_comparison.py(shape and dtype without reading, hashing, sampling blocks of large datasets, counting repeats), so that they can be reviewed and merged in any order. Git merges the identical copies cleanly, and I checked that all seven merge together without conflicts and that the full test suite passes on the result.Testing
tests/unit_tests/test_identical_time_series.pycovers both checks, a link that should not be reported, and the sampled path. On the DANDI files I streamed for the original draft, the CRITICAL check fired on all files in 000231, 001539 and 000447, and the BEST_PRACTICE_VIOLATION check on the Watson files in 000041. The Watson files are the slowest case, at about 25 s each when streamed, mostly hashing sampled blocks of two 1.5 GB series.🤖 Generated with Claude Code