Skip to content

Commit 929a281

Browse files
committed
Merge branch 'animations' of https://github.com/wright-group/WrightTools into animations
2 parents 53c8cfe + ea8c9de commit 929a281

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

WrightTools/artists/_animate.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""helpers for making animations"""
22

3-
43
import matplotlib.pyplot as plt
54
import numpy as np
65

@@ -9,7 +8,6 @@
98

109
from ._interact import interact2D_fig
1110

12-
1311
__all__ = ["animate2D", "animate_interact2D"]
1412

1513

@@ -18,8 +16,8 @@ def animate2D(
1816
norm,
1917
channel=0,
2018
cmap=None,
21-
snake:bool=False,
22-
back_and_forth:bool=False,
19+
snake: bool = False,
20+
back_and_forth: bool = False,
2321
**ani_kwargs,
2422
):
2523
"""
@@ -28,25 +26,25 @@ def animate2D(
2826
2927
Parameters
3028
----------
31-
29+
3230
data: WrightTools.data
3331
dataset to animate. take the last two axes as the ones that are plotted;
3432
other axes compose the frames of the animation
35-
33+
3634
norm: Normalize instance or callable
37-
determines the normalization rules to follow.
35+
determines the normalization rules to follow.
3836
If channel is signed, defaults to CenteredNorm with null center.
3937
If channel is unsigned, defaults to Normalize from null to max.
4038
4139
channel: string, index, or Channel
4240
Select which channel to plot
43-
41+
4442
cmap: str or Colormap (optional)
4543
colormap used. Defaults to WrightTools default
4644
4745
**kwargs: dict items
4846
all extra kwargs are passed to matplotlib.FuncAnimation
49-
47+
5048
Example
5149
-------
5250
General usage (create an animation procedure and then write to file):
@@ -67,15 +65,19 @@ def animate2D(
6765
6866
Notes
6967
-----
70-
68+
7169
snake, back_and_forth are not yet implemented
7270
"""
7371

7472
channel = data.get_channel(channel)
7573

7674
# initialize canvas
7775
fig, ax = plt.subplots(subplot_kw=dict(projection="wright"), dpi=140, layout="constrained")
78-
art = ax.pcolormesh(data[tuple([0 for i in data.shape[:-2]])], cmap=cmap, norm=norm() if callable(norm) else norm)
76+
art = ax.pcolormesh(
77+
data[tuple([0 for i in data.shape[:-2]])],
78+
cmap=cmap,
79+
norm=norm() if callable(norm) else norm,
80+
)
7981
colorbar = fig.colorbar(art, ax=ax)
8082
colorbar.set_label(channel.label)
8183

0 commit comments

Comments
 (0)