Skip to content

Commit

Permalink
Adjusted mode dropping tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
LimbeckKat committed Dec 4, 2024
1 parent 5fa03a3 commit 3ad42ca
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 81 deletions.
Binary file added notebooks/assets/mode_dropping.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/assets/mode_dropping_normalised.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 46 additions & 75 deletions notebooks/mode_dropping.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions notebooks/tutorial_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def sample_points_gaussian(mean, cov, n):
return points


def simulate_mode_dropping(is_normalized):
def simulate_mode_dropping(is_normalised):
"""Creates a mode-dropping simulation, creating a gif as output."""

# Setting hyperparameters
Expand Down Expand Up @@ -395,7 +395,7 @@ def simulate_mode_dropping(is_normalized):
mag_area = mag_new.MagArea(scale=True)
mag_diff = mag_start.MagDiff(mag_new, scale=True)

if is_normalized:
if is_normalised:
mag_diffs.append(mag_diff / mag_area0)
else:
mag_diffs.append(-mag_diff)
Expand Down Expand Up @@ -429,7 +429,7 @@ def update(frame):
ax1.scatter(new_x, new_y, c=new_colors, cmap="viridis", alpha=0.6)
ax1.set_axis_off()

if is_normalized:
if is_normalised:
ax2 = fig.add_subplot(
122,
aspect="equal",
Expand All @@ -440,7 +440,7 @@ def update(frame):
ax2.plot(
[r * 2 for r in range(frame)],
mag_diffs[:frame],
label="Normalized MagDiff (MagDiff / Original MagArea)",
label="Normalised MagDiff (MagDiff / Original MagArea)",
color="black",
)
else:
Expand All @@ -467,9 +467,9 @@ def update(frame):
ani = FuncAnimation(
fig, update, frames=size, repeat=False, interval=int(500 / 1 * size)
)
if is_normalized:
if is_normalised:
ani.save("./assets/mode_dropping_normalised.gif", fps=10)
else:
ani.save("./assets/mode_dropping.gif", fps=10)

plt.show()
#plt.show()

0 comments on commit 3ad42ca

Please sign in to comment.