Skip to content

Commit 419e4f5

Browse files
committed
Merge branch 'fix/462-pixel-breath-cross-correlation'
2 parents 0e0c41c + a347128 commit 419e4f5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

eitprocessing/features/pixel_breath.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,18 @@ 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+
(
232+
f"Skipping pixel ({row}, {col}) because no cross correlation peak found. "
233+
"This may be due to unstable (pixel) impedance. "
234+
"This algorithm does not handle unstable impedance data well."
235+
),
236+
RuntimeWarning,
237+
stacklevel=2,
238+
)
239+
continue
228240
min_peak_distance = np.min(peak_distances)
229241
candidates = peak_lags[peak_distances == min_peak_distance]
230242

0 commit comments

Comments
 (0)