Created
February 17, 2025 17:28
-
-
Save padenot/2a58ac267ec24ef0d2fcfeb3e5592c9d to your computer and use it in GitHub Desktop.
code to plot data for https://github.com/mozilla/cubeb/pull/811
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
import json | |
import numpy as np | |
import sys | |
# Load data from JSON file | |
with open(sys.argv[1], 'r') as f: | |
data = json.load(f) | |
df = pd.DataFrame(data, columns=["Input Rate", "Output Rate", "Block Size", "MSE", "Amplitude", "Phase"]) | |
# Compute resampling ratio | |
df["Resampling Ratio"] = df["Input Rate"] / df["Output Rate"] | |
# Apply log scale to MSE for better visualization | |
plt.figure(figsize=(10, 6)) | |
sc = plt.scatter(df["Resampling Ratio"], df["Block Size"], c=np.log10(df["MSE"]), cmap='viridis', marker='o') | |
# Labels and title | |
plt.xlabel("Resampling Ratio (Input Rate / Output Rate)") | |
plt.ylabel("Block Size (frames)") | |
plt.title("Scatter Plot of Resampling Ratio vs Block Size with Log-Scaled MSE Coloring " + sys.argv[1]) | |
# Color bar for log-scaled MSE values | |
cbar = plt.colorbar(sc) | |
cbar.set_label("Log10(Mean Squared Error)") | |
plt.grid(True) | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment