Skip to content

Commit 3e4b9c0

Browse files
committed
fix mismatching nidaq and probe sync pulses
1 parent 41f1df3 commit 3e4b9c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ibllib/ephys/sync_probes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,18 @@ def version3B(ses_path, display=True, type=None, tol=2.5):
144144
assert(np.isclose(sync_nidq.times.size, sync_probe.times.size, rtol=0.1))
145145
except AssertionError:
146146
raise Neuropixel3BSyncFrontsNonMatching(f"{ses_path}")
147+
148+
# Find the indexes in case the sizes don't match
149+
sync_idx = np.min([sync_nidq.times.size, sync_probe.times.size])
150+
147151
# if the qc of the diff finds anomalies, do not attempt to smooth the interp function
148152
qcdiff = _check_diff_3b(sync_probe)
149153
if not qcdiff:
150154
qc_all = False
151155
type_probe = type or 'exact'
152156
else:
153157
type_probe = type or DEFAULT_TYPE
154-
timestamps, qc = sync_probe_front_times(sync_probe.times, sync_nidq.times, sr,
158+
timestamps, qc = sync_probe_front_times(sync_probe.times[:sync_idx], sync_nidq.times[:sync_idx], sr,
155159
display=display, type=type_probe, tol=tol)
156160
qc_all &= qc
157161
out_files.extend(_save_timestamps_npy(ef, timestamps, sr))

0 commit comments

Comments
 (0)