Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0f80c6

Browse files
authored
update comments for image data shapes (#668)
1 parent 7a0e40f commit f0f80c6

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

fastplotlib/graphics/_features/_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _fix_data(self, data):
9494
if data.ndim not in (2, 3):
9595
raise ValueError(
9696
"image data must be 2D with or without an RGB(A) dimension, i.e. "
97-
"it must be of shape [x, y], [x, y, 3] or [x, y, 4]"
97+
"it must be of shape [rows, cols], [rows, cols, 3] or [rows, cols, 4]"
9898
)
9999

100100
# let's just cast to float32 always

fastplotlib/graphics/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
----------
9292
data: array-like
9393
array-like, usually numpy.ndarray, must support ``memoryview()``
94-
| shape must be ``[x_dim, y_dim]``
94+
| shape must be ``[n_rows, n_cols]``, ``[n_rows, n_cols, 3]`` for RGB or ``[n_rows, n_cols, 4]`` for RGBA
9595
9696
vmin: int, optional
9797
minimum value for color scaling, calculated from data if not provided

fastplotlib/widgets/image_widget/_widget.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
from ._sliders import ImageWidgetSliders
1313

1414

15-
# Number of dimensions that represent one image/one frame. For grayscale shape will be [x, y], i.e. 2 dims, for RGB(A)
16-
# shape will be [x, y, c] where c is of size 3 (RGB) or 4 (RGBA)
15+
# Number of dimensions that represent one image/one frame
16+
# For grayscale shape will be [n_rows, n_cols], i.e. 2 dims
17+
# For RGB(A) shape will be [n_rows, n_cols, c] where c is of size 3 (RGB) or 4 (RGBA)
1718
IMAGE_DIM_COUNTS = {"gray": 2, "rgb": 3}
1819

1920
# Map boolean (indicating whether we use RGB or grayscale) to the string. Used to index RGB_DIM_MAP
@@ -162,7 +163,7 @@ def ndim(self) -> int:
162163
def n_scrollable_dims(self) -> list[int]:
163164
"""
164165
list indicating the number of dimenensions that are scrollable for each data array
165-
All other dimensions are frame/image data, i.e. [x, y] or [x, y, c]
166+
All other dimensions are frame/image data, i.e. [rows, cols] or [rows, cols, rgb(a)]
166167
"""
167168
return self._n_scrollable_dims
168169

0 commit comments

Comments
 (0)