Added option to flip sync events and remove extra sync events. #2
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.
NP2.0 recordings on ephys rig 1 has opposite ON and OFF events on sync lines on Probe stream and NIDAQ stream, which is probably caused by a flipped sync line.
This is reflected by the distribution of difference between when first 'ON' sync event happens on these two lines: (Compare AP_start and NI_start), They are always around 500ms
And this difference goes away when we look at both 'ON' events and 'OFF' events
Other than correcting the hardware connection, to process older data, we need added one option to flip NI stream's sync events when the sync signal is flipped.
In addition, if number of sync events are not equal on two streams, one extra event will be removed from the stream with more events.
If relative time of first event on two streams are similar enough (<0.1s), the last event will be removed.
If they are far apart enough (>0.1, usually close to 1s), the first event will be removed.