Skip to content

Commit dc5b1f1

Browse files
committed
Skip pixel if no cross correlation peak was found
1 parent 4552cd7 commit dc5b1f1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

eitprocessing/features/pixel_breath.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ def find_pixel_breaths( # noqa: C901, PLR0912, PLR0915
225225
# find the closest peak to zero lag
226226
peak_lags = lags[lag_range][peaks]
227227
peak_distances = np.abs(peak_lags)
228+
if len(peak_distances) == 0:
229+
# no peaks found, skip pixel
230+
warnings.warn(
231+
f"Skipping pixel ({row}, {col}) because no cross correlation peak found.",
232+
RuntimeWarning,
233+
stacklevel=2,
234+
)
235+
continue
228236
min_peak_distance = np.min(peak_distances)
229237
candidates = peak_lags[peak_distances == min_peak_distance]
230238

0 commit comments

Comments
 (0)