diff --git a/ANR_high_level.ipynb b/ANR_high_level.ipynb index d655470..7da9639 100644 --- a/ANR_high_level.ipynb +++ b/ANR_high_level.ipynb @@ -959,47 +959,47 @@ "PLOT = False\n", "\n", "# Daten aus .csv laden\n", - "data_reduced_update = np.loadtxt('reduced_update.txt', delimiter=\",\", skiprows=1)\n", + "update_rate_breathing = np.loadtxt('update_rate_evaluation/update_rate_breathing.csv', delimiter=\";\", skiprows=1)\n", "\n", "# Daten laden\n", - "x = data_reduced_update[:, 0]\n", - "reduced_gain = data_reduced_update[:, 2]\n", - "reduced_cycles = data_reduced_update[:, 4]\n", - "reduced_computing = data_reduced_update[:, 5]\n", + "x = update_rate_breathing[:, 0]\n", + "update_gain_breathing = update_rate_breathing[:, 2]\n", + "update_cycles_breathing = update_rate_breathing[:, 4]\n", + "update_load_breathing = update_rate_breathing[:, 5]\n", "\n", "# Sortieren\n", "idx = np.argsort(x)\n", "x = x[idx]\n", - "reduced_gain = reduced_gain[idx]\n", - "reduced_cycles = reduced_cycles[idx]\n", - "reduced_computing = reduced_computing[idx]\n", + "update_gain_breathing = update_gain_breathing[idx]\n", + "update_cycles_breathing = update_cycles_breathing[idx]\n", + "update_load_breathing = update_load_breathing[idx]\n", "\n", "# Smoothing\n", "x_smooth = np.linspace(x.min(), x.max(), 300)\n", "\n", - "gain_smooth = make_interp_spline(x, reduced_gain)(x_smooth)\n", - "cycles_smooth = make_interp_spline(x, reduced_cycles)(x_smooth)\n", - "comp_smooth = make_interp_spline(x, reduced_computing)(x_smooth)\n", + "update_gain_smooth = make_interp_spline(x, update_gain_breathing)(x_smooth)\n", + "update_cycles_smooth = make_interp_spline(x, update_cycles_breathing)(x_smooth)\n", + "update_load_smooth = make_interp_spline(x, update_load_breathing)(x_smooth)\n", "\n", - "diff_smooth = np.abs(gain_smooth - cycles_smooth)\n", + "diff_smooth = np.abs(update_gain_smooth - update_cycles_smooth)\n", "idx_max = np.argmax(diff_smooth)\n", "x_max = x_smooth[idx_max]\n", - "y1_max = gain_smooth[idx_max]\n", - "y2_max = cycles_smooth[idx_max]\n", + "y1_max = update_gain_smooth[idx_max]\n", + "y2_max = update_cycles_smooth[idx_max]\n", "\n", "# Plot\n", "plt.figure(figsize=(15, 7))\n", - "plt.plot(x_smooth, gain_smooth, linestyle='--', color='indianred', linewidth=2, alpha=0.9, label='SNR-Gain')\n", - "plt.plot(x_smooth, cycles_smooth, linestyle='-.', color='skyblue', linewidth=2, alpha=0.9, label='Cycles/Sample')\n", - "plt.plot(x_smooth, comp_smooth, linestyle=':', color='forestgreen', linewidth=2, alpha=0.9, label='DSP Load')\n", + "plt.plot(x_smooth, update_gain_smooth, linestyle='--', color='indianred', linewidth=2, alpha=0.9, label='SNR-Gain')\n", + "plt.plot(x_smooth, update_cycles_smooth, linestyle='-.', color='skyblue', linewidth=2, alpha=0.9, label='Cycles/Sample')\n", + "plt.plot(x_smooth, update_load_smooth, linestyle=':', color='forestgreen', linewidth=2, alpha=0.9, label='DSP Load')\n", "plt.plot([x_max, x_max], [y1_max, y2_max], color='black', linestyle=':', linewidth=2)\n", "\n", - "plt.scatter(x, reduced_gain, color='indianred', s=40)\n", - "plt.scatter(x, reduced_cycles, color='skyblue', s=40)\n", - "plt.scatter(x, reduced_computing, color='forestgreen', s=40)\n", + "plt.scatter(x, update_gain_breathing, color='indianred', s=40)\n", + "plt.scatter(x, update_cycles_breathing, color='skyblue', s=40)\n", + "plt.scatter(x, update_load_breathing, color='forestgreen', s=40)\n", "\n", "plt.text(x_max, (y1_max + y2_max)/2+0.1,\n", - " f'Maximum Offset at {x_max:.2f}',\n", + " f'Max. offset at update rate {x_max:.2f}',\n", " fontsize=20,\n", " ha='left')\n", "\n", @@ -1025,10 +1025,192 @@ "plt.legend(frameon=False, loc='upper right')\n", "plt.tight_layout()\n", "if PLOT == True:\n", - " plt.savefig(f'plots/fig_snr_reduced_update', dpi=600)\n", + " plt.savefig(f'plots/fig_snr_update_rate', dpi=600)\n", "plt.show()\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Multi Reduced Update Plot\n", + "\n", + "import matplotlib.ticker as mtick\n", + "from scipy.interpolate import make_interp_spline\n", + "\n", + "PLOT = False\n", + "\n", + "# Daten aus .csv laden\n", + "update_rate_breathing = np.loadtxt('update_rate_evaluation/update_rate_breathing.csv', delimiter=\";\", skiprows=1)\n", + "update_rate_chewing = np.loadtxt('update_rate_evaluation/update_rate_chewing.csv', delimiter=\";\", skiprows=1)\n", + "update_rate_coughing = np.loadtxt('update_rate_evaluation/update_rate_coughing.csv', delimiter=\";\", skiprows=1)\n", + "update_rate_drinking = np.loadtxt('update_rate_evaluation/update_rate_drinking.csv', delimiter=\";\", skiprows=1)\n", + "update_rate_scratching = np.loadtxt('update_rate_evaluation/update_rate_scratching.csv', delimiter=\";\", skiprows=1)\n", + "\n", + "# Daten laden\n", + "x = update_rate_breathing[:, 0]\n", + "update_gain_breathing = update_rate_breathing[:, 2]\n", + "update_cycles_breathing = update_rate_breathing[:, 4]\n", + "update_load_breathing = update_rate_breathing[:, 5]\n", + "update_gain_chewing = update_rate_chewing[:, 2]\n", + "update_cycles_chewing = update_rate_chewing[:, 4]\n", + "update_load_chewing = update_rate_chewing[:, 5]\n", + "update_gain_coughing = update_rate_coughing[:, 2]\n", + "update_cycles_coughing = update_rate_coughing[:, 4]\n", + "update_load_coughing = update_rate_coughing[:, 5]\n", + "update_gain_drinking = update_rate_drinking[:, 2]\n", + "update_cycles_drinking = update_rate_drinking[:, 4]\n", + "update_load_drinking = update_rate_drinking[:, 5]\n", + "update_gain_scratching = update_rate_scratching[:, 2]\n", + "update_cycles_scratching = update_rate_scratching[:, 4] \n", + "update_load_scratching = update_rate_scratching[:, 5] \n", + "\n", + "# Sortieren\n", + "idx = np.argsort(x)\n", + "x = x[idx]\n", + "update_gain_breathing = update_gain_breathing[idx]\n", + "update_cycles_breathing = update_cycles_breathing[idx]\n", + "update_load_breathing = update_load_breathing[idx]\n", + "update_gain_chewing = update_gain_chewing[idx]\n", + "update_cycles_chewing = update_cycles_chewing[idx]\n", + "update_load_chewing = update_load_chewing[idx]\n", + "update_gain_coughing = update_gain_coughing[idx]\n", + "update_cycles_coughing = update_cycles_coughing[idx]\n", + "update_load_coughing = update_load_coughing[idx]\n", + "update_gain_drinking = update_gain_drinking[idx]\n", + "update_cycles_drinking = update_cycles_drinking[idx]\n", + "update_load_drinking = update_load_drinking[idx]\n", + "update_gain_scratching = update_gain_scratching[idx]\n", + "update_cycles_scratching = update_cycles_scratching[idx]\n", + "update_load_scratching = update_load_scratching[idx]\n", + "\n", + "# Smoothing\n", + "x_smooth = np.linspace(x.min(), x.max(), 300)\n", + "\n", + "gain_smooth_breathing = make_interp_spline(x, update_gain_breathing)(x_smooth)\n", + "cycles_smooth_breathing = make_interp_spline(x, update_cycles_breathing)(x_smooth)\n", + "load_smooth_breathing = make_interp_spline(x, update_load_breathing)(x_smooth)\n", + "gain_smooth_chewing = make_interp_spline(x, update_gain_chewing)(x_smooth)\n", + "cycles_smooth_chewing = make_interp_spline(x, update_cycles_chewing)(x_smooth)\n", + "load_smooth_chewing = make_interp_spline(x, update_load_chewing)(x_smooth)\n", + "gain_smooth_coughing = make_interp_spline(x, update_gain_coughing)(x_smooth)\n", + "cycles_smooth_coughing = make_interp_spline(x, update_cycles_coughing)(x_smooth)\n", + "load_smooth_coughing = make_interp_spline(x, update_load_coughing)(x_smooth)\n", + "gain_smooth_drinking = make_interp_spline(x, update_gain_drinking)(x_smooth)\n", + "cycles_smooth_drinking = make_interp_spline(x, update_cycles_drinking)(x_smooth)\n", + "load_smooth_drinking = make_interp_spline(x, update_load_drinking)(x_smooth)\n", + "gain_smooth_scratching = make_interp_spline(x, update_gain_scratching)(x_smooth)\n", + "cycles_smooth_scratching = make_interp_spline(x, update_cycles_scratching)(x_smooth)\n", + "load_smooth_scratching = make_interp_spline(x, update_load_scratching)(x_smooth)\n", + "\n", + "diff_smooth_breathing = gain_smooth_breathing - cycles_smooth_breathing\n", + "diff_smooth_chewing = gain_smooth_chewing - cycles_smooth_chewing\n", + "diff_smooth_coughing = gain_smooth_coughing - cycles_smooth_coughing\n", + "diff_smooth_drinking = gain_smooth_drinking - cycles_smooth_drinking\n", + "diff_smooth_scratching = gain_smooth_scratching - cycles_smooth_scratching\n", + "\n", + "# Alle Kurven in ein Array stapeln\n", + "stack_difference = np.vstack([\n", + " diff_smooth_breathing,\n", + " diff_smooth_chewing,\n", + " diff_smooth_coughing,\n", + " diff_smooth_drinking,\n", + " diff_smooth_scratching\n", + "])\n", + "\n", + "# Alle Kurven in ein Array stapeln\n", + "stack_load = np.vstack([\n", + " load_smooth_breathing,\n", + " load_smooth_chewing,\n", + " load_smooth_coughing,\n", + " load_smooth_drinking,\n", + " load_smooth_scratching\n", + "])\n", + "\n", + "# Punktweiser Mittelwert\n", + "mean_gain = np.mean(stack_difference, axis=0)\n", + "mean_load = np.mean(stack_load, axis=0) \n", + "\n", + "idx_max_gain = np.argmax(mean_gain)\n", + "x_max_gain = x_smooth[idx_max_gain]\n", + "y_max_gain = mean_gain[idx_max_gain]\n", + "x_max_load = x_smooth[idx_max_gain]\n", + "y_max_load = mean_load[idx_max_gain]\n", + "\n", + "\n", + "# Plot\n", + "figure1, ax1 = plt.subplots(figsize=(15, 7))\n", + "ax1.plot(x_smooth, diff_smooth_breathing, linestyle='--', color='indianred', linewidth=1.5, alpha=0.7, label='Breathing Noise')\n", + "ax1.plot(x_smooth, diff_smooth_chewing, linestyle='-.', color='skyblue', linewidth=1.5, alpha=0.7, label='Chewing Noise')\n", + "ax1.plot(x_smooth, diff_smooth_coughing, linestyle=':', color='forestgreen', linewidth=1.5, alpha=0.7, label='Coughing Noise')\n", + "ax1.plot(x_smooth, diff_smooth_drinking, linestyle='--', color='darkorange', linewidth=1.5, alpha=0.7, label='Drinking Noise')\n", + "ax1.plot(x_smooth, diff_smooth_scratching, linestyle='-.', color='darkorchid', linewidth=1.5, alpha=0.7, label='Scratching Noise')\n", + "ax1.plot(x_smooth, mean_gain, linestyle='--', color='red', linewidth=2.5, alpha=1, label='Mean Performance Gain')\n", + "ax1.plot([x_max_gain, x_max_gain], [y_max_gain, 0], color='black', linestyle=':', linewidth=2)\n", + "\n", + "ax1.text(x_max_gain+0.38, y_max_gain+0.03,\n", + " f'{y_max_gain*100:.1f} \\% mean performance gain at update rate {x_max_gain:.2f}',\n", + " fontsize=20,\n", + " ha='left')\n", + "\n", + "figure2, ax2 = plt.subplots(figsize=(15, 7))\n", + "ax2.plot(x_smooth, load_smooth_breathing, linestyle='--', color='indianred', linewidth=1.5, alpha=0.7, label='Breathing Noise')\n", + "ax2.plot(x_smooth, load_smooth_chewing, linestyle='-.', color='skyblue', linewidth=1.5, alpha=0.7, label='Chewing Noise')\n", + "ax2.plot(x_smooth, load_smooth_coughing, linestyle=':', color='forestgreen', linewidth=1.5, alpha=0.7, label='Coughing Noise')\n", + "ax2.plot(x_smooth, load_smooth_drinking, linestyle='--', color='darkorange', linewidth=1.5, alpha=0.7, label='Drinking Noise')\n", + "ax2.plot(x_smooth, load_smooth_scratching, linestyle='-.', color='darkorchid', linewidth=1.5, alpha=0.7, label='Scratching Noise')\n", + "ax2.plot(x_smooth, mean_load, linestyle='--', color='blue', linewidth=2.5, alpha=1, label='Mean DSP Load')\n", + "ax2.plot([x_max_load, x_max_load], [y_max_load, 0], color='black', linestyle=':', linewidth=2)\n", + "\n", + "ax2.text(x_max_load+0.32, y_max_load-0.04,\n", + " f'{y_max_load*100:.1f} \\% mean DSP load at update rate {x_max_load:.2f}',\n", + " fontsize=20,\n", + " ha='left')\n", + "\n", + "plt.rcParams.update({\n", + " \"text.usetex\": True,\n", + " \"font.family\": \"serif\",\n", + " 'font.size': 16, # Standardtext\n", + " 'axes.labelsize': 30, # Achsenbeschriftungen\n", + " 'xtick.labelsize': 25, # Tick-Beschriftungen\n", + " 'ytick.labelsize': 25,\n", + " 'legend.fontsize': 25 # Legende\n", + "})\n", + "\n", + "ax1.set_xlabel(\"Update Rate\")\n", + "ax2.set_xlabel(\"Update Rate\")\n", + "ax1.set_ylabel(\"Performance Gain\")\n", + "ax2.set_ylabel(\"DSP Load\")\n", + "ax1.grid(True, linestyle='-.', alpha=0.4)\n", + "ax2.grid(True, linestyle='-.', alpha=0.4)\n", + "ax1.set_ylim(0, 1)\n", + "ax2.set_ylim(0, 0.7)\n", + "#Spines auf ganzen Plot anwenden\n", + "ax1.yaxis.set_major_formatter(mtick.PercentFormatter(1.0))\n", + "ax2.yaxis.set_major_formatter(mtick.PercentFormatter(1.0))\n", + "ax1.spines['top'].set_visible(False)\n", + "ax2.spines['top'].set_visible(False)\n", + "ax1.spines['right'].set_visible(False)\n", + "ax2.spines['right'].set_visible(False)\n", + "ax1.legend(frameon=False, loc='upper right')\n", + "ax2.legend(frameon=False, loc='upper right')\n", + "ax1.invert_xaxis()\n", + "ax2.invert_xaxis()\n", + "figure1.tight_layout()\n", + "figure2.tight_layout()\n", + "if PLOT == True:\n", + " figure1.savefig(f'plots/fig_gain_update_rate', dpi=600)\n", + " figure2.savefig(f'plots/fig_load_update_rate', dpi=600)\n", + "figure1.show()\n", + "figure2.show()\n", + "\n", + "\n", + "\n", + "\n" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1049,21 +1231,21 @@ "x = data_error_threshold[:, 0]\n", "error_gain = data_error_threshold[:, 2]\n", "error_cycles = data_error_threshold[:, 6]\n", - "error_computing = data_error_threshold[:, 7]\n", + "error_load = data_error_threshold[:, 7]\n", "\n", "# Sortieren\n", "idx = np.argsort(x)\n", "x = x[idx]\n", "error_gain = error_gain[idx]\n", "error_cycles = error_cycles[idx]\n", - "error_computing = error_computing[idx]\n", + "error_load = error_load[idx]\n", "\n", "# Smoothing\n", "x_smooth = np.linspace(x.min(), x.max(), 300)\n", "\n", "gain_smooth = make_interp_spline(x, error_gain)(x_smooth)\n", "cycles_smooth = make_interp_spline(x, error_cycles)(x_smooth)\n", - "comp_smooth = make_interp_spline(x, error_computing)(x_smooth)\n", + "comp_smooth = make_interp_spline(x, error_load)(x_smooth)\n", "\n", "diff_smooth = np.abs(gain_smooth - cycles_smooth)\n", "idx_max = np.argmax(diff_smooth)\n", @@ -1080,10 +1262,10 @@ "\n", "plt.scatter(x, error_gain, color='indianred', s=40)\n", "plt.scatter(x, error_cycles, color='skyblue', s=40)\n", - "plt.scatter(x, error_computing, color='forestgreen', s=40)\n", + "plt.scatter(x, error_load, color='forestgreen', s=40)\n", "\n", "plt.text(x_max, (y1_max + y2_max)/2+0.21,\n", - " f'Maximum Offset at {x_max:.2f}',\n", + " f'Max. offset at threshold {x_max:.2f}',\n", " fontsize=20,\n", " ha='left')\n", "\n", @@ -1136,57 +1318,57 @@ "x = error_threshold_breathing[:, 0]\n", "error_gain_breathing = error_threshold_breathing[:, 2]\n", "error_cycles_breathing = error_threshold_breathing[:, 6]\n", - "error_computing_breathing = error_threshold_breathing[:, 7]\n", + "error_load_breathing = error_threshold_breathing[:, 7]\n", "error_gain_chewing = error_threshold_chewing[:, 2]\n", "error_cycles_chewing = error_threshold_chewing[:, 6]\n", - "error_computing_chewing = error_threshold_chewing[:, 7]\n", + "error_load_chewing = error_threshold_chewing[:, 7]\n", "error_gain_coughing = error_threshold_coughing[:, 2]\n", "error_cycles_coughing = error_threshold_coughing[:, 6]\n", - "error_computing_coughing = error_threshold_coughing[:, 7]\n", + "error_load_coughing = error_threshold_coughing[:, 7]\n", "error_gain_drinking = error_threshold_drinking[:, 2]\n", "error_cycles_drinking = error_threshold_drinking[:, 6]\n", - "error_computing_drinking = error_threshold_drinking[:, 7]\n", + "error_load_drinking = error_threshold_drinking[:, 7]\n", "error_gain_scratching = error_threshold_scratching[:, 2]\n", "error_cycles_scratching = error_threshold_scratching[:, 6] \n", - "error_computing_scratching = error_threshold_scratching[:, 7] \n", + "error_load_scratching = error_threshold_scratching[:, 7] \n", "\n", "# Sortieren\n", "idx = np.argsort(x)\n", "x = x[idx]\n", "error_gain_breathing = error_gain_breathing[idx]\n", "error_cycles_breathing = error_cycles_breathing[idx]\n", - "error_computing_breathing = error_computing_breathing[idx]\n", + "error_load_breathing = error_load_breathing[idx]\n", "error_gain_chewing = error_gain_chewing[idx]\n", "error_cycles_chewing = error_cycles_chewing[idx]\n", - "error_computing_chewing = error_computing_chewing[idx]\n", + "error_load_chewing = error_load_chewing[idx]\n", "error_gain_coughing = error_gain_coughing[idx]\n", "error_cycles_coughing = error_cycles_coughing[idx]\n", - "error_computing_coughing = error_computing_coughing[idx]\n", + "error_load_coughing = error_load_coughing[idx]\n", "error_gain_drinking = error_gain_drinking[idx]\n", "error_cycles_drinking = error_cycles_drinking[idx]\n", - "error_computing_drinking = error_computing_drinking[idx]\n", + "error_load_drinking = error_load_drinking[idx]\n", "error_gain_scratching = error_gain_scratching[idx]\n", "error_cycles_scratching = error_cycles_scratching[idx]\n", - "error_computing_scratching = error_computing_scratching[idx]\n", + "error_load_scratching = error_load_scratching[idx]\n", "\n", "# Smoothing\n", "x_smooth = np.linspace(x.min(), x.max(), 300)\n", "\n", "gain_smooth_breathing = make_interp_spline(x, error_gain_breathing)(x_smooth)\n", "cycles_smooth_breathing = make_interp_spline(x, error_cycles_breathing)(x_smooth)\n", - "computing_smooth_breathing = make_interp_spline(x, error_computing_breathing)(x_smooth)\n", + "load_smooth_breathing = make_interp_spline(x, error_load_breathing)(x_smooth)\n", "gain_smooth_chewing = make_interp_spline(x, error_gain_chewing)(x_smooth)\n", "cycles_smooth_chewing = make_interp_spline(x, error_cycles_chewing)(x_smooth)\n", - "computing_smooth_chewing = make_interp_spline(x, error_computing_chewing)(x_smooth)\n", + "load_smooth_chewing = make_interp_spline(x, error_load_chewing)(x_smooth)\n", "gain_smooth_coughing = make_interp_spline(x, error_gain_coughing)(x_smooth)\n", "cycles_smooth_coughing = make_interp_spline(x, error_cycles_coughing)(x_smooth)\n", - "computing_smooth_coughing = make_interp_spline(x, error_computing_coughing)(x_smooth)\n", + "load_smooth_coughing = make_interp_spline(x, error_load_coughing)(x_smooth)\n", "gain_smooth_drinking = make_interp_spline(x, error_gain_drinking)(x_smooth)\n", "cycles_smooth_drinking = make_interp_spline(x, error_cycles_drinking)(x_smooth)\n", - "computing_smooth_drinking = make_interp_spline(x, error_computing_drinking)(x_smooth)\n", + "load_smooth_drinking = make_interp_spline(x, error_load_drinking)(x_smooth)\n", "gain_smooth_scratching = make_interp_spline(x, error_gain_scratching)(x_smooth)\n", "cycles_smooth_scratching = make_interp_spline(x, error_cycles_scratching)(x_smooth)\n", - "computing_smooth_scratching = make_interp_spline(x, error_computing_scratching)(x_smooth)\n", + "load_smooth_scratching = make_interp_spline(x, error_load_scratching)(x_smooth)\n", "\n", "diff_smooth_breathing = gain_smooth_breathing - cycles_smooth_breathing\n", "diff_smooth_chewing = gain_smooth_chewing - cycles_smooth_chewing\n", @@ -1204,23 +1386,23 @@ "])\n", "\n", "# Alle Kurven in ein Array stapeln\n", - "stack_computing = np.vstack([\n", - " computing_smooth_breathing,\n", - " computing_smooth_chewing,\n", - " computing_smooth_coughing,\n", - " computing_smooth_drinking,\n", - " computing_smooth_scratching\n", + "stack_load = np.vstack([\n", + " load_smooth_breathing,\n", + " load_smooth_chewing,\n", + " load_smooth_coughing,\n", + " load_smooth_drinking,\n", + " load_smooth_scratching\n", "])\n", "\n", "# Punktweiser Mittelwert\n", "mean_gain = np.mean(stack_difference, axis=0)\n", - "mean_computing = np.mean(stack_computing, axis=0) \n", + "mean_load = np.mean(stack_load, axis=0) \n", "\n", "idx_max_gain = np.argmax(mean_gain)\n", "x_max_gain = x_smooth[idx_max_gain]\n", "y_max_gain = mean_gain[idx_max_gain]\n", - "x_max_computing = x_smooth[idx_max_gain]\n", - "y_max_computing = mean_computing[idx_max_gain]\n", + "x_max_load = x_smooth[idx_max_gain]\n", + "y_max_load = mean_load[idx_max_gain]\n", "\n", "\n", "# Plot\n", @@ -1239,16 +1421,16 @@ " ha='left')\n", "\n", "figure2, ax2 = plt.subplots(figsize=(15, 7))\n", - "ax2.plot(x_smooth, computing_smooth_breathing, linestyle='--', color='indianred', linewidth=1.5, alpha=0.7, label='Breathing Noise')\n", - "ax2.plot(x_smooth, computing_smooth_chewing, linestyle='-.', color='skyblue', linewidth=1.5, alpha=0.7, label='Chewing Noise')\n", - "ax2.plot(x_smooth, computing_smooth_coughing, linestyle=':', color='forestgreen', linewidth=1.5, alpha=0.7, label='Coughing Noise')\n", - "ax2.plot(x_smooth, computing_smooth_drinking, linestyle='--', color='darkorange', linewidth=1.5, alpha=0.7, label='Drinking Noise')\n", - "ax2.plot(x_smooth, computing_smooth_scratching, linestyle='-.', color='darkorchid', linewidth=1.5, alpha=0.7, label='Scratching Noise')\n", - "ax2.plot(x_smooth, mean_computing, linestyle='--', color='blue', linewidth=2.5, alpha=1, label='Mean DSP Load')\n", - "ax2.plot([x_max_computing, x_max_computing], [y_max_computing, 0], color='black', linestyle=':', linewidth=2)\n", + "ax2.plot(x_smooth, load_smooth_breathing, linestyle='--', color='indianred', linewidth=1.5, alpha=0.7, label='Breathing Noise')\n", + "ax2.plot(x_smooth, load_smooth_chewing, linestyle='-.', color='skyblue', linewidth=1.5, alpha=0.7, label='Chewing Noise')\n", + "ax2.plot(x_smooth, load_smooth_coughing, linestyle=':', color='forestgreen', linewidth=1.5, alpha=0.7, label='Coughing Noise')\n", + "ax2.plot(x_smooth, load_smooth_drinking, linestyle='--', color='darkorange', linewidth=1.5, alpha=0.7, label='Drinking Noise')\n", + "ax2.plot(x_smooth, load_smooth_scratching, linestyle='-.', color='darkorchid', linewidth=1.5, alpha=0.7, label='Scratching Noise')\n", + "ax2.plot(x_smooth, mean_load, linestyle='--', color='blue', linewidth=2.5, alpha=1, label='Mean DSP Load')\n", + "ax2.plot([x_max_load, x_max_load], [y_max_load, 0], color='black', linestyle=':', linewidth=2)\n", "\n", - "ax2.text(x_max_computing, y_max_computing+0.01,\n", - " f'{y_max_computing*100:.1f} \\% mean DSP load at error threshold {x_max_computing:.2f}',\n", + "ax2.text(x_max_load, y_max_load+0.01,\n", + " f'{y_max_load*100:.1f} \\% mean DSP load at error threshold {x_max_load:.2f}',\n", " fontsize=20,\n", " ha='left')\n", "\n", @@ -1269,7 +1451,7 @@ "ax1.grid(True, linestyle='-.', alpha=0.4)\n", "ax2.grid(True, linestyle='-.', alpha=0.4)\n", "ax1.set_ylim(0, 1)\n", - "ax2.set_ylim(0, 0.5)\n", + "ax2.set_ylim(0, 0.7)\n", "#Spines auf ganzen Plot anwenden\n", "ax1.yaxis.set_major_formatter(mtick.PercentFormatter(1.0))\n", "ax2.yaxis.set_major_formatter(mtick.PercentFormatter(1.0))\n", @@ -1282,8 +1464,8 @@ "figure1.tight_layout()\n", "figure2.tight_layout()\n", "if PLOT == True:\n", - " figure1.savefig(f'plots/fig_snr_error_threshold', dpi=600)\n", - " figure2.savefig(f'plots/fig_snr_error_threshold_computing', dpi=600)\n", + " figure1.savefig(f'plots/fig_gain_error_threshold', dpi=600)\n", + " figure2.savefig(f'plots/fig_load_error_threshold', dpi=600)\n", "figure1.show()\n", "figure2.show()\n" ]