Skip to content

Commit 08881ed

Browse files
committed
Revert to interpolation arg
1 parent 9d08768 commit 08881ed

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

tests/test_tf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_cov():
1515
def test_percentile():
1616
x = np.random.randn(10, 10)
1717
p = 20
18-
p_np = np.percentile(x, p, method='nearest')
18+
p_np = np.percentile(x, p, interpolation='nearest')
1919
p_t = torchstain.tf.utils.percentile(x, p)
2020

2121
np.testing.assert_almost_equal(p_np, p_t)

tests/test_torch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_cov():
2121
def test_percentile():
2222
x = np.random.randn(10, 10)
2323
p = 20
24-
p_np = np.percentile(x, p, method='nearest')
24+
p_np = np.percentile(x, p, interpolation='nearest')
2525
p_t = torchstain.torch.utils.percentile(torch.tensor(x), p)
2626

2727
np.testing.assert_almost_equal(p_np, p_t)

torchstain/tf/utils/percentile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def percentile(t: tf.Tensor, q: float) -> Union[int, float]:
77
88
CAUTION:
99
* Values are not interpolated, which corresponds to
10-
``numpy.percentile(..., method="nearest")``.
10+
``numpy.percentile(..., interpolation="nearest")``.
1111
1212
:param t: Input tensor.
1313
:param q: Percentile to compute, which must be between 0 and 100 inclusive.

torchstain/torch/utils/percentile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def percentile(t: torch.Tensor, q: float) -> Union[int, float]:
1111
CAUTION:
1212
* Needs PyTorch >= 1.1.0, as ``torch.kthvalue()`` is used.
1313
* Values are not interpolated, which corresponds to
14-
``numpy.percentile(..., method="nearest")``.
14+
``numpy.percentile(..., interpolation="nearest")``.
1515
1616
:param t: Input tensor.
1717
:param q: Percentile to compute, which must be between 0 and 100 inclusive.

0 commit comments

Comments
 (0)