-
Notifications
You must be signed in to change notification settings - Fork 237
Fix artifact removal padding logic #4245
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
Conversation
…actsRecordingSegment Previously artifacts would not be removed if the trigger was before `start_frame` but the blanking carried on beyond. Only tested on `zeros` mode.
Co-authored-by: Chris Halcrow <[email protected]>
| if pad is None: | ||
| mask = (self.triggers >= start_frame) & (self.triggers < end_frame) | ||
| else: | ||
| mask = (self.triggers >= start_frame - pad[1]) & (self.triggers < end_frame + pad[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| mask = (self.triggers >= start_frame - pad[1]) & (self.triggers < end_frame + pad[0]) | |
| mask = (self.triggers >= start_frame - pad[0]) & (self.triggers < end_frame + pad[1]) |
pad is defined as pad = [int(ms_before * fs / 1000), int(ms_after * fs / 1000)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong (tested it to be sure), this would fails if start_frame>trigger-pad[0] and pad[0]<pad[1].
It has to be this as in Chris' edit:
mask = (self.triggers >= start_frame - pad[1]) & (self.triggers < end_frame + pad[0])
One needs to look back for triggers before start_frame-pad[1] if start_frame is after a trigger time point (otherwise the trigger is just ignored), or ahead by end_frame - pad[0] if start_frame and end_frame areboth before a trigger.
alejoe91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhhennig see my comment
This fixes a bug in
RemoveArtifactsRecordingSegmentPreviously artifacts would not be removed if the trigger was before
start_framebut the blanking carried on beyond. Only tested onzerosmode.