Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved problem with tag set by HumSilencer #11

Open
Mijar007 opened this issue Jun 14, 2023 · 2 comments
Open

Solved problem with tag set by HumSilencer #11

Mijar007 opened this issue Jun 14, 2023 · 2 comments

Comments

@Mijar007
Copy link
Contributor

abfload runs into an error in line 860 if the HumSilencer of the Axon Digidata 1550B digitalizer was enabled during the recording using Clampex 11.2 (At least for episodic recordings).
The reason is that at the end of Part 3, the tags are assigned to the corresponding episodes based on their start time. However, while the HumSilencer tag was created at time 0, the first episode starts a bit later (~0.02 during a 10 kHz recording).
Therefore, the code runs into the condition, but the variable tmp remains empty, which is why it cannot be used for indexing in the next line, leading to an error.
So I added another condition which checks if the tag was created at time 0. If yes, it will be assigned to episode 0.
Here is my code snippet which replaces lines 857-862:

if ~isempty(h.tags) && isfield(h,'sweepStartInPts')
    for i=1:numel(h.tags)
        if h.tags(i).timeSinceRecStart > 0 %Comments added during recording
            tmp=find(h.tags(i).timeSinceRecStart>=h.sweepStartInPts/1e6*h.si);
            h.tags(i).episodeIndex=tmp(end);
        elseif h.tags(i).timeSinceRecStart == 0 %HumSilencer comment at timeSinceRecStart = 0
            h.tags(i).episodeIndex = 0; %Will be added to episode 0
        end
    end
end
@fcollman
Copy link
Owner

looks good! can you submit a PR?

@Mijar007
Copy link
Contributor Author

Thank you. I submitted a pull request.

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

No branches or pull requests

2 participants