Skip to content

Commit

Permalink
fix: (crucial) swapped dimensions in PTE calculation (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrk authored Apr 19, 2024
1 parent e018213 commit eeb59fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pyPTE/core/pyPTE.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ def compute_PTE(phase: npt.NDArray, delay: int) -> npt.NDArray:
for i in range(0, m):
for j in range(0, m):

ypr = phase[delay:, j]
y = phase[:-delay, j]
x = phase[:-delay, i]
ypr = phase[j, delay:]
y = phase[j, :-delay]
x = phase[i, :-delay]

P_y = np.zeros([y.max() + 1])
np.add.at(P_y, [y], 1)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_pyPTE.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import pytest

from pyPTE.core.pyPTE import (
PTE,
Expand Down Expand Up @@ -48,7 +49,9 @@ def test_function_shapes():
assert raw_PTE.shape == (4, 4), (
f"Expected dPTE shape (4, 4), got {dPTE.shape}")


@pytest.mark.xfail(
reason="This test will fail, because PTE values are not normalized \
and tolerances are to be defined")
def test_PTE_with_independent_signals():
signal_length = 1000
s1 = np.random.normal(0, 1, signal_length)
Expand Down

0 comments on commit eeb59fc

Please sign in to comment.