Skip to content

Commit

Permalink
fix: adjust zero-crossing detection: shift by 1, include all data poi…
Browse files Browse the repository at this point in the history
…nts (#19)
  • Loading branch information
patrk authored Apr 5, 2024
1 parent aac8222 commit 4f9d2b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyPTE/core/pyPTE.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def get_delay(phase: npt.NDArray) -> int:
"""
phase = phase
m, n = phase.shape
c1 = n * (m - 2)
r_phase = np.roll(phase, 2, axis=0)
phase_product = np.multiply(phase, r_phase)[1:-1]
c1 = n * m
r_phase = np.roll(phase, 1, axis=0)
phase_product = np.multiply(phase, r_phase)
c2 = (phase_product < 0).sum()
delay = int(np.round(c1 / c2))

Expand Down

0 comments on commit 4f9d2b4

Please sign in to comment.