Repository navigation
Feature: support event extraction on the ABF format - #1961
Open
h-mayorquin wants to merge 2 commits into
Open
h-mayorquin wants to merge 2 commits into
h-mayorquin wants to merge 2 commits into
Conversation
Convert tag times with fSynchTimeUnit (or as samples of the interleaved data when it is 0), seek the ABF1 tag section in 512-byte blocks, use the comment as the label, give each tag type its own event channel and give each segment only the tags inside its sweep.
This branch has not been deployed
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.
Tags are the markers an experimenter adds to an Axon file during a recording, like a comment typed when a drug is washed on or a pulse from an external trigger. I checked how
AxonRawIOreads them against pyABF and against Clampex itself, and right now only version 2 gap-free files with one channel come out right. The current problems are:'1') instead of the comment.commentsannotation is theb'...'repr of the bytes.Tagchannel with an empty id, even in files without tags.This PR fixes all of this.
lTagTimecounts infSynchTimeUnitmicroseconds, or in samples of the interleaved data whenfSynchTimeUnitis 0 (this is whatABFHEADR.Hand the vendor library converterABFH_SynchCountToMSsay), and thet_startandt_stopwindow now uses the same conversion. For version 1 the reader multiplieslTagSectionPtrby the 512-byte block size before seeking. The comment is now the label, and each tag type present in the file gets its own event channel with the name and id from the header constants (time_tag,comment_tag,external_tag,voice_tag,new_file_tag,annotation_tag). Each segment gets only the tags inside its sweep, and a tag that falls between sweeps goes to no segment. I checked the times against pyABF on the 60 tagged files I have and they agree except for a version 1 file with 4 channels, where pyABF scales byfADCSampleInterval / nADCNumChannelsand gets half the time the header gives.This changes what users get: a file without tags has no event channel instead of an empty
Tagchannel, event channel 0 is the first tag type in the file, and thecommentsannotation is gone as the comment is the label now. I preferred to break this once instead of in several steps, and since the reader was right for one kind of file only there is little working behavior to keep. The test files were added to gin in https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/pulls/197. I also read the tag section with onenp.frombuffercall instead of a loop over the entries. The new code picks the tags of each type and each sweep with array masks and this needs each field as an array, not a list of dicts.