Skip to content

Commit b2b9b10

Browse files
committed
black
1 parent 874cd3c commit b2b9b10

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

fastplotlib/graphics/features/_image.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class TextureArray(GraphicFeature):
1919
2020
Creates multiple pygfx.Texture objects based on the GPU's max texture dimension limit.
2121
"""
22+
2223
event_info_spec = [
2324
{
2425
"dict key": "key",
@@ -68,12 +69,14 @@ def __init__(self, data, dim: int, isolated_buffer: bool = True):
6869
# data start indices for each Texture
6970
self._row_indices = np.arange(
7071
0,
71-
ceil(self.value.shape[0] / self._texture_size_limit) * self._texture_size_limit,
72+
ceil(self.value.shape[0] / self._texture_size_limit)
73+
* self._texture_size_limit,
7274
self._texture_size_limit,
7375
)
7476
self._col_indices = np.arange(
7577
0,
76-
ceil(self.value.shape[1] / self._texture_size_limit) * self._texture_size_limit,
78+
ceil(self.value.shape[1] / self._texture_size_limit)
79+
* self._texture_size_limit,
7780
self._texture_size_limit,
7881
)
7982

@@ -82,17 +85,16 @@ def __init__(self, data, dim: int, isolated_buffer: bool = True):
8285
if self._dim == 3:
8386
self._zdim_indices = np.arange(
8487
0,
85-
ceil(self.value.shape[2] / self._texture_size_limit) * self._texture_size_limit,
88+
ceil(self.value.shape[2] / self._texture_size_limit)
89+
* self._texture_size_limit,
8690
self._texture_size_limit,
8791
)
8892
shape += [self.zdim_indices.size]
8993
else:
9094
self._zdim_indices = np.empty(0)
9195

9296
# buffer will be an array of textures
93-
self._buffer: np.ndarray[pygfx.Texture] = np.empty(
94-
shape=shape, dtype=object
95-
)
97+
self._buffer: np.ndarray[pygfx.Texture] = np.empty(shape=shape, dtype=object)
9698

9799
self._iter = None
98100

@@ -152,9 +154,15 @@ def _fix_data(self, data):
152154

153155
def __iter__(self):
154156
if self._dim == 2:
155-
self._iter = product(enumerate(self.row_indices), enumerate(self.col_indices))
157+
self._iter = product(
158+
enumerate(self.row_indices), enumerate(self.col_indices)
159+
)
156160
elif self._dim == 3:
157-
self._iter = product(enumerate(self.row_indices), enumerate(self.col_indices), enumerate(self.zdim_indices))
161+
self._iter = product(
162+
enumerate(self.row_indices),
163+
enumerate(self.col_indices),
164+
enumerate(self.zdim_indices),
165+
)
158166

159167
return self
160168

@@ -172,7 +180,11 @@ def __next__(self) -> tuple[pygfx.Texture, tuple[int, int], tuple[slice, slice]]
172180
if self._dim == 2:
173181
(chunk_row, data_row_start), (chunk_col, data_col_start) = next(self._iter)
174182
elif self._dim == 3:
175-
(chunk_row, data_row_start), (chunk_col, data_col_start), (chunk_z, data_z_start) = next(self._iter)
183+
(
184+
(chunk_row, data_row_start),
185+
(chunk_col, data_col_start),
186+
(chunk_z, data_z_start),
187+
) = next(self._iter)
176188

177189
# indices for to self.buffer for this chunk
178190
chunk_index = [chunk_row, chunk_col]

fastplotlib/graphics/image_volume.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,22 @@ class ImageVolumeGraphic(Graphic):
8282
}
8383

8484
def __init__(
85-
self,
86-
data: Any,
87-
mode: str = "ray",
88-
vmin: int = None,
89-
vmax: int = None,
90-
cmap: str = "plasma",
91-
interpolation: str = "nearest",
92-
cmap_interpolation: str = "linear",
93-
isolated_buffer: bool = True,
94-
**kwargs,
85+
self,
86+
data: Any,
87+
mode: str = "ray",
88+
vmin: int = None,
89+
vmax: int = None,
90+
cmap: str = "plasma",
91+
interpolation: str = "nearest",
92+
cmap_interpolation: str = "linear",
93+
isolated_buffer: bool = True,
94+
**kwargs,
9595
):
9696
valid_modes = ["basic", "ray", "slice", "iso", "mip", "minip"]
9797
if mode not in valid_modes:
98-
raise ValueError(f"invalid mode specified: {mode}, valid modes are: {valid_modes}")
98+
raise ValueError(
99+
f"invalid mode specified: {mode}, valid modes are: {valid_modes}"
100+
)
99101

100102
super().__init__(**kwargs)
101103

fastplotlib/layouts/_graphic_methods_mixin.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def add_image(
3232
interpolation: str = "nearest",
3333
cmap_interpolation: str = "linear",
3434
isolated_buffer: bool = True,
35-
**kwargs
35+
**kwargs,
3636
) -> ImageGraphic:
3737
"""
3838
@@ -78,7 +78,7 @@ def add_image(
7878
interpolation,
7979
cmap_interpolation,
8080
isolated_buffer,
81-
**kwargs
81+
**kwargs,
8282
)
8383

8484
def add_image_volume(
@@ -91,7 +91,7 @@ def add_image_volume(
9191
interpolation: str = "nearest",
9292
cmap_interpolation: str = "linear",
9393
isolated_buffer: bool = True,
94-
**kwargs
94+
**kwargs,
9595
) -> ImageVolumeGraphic:
9696
"""
9797
None
@@ -106,7 +106,7 @@ def add_image_volume(
106106
interpolation,
107107
cmap_interpolation,
108108
isolated_buffer,
109-
**kwargs
109+
**kwargs,
110110
)
111111

112112
def add_line_collection(
@@ -124,7 +124,7 @@ def add_line_collection(
124124
metadatas: Union[Sequence[Any], numpy.ndarray] = None,
125125
isolated_buffer: bool = True,
126126
kwargs_lines: list[dict] = None,
127-
**kwargs
127+
**kwargs,
128128
) -> LineCollection:
129129
"""
130130
@@ -197,7 +197,7 @@ def add_line_collection(
197197
metadatas,
198198
isolated_buffer,
199199
kwargs_lines,
200-
**kwargs
200+
**kwargs,
201201
)
202202

203203
def add_line(
@@ -211,7 +211,7 @@ def add_line(
211211
cmap_transform: Union[numpy.ndarray, Iterable] = None,
212212
isolated_buffer: bool = True,
213213
size_space: str = "screen",
214-
**kwargs
214+
**kwargs,
215215
) -> LineGraphic:
216216
"""
217217
@@ -262,7 +262,7 @@ def add_line(
262262
cmap_transform,
263263
isolated_buffer,
264264
size_space,
265-
**kwargs
265+
**kwargs,
266266
)
267267

268268
def add_line_stack(
@@ -281,7 +281,7 @@ def add_line_stack(
281281
separation: float = 10.0,
282282
separation_axis: str = "y",
283283
kwargs_lines: list[dict] = None,
284-
**kwargs
284+
**kwargs,
285285
) -> LineStack:
286286
"""
287287
@@ -362,7 +362,7 @@ def add_line_stack(
362362
separation,
363363
separation_axis,
364364
kwargs_lines,
365-
**kwargs
365+
**kwargs,
366366
)
367367

368368
def add_scatter(
@@ -377,7 +377,7 @@ def add_scatter(
377377
sizes: Union[float, numpy.ndarray, Iterable[float]] = 1,
378378
uniform_size: bool = False,
379379
size_space: str = "screen",
380-
**kwargs
380+
**kwargs,
381381
) -> ScatterGraphic:
382382
"""
383383
@@ -437,7 +437,7 @@ def add_scatter(
437437
sizes,
438438
uniform_size,
439439
size_space,
440-
**kwargs
440+
**kwargs,
441441
)
442442

443443
def add_text(
@@ -450,7 +450,7 @@ def add_text(
450450
screen_space: bool = True,
451451
offset: tuple[float] = (0, 0, 0),
452452
anchor: str = "middle-center",
453-
**kwargs
453+
**kwargs,
454454
) -> TextGraphic:
455455
"""
456456
@@ -501,5 +501,5 @@ def add_text(
501501
screen_space,
502502
offset,
503503
anchor,
504-
**kwargs
504+
**kwargs,
505505
)

0 commit comments

Comments
 (0)