Skip to content

Commit 70ddd5a

Browse files
committed
Add stage property
1 parent ba8ed5c commit 70ddd5a

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

eitprocessing/datahandling/pixelmap.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ def __init__(
198198

199199
object.__setattr__(self, "plot_parameters", plot_parameters)
200200

201+
@property
202+
def shape(self) -> tuple[int, int]:
203+
"""Get the shape of the pixel map values."""
204+
return self.values.shape
205+
201206
def normalize(
202207
self,
203208
*,

tests/test_pixelmap.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ def test_init_values():
4040
pm.values = [[1]]
4141

4242

43+
def test_shape_property():
44+
pm = PixelMap([[0]])
45+
assert pm.shape == (1, 1)
46+
47+
pm = PixelMap(np.ones((2, 3)))
48+
assert pm.shape == (2, 3)
49+
50+
pm = PendelluftMap([[0, 1], [2, 3]])
51+
assert pm.shape == (2, 2)
52+
53+
pm = SignedPendelluftMap([[0, -1], [-2, -3]])
54+
assert pm.shape == (2, 2)
55+
56+
4357
def test_init_negative_values():
4458
with pytest.warns(UserWarning, match="PendelluftMap initialized with negative values"):
4559
_ = PendelluftMap([[0, -1], [-2, -3]])

0 commit comments

Comments
 (0)