Black reformat + favor non gzip pickle
This commit is contained in:
parent
ec5a503c63
commit
47bf31fb3a
4 changed files with 36 additions and 19 deletions
|
|
@ -27,9 +27,11 @@ config.read(args.config)
|
|||
out = pathlib.Path(config.get("post", "out"))
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with gzip.open(gzf, "rb") if (
|
||||
gzf := out.joinpath("pickle.gz")
|
||||
).exists() else gzf.with_suffix("").open("rb") as f:
|
||||
with (
|
||||
path.open("rb")
|
||||
if (path := out.joinpath("pickle")).exists()
|
||||
else gzip.open(path.with_suffix(".gz"), "rb")
|
||||
) as f:
|
||||
model = pickle.load(f)
|
||||
|
||||
x0 = config.getfloat("post", "x")
|
||||
|
|
@ -85,13 +87,26 @@ def anim(i):
|
|||
aw_m.set_array(AW[i])
|
||||
|
||||
|
||||
|
||||
figU, axU = plt.subplots(figsize=(19.2, 10.8), dpi=100)
|
||||
u_m = axU.pcolormesh(
|
||||
X, Z, U[0], cmap="BuPu", vmin=0, vmax=np.nanquantile(U, .99), zorder=1, alpha=np.nan_to_num(AW[0]).clip(0, 1)
|
||||
X,
|
||||
Z,
|
||||
U[0],
|
||||
cmap="BuPu",
|
||||
vmin=0,
|
||||
vmax=np.nanquantile(U, 0.99),
|
||||
zorder=1,
|
||||
alpha=np.nan_to_num(AW[0]).clip(0, 1),
|
||||
)
|
||||
ur_m = axU.pcolormesh(
|
||||
X, Z, U[0], cmap="YlOrBr", vmin=0, vmax=np.nanquantile(U, .99), zorder=1, alpha=1-np.nan_to_num(AW[0]).clip(0, 1)
|
||||
X,
|
||||
Z,
|
||||
U[0],
|
||||
cmap="YlOrBr",
|
||||
vmin=0,
|
||||
vmax=np.nanquantile(U, 0.99),
|
||||
zorder=1,
|
||||
alpha=1 - np.nan_to_num(AW[0]).clip(0, 1),
|
||||
)
|
||||
# aw_u = axU.contour(X, Z, AW[0], levels=(.5,))
|
||||
figU.colorbar(u_m)
|
||||
|
|
@ -112,11 +127,11 @@ def animU(i):
|
|||
u_m.set_array(U[i])
|
||||
u_m.set_alpha(np.nan_to_num(AW[i]).clip(0, 1))
|
||||
ur_m.set_array(U[i])
|
||||
ur_m.set_alpha(1-np.nan_to_num(AW[i]).clip(0, 1))
|
||||
ur_m.set_alpha(1 - np.nan_to_num(AW[i]).clip(0, 1))
|
||||
|
||||
|
||||
ani = animation.FuncAnimation(fig, anim, frames=model.t.size, interval=1/24)
|
||||
aniU = animation.FuncAnimation(figU, animU, frames=model.t.size, interval=1/24)
|
||||
ani = animation.FuncAnimation(fig, anim, frames=model.t.size, interval=1 / 24)
|
||||
aniU = animation.FuncAnimation(figU, animU, frames=model.t.size, interval=1 / 24)
|
||||
|
||||
ani.save(out.joinpath("anim.mp4"), fps=24)
|
||||
aniU.save(out.joinpath("animU.mp4"), fps=24)
|
||||
|
|
|
|||
Reference in a new issue