Skip to content

Commit ada0dbe

Browse files
committed
black
1 parent 30d3f85 commit ada0dbe

File tree

3 files changed

+57
-34
lines changed

3 files changed

+57
-34
lines changed

fastplotlib/graphics/_axes.py

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def infinite(self, value: str):
112112

113113
class Grids(pygfx.Group):
114114
"""Just a class to make accessing the grids easier"""
115+
115116
def __init__(self, *, xy, xz, yz):
116117
super().__init__()
117118

@@ -241,16 +242,16 @@ def define_text(pos, text):
241242

242243
class Axes:
243244
def __init__(
244-
self,
245-
plot_area,
246-
intersection: tuple[int, int, int] | None = None,
247-
x_kwargs: dict = None,
248-
y_kwargs: dict = None,
249-
z_kwargs: dict = None,
250-
grids: bool = True,
251-
grid_kwargs: dict = None,
252-
auto_grid: bool = True,
253-
offset: np.ndarray = np.array([0., 0., 0.])
245+
self,
246+
plot_area,
247+
intersection: tuple[int, int, int] | None = None,
248+
x_kwargs: dict = None,
249+
y_kwargs: dict = None,
250+
z_kwargs: dict = None,
251+
grids: bool = True,
252+
grid_kwargs: dict = None,
253+
auto_grid: bool = True,
254+
offset: np.ndarray = np.array([0.0, 0.0, 0.0]),
254255
):
255256
self._plot_area = plot_area
256257

@@ -268,10 +269,7 @@ def __init__(
268269
**x_kwargs,
269270
}
270271

271-
y_kwargs = {
272-
"tick_side": "left",
273-
**y_kwargs
274-
}
272+
y_kwargs = {"tick_side": "left", **y_kwargs}
275273

276274
z_kwargs = {
277275
"tick_side": "left",
@@ -290,12 +288,16 @@ def __init__(
290288
self.x.start_pos = 0, 0, 0
291289
self.x.end_pos = 100, 0, 0
292290
self.x.start_value = self.x.start_pos[0] - offset[0]
293-
statsx = self.x.update(self._plot_area.camera, self._plot_area.viewport.logical_size)
291+
statsx = self.x.update(
292+
self._plot_area.camera, self._plot_area.viewport.logical_size
293+
)
294294

295295
self.y.start_pos = 0, 0, 0
296296
self.y.end_pos = 0, 100, 0
297297
self.y.start_value = self.y.start_pos[1] - offset[1]
298-
statsy = self.y.update(self._plot_area.camera, self._plot_area.viewport.logical_size)
298+
statsy = self.y.update(
299+
self._plot_area.camera, self._plot_area.viewport.logical_size
300+
)
299301

300302
self.z.start_pos = 0, 0, 0
301303
self.z.end_pos = 0, 0, 100
@@ -327,7 +329,7 @@ def __init__(
327329
"major_thickness": 2,
328330
"minor_thickness": 0.5,
329331
"infinite": True,
330-
**grid_kwargs
332+
**grid_kwargs,
331333
}
332334

333335
if grids:
@@ -427,7 +429,9 @@ def intersection(self, intersection: tuple[float, float, float] | None):
427429
return
428430

429431
if len(intersection) != 3:
430-
raise ValueError("intersection must be a float of 3 elements for [x, y, z] or `None`")
432+
raise ValueError(
433+
"intersection must be a float of 3 elements for [x, y, z] or `None`"
434+
)
431435

432436
self._intersection = tuple(float(v) for v in intersection)
433437

@@ -493,10 +497,12 @@ def update_using_camera(self):
493497

494498
world_zmin, world_zmax = 0, 0
495499

496-
bbox = np.array([
497-
[world_xmin, world_ymin, world_zmin],
498-
[world_xmax, world_ymax, world_zmax]
499-
])
500+
bbox = np.array(
501+
[
502+
[world_xmin, world_ymin, world_zmin],
503+
[world_xmax, world_ymax, world_zmax],
504+
]
505+
)
500506

501507
else:
502508
# set ruler start and end positions based on scene bbox
@@ -507,7 +513,9 @@ def update_using_camera(self):
507513
# place the ruler close to the left and bottom edges of the viewport
508514
# TODO: determine this for perspective projections
509515
xscreen_10, yscreen_10 = xpos + (width * 0.1), ypos + (height * 0.9)
510-
intersection = self._plot_area.map_screen_to_world((xscreen_10, yscreen_10))
516+
intersection = self._plot_area.map_screen_to_world(
517+
(xscreen_10, yscreen_10)
518+
)
511519
else:
512520
# force origin since None is not supported for Persepctive projections
513521
self._intersection = (0, 0, 0)
@@ -554,20 +562,26 @@ def update(self, bbox, intersection):
554562
self.x.end_pos = world_xmax, world_y_10, world_z_10
555563

556564
self.x.start_value = self.x.start_pos[0] - self.offset[0]
557-
statsx = self.x.update(self._plot_area.camera, self._plot_area.viewport.logical_size)
565+
statsx = self.x.update(
566+
self._plot_area.camera, self._plot_area.viewport.logical_size
567+
)
558568

559569
self.y.start_pos = world_x_10, world_ymin, world_z_10
560570
self.y.end_pos = world_x_10, world_ymax, world_z_10
561571

562572
self.y.start_value = self.y.start_pos[1] - self.offset[1]
563-
statsy = self.y.update(self._plot_area.camera, self._plot_area.viewport.logical_size)
573+
statsy = self.y.update(
574+
self._plot_area.camera, self._plot_area.viewport.logical_size
575+
)
564576

565577
if self._plot_area.camera.fov != 0:
566578
self.z.start_pos = world_x_10, world_y_10, world_zmin
567579
self.z.end_pos = world_x_10, world_y_10, world_zmax
568580

569581
self.z.start_value = self.z.start_pos[1] - self.offset[2]
570-
statsz = self.z.update(self._plot_area.camera, self._plot_area.viewport.logical_size)
582+
statsz = self.z.update(
583+
self._plot_area.camera, self._plot_area.viewport.logical_size
584+
)
571585
major_step_z = statsz["tick_step"]
572586

573587
if self.grids:

fastplotlib/layouts/_plot_area.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ def __init__(
110110
self.children = list()
111111

112112
self._background_material = pygfx.BackgroundMaterial(
113-
(0., 0., 0., 1.),
114-
(0., 0., 0., 1.),
115-
(0., 0., 0., 1.),
116-
(0., 0., 0., 1.),
113+
(0.0, 0.0, 0.0, 1.0),
114+
(0.0, 0.0, 0.0, 1.0),
115+
(0.0, 0.0, 0.0, 1.0),
116+
(0.0, 0.0, 0.0, 1.0),
117117
)
118118
self._background = pygfx.Background(None, self._background_material)
119119
self.scene.add(self._background)
@@ -601,7 +601,9 @@ def auto_scale(
601601
camera.maintain_aspect = maintain_aspect
602602

603603
if len(self._fpl_graphics_scene.children) > 0:
604-
width, height, depth = np.ptp(self._fpl_graphics_scene.get_world_bounding_box(), axis=0)
604+
width, height, depth = np.ptp(
605+
self._fpl_graphics_scene.get_world_bounding_box(), axis=0
606+
)
605607
else:
606608
width, height, depth = (1, 1, 1)
607609

fastplotlib/widgets/histogram_lut.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ def _make_colorbar(self, edges_flanked) -> ImageGraphic:
145145
# use the histogram edge values as data for an
146146
# image with 2 columns, this will be our colorbar!
147147
colorbar_data = np.column_stack(
148-
[np.linspace(edges_flanked[0], edges_flanked[-1], ceil(np.ptp(edges_flanked)))] * 2
148+
[
149+
np.linspace(
150+
edges_flanked[0], edges_flanked[-1], ceil(np.ptp(edges_flanked))
151+
)
152+
]
153+
* 2
149154
).astype(np.float32)
150155

151156
colorbar_data /= self._scale_factor
@@ -156,7 +161,7 @@ def _make_colorbar(self, edges_flanked) -> ImageGraphic:
156161
vmax=self.vmax,
157162
cmap=self.image_graphic.cmap,
158163
interpolation="linear",
159-
offset=(-55, edges_flanked[0], -1)
164+
offset=(-55, edges_flanked[0], -1),
160165
)
161166

162167
cbar.world_object.world.scale_x = 20
@@ -367,7 +372,9 @@ def image_graphic(self, graphic):
367372
if self._image_graphic is not None:
368373
# cleanup events from current image graphic
369374
ig_events = _get_image_graphic_events(self._image_graphic)
370-
self._image_graphic.remove_event_handler(self._image_cmap_handler, *ig_events)
375+
self._image_graphic.remove_event_handler(
376+
self._image_cmap_handler, *ig_events
377+
)
371378

372379
self._image_graphic = graphic
373380

0 commit comments

Comments
 (0)