Add files via upload

This commit is contained in:
David Rotermund 2023-09-27 15:45:55 +02:00 committed by GitHub
parent 3857a02ec8
commit 5403e7a0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 11 deletions

View file

@ -22,6 +22,7 @@ class Anime:
colorbar: bool = True, colorbar: bool = True,
vmin_scale: float | None = None, vmin_scale: float | None = None,
vmax_scale: float | None = None, vmax_scale: float | None = None,
movie_file: str | None = None,
) -> None: ) -> None:
assert input.ndim == 3 assert input.ndim == 3
@ -79,12 +80,14 @@ class Anime:
plt.title(f"{bar} {i} of {int(input_np.shape[0]-1)}", loc="left") plt.title(f"{bar} {i} of {int(input_np.shape[0]-1)}", loc="left")
return return
_ = matplotlib.animation.FuncAnimation( ani = matplotlib.animation.FuncAnimation(
fig, fig,
next_frame, next_frame,
frames=int(input.shape[0]), frames=int(input.shape[0]),
interval=interval, interval=interval,
repeat=repeat, repeat=repeat,
) )
if movie_file is not None:
plt.show() ani.save(movie_file)
else:
plt.show()

View file

@ -232,10 +232,12 @@ class DataContainer(torch.nn.Module):
else: else:
assert self.acceptor is not None assert self.acceptor is not None
assert self.acceptor.ndim == temp.ndim assert self.acceptor.ndim + 1 == temp.ndim
assert self.acceptor.shape[0] == temp.shape[0] assert self.acceptor.shape[0] == temp.shape[0]
assert self.acceptor.shape[1] == temp.shape[1] assert self.acceptor.shape[1] == temp.shape[1]
assert self.acceptor.shape[3] == temp.shape[3] # assert self.acceptor.shape[2] == temp.shape[2]
assert temp.shape[3] == 4
self.acceptor = torch.cat( self.acceptor = torch.cat(
( (
self.acceptor, self.acceptor,
@ -258,10 +260,12 @@ class DataContainer(torch.nn.Module):
else: else:
assert self.donor is not None assert self.donor is not None
assert self.donor.ndim == temp.ndim assert self.donor.ndim + 1 == temp.ndim
assert self.donor.shape[0] == temp.shape[0] assert self.donor.shape[0] == temp.shape[0]
assert self.donor.shape[1] == temp.shape[1] assert self.donor.shape[1] == temp.shape[1]
assert self.donor.shape[3] == temp.shape[3] # assert self.donor.shape[2] == temp.shape[2]
assert temp.shape[3] == 4
self.donor = torch.cat( self.donor = torch.cat(
( (
self.donor, self.donor,
@ -284,10 +288,12 @@ class DataContainer(torch.nn.Module):
) )
else: else:
assert self.oxygenation is not None assert self.oxygenation is not None
assert self.oxygenation.ndim == temp.ndim assert self.oxygenation.ndim + 1 == temp.ndim
assert self.oxygenation.shape[0] == temp.shape[0] assert self.oxygenation.shape[0] == temp.shape[0]
assert self.oxygenation.shape[1] == temp.shape[1] assert self.oxygenation.shape[1] == temp.shape[1]
assert self.oxygenation.shape[3] == temp.shape[3] # assert self.oxygenation.shape[2] == temp.shape[2]
assert temp.shape[3] == 4
self.oxygenation = torch.cat( self.oxygenation = torch.cat(
( (
self.oxygenation, self.oxygenation,
@ -311,10 +317,12 @@ class DataContainer(torch.nn.Module):
) )
else: else:
assert self.volume is not None assert self.volume is not None
assert self.volume.ndim == temp.ndim assert self.volume.ndim + 1 == temp.ndim
assert self.volume.shape[0] == temp.shape[0] assert self.volume.shape[0] == temp.shape[0]
assert self.volume.shape[1] == temp.shape[1] assert self.volume.shape[1] == temp.shape[1]
assert self.volume.shape[3] == temp.shape[3] # assert self.volume.shape[2] == temp.shape[2]
assert temp.shape[3] == 4
self.volume = torch.cat( self.volume = torch.cat(
( (
self.volume, self.volume,