Skip to content

Commit a06dde2

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e599f5a commit a06dde2

3 files changed

Lines changed: 13 additions & 18 deletions

File tree

WrightTools/artists/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# flake8: noqa
44

55
import pathlib
6+
67
for x in pathlib.Path(__file__).parent.walk():
78
print(x)
89

WrightTools/artists/_animate.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""library for making animations"""
2+
23
"""TODO: push these functions into WrightTools"""
34

45
import matplotlib.pyplot as plt
@@ -15,13 +16,14 @@
1516

1617
def animate2D(
1718
d,
18-
cmap, norm,
19+
cmap,
20+
norm,
1921
snake=False,
2022
back_and_forth=False,
2123
**ani_kwargs,
2224
):
2325
"""
24-
animate pcolormesh of a nd dataset (ndim >=2),
26+
animate pcolormesh of a nd dataset (ndim >=2),
2527
mesh plots last two axes of the dataset (use `Data.transform` if needed)
2628
uses first channel in dataset (use `bring_to_front` if needed)
2729
@@ -37,7 +39,7 @@ def animate2D(
3739
# funcs for updating
3840
def title(ind):
3941
parts = [
40-
f"{var.natural_name} = {var[:].squeeze()[ind]:.2f} {var.units}"
42+
f"{var.natural_name} = {var[:].squeeze()[ind]:.2f} {var.units}"
4143
for var in map(lambda a: a.variables[0], d.axes[:-2])
4244
]
4345
return "\n".join(parts)
@@ -63,12 +65,7 @@ def update2D(frame, data, fig, ax, mesh, norm):
6365
)
6466

6567

66-
def animate_interact2D(
67-
interact2D:interact2D_fig,
68-
snake=False,
69-
back_and_forth=False,
70-
**kwargs
71-
):
68+
def animate_interact2D(interact2D: interact2D_fig, snake=False, back_and_forth=False, **kwargs):
7269
"""
7370
Take an interact2D figure and create an animation by moving the sliders.
7471
@@ -80,11 +77,10 @@ def update(frame):
8077
for ind, slider in zip(frame, interact2D.sliders.values()):
8178
slider.set_val(ind)
8279

83-
frames = list(np.ndindex(tuple([s.valmax+1 for s in interact2D.sliders.values()])))
80+
frames = list(np.ndindex(tuple([s.valmax + 1 for s in interact2D.sliders.values()])))
8481
print(f"beginning animation: {len(frames)} frames to write")
8582
return FuncAnimation(
8683
fig=interact2D.fig,
8784
func=update,
8885
frames=frames,
8986
)
90-

WrightTools/artists/_interact.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
@dataclass
2323
class interact2D_fig:
24-
fig:plt.figure
25-
image:Any
26-
sliders:dict[str, Slider]
27-
crosshairs:list
28-
radio:RadioButtons
24+
fig: plt.figure
25+
image: Any
26+
sliders: dict[str, Slider]
27+
crosshairs: list
28+
radio: RadioButtons
2929
cax: plt.axes
3030

3131

@@ -604,5 +604,3 @@ def update_key_press(info):
604604
radio=radio,
605605
cax=cax,
606606
)
607-
608-

0 commit comments

Comments
 (0)