From e526026250bf0150280a43c29171b02768eab13c Mon Sep 17 00:00:00 2001 From: Diana <diana.stoll@stundent.uni-tuebingen.de> Date: Thu, 24 Oct 2024 10:13:04 +0200 Subject: [PATCH 1/4] changed --- code/plot_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/plot_functions.py b/code/plot_functions.py index 1f84e19..f8ea237 100644 --- a/code/plot_functions.py +++ b/code/plot_functions.py @@ -124,8 +124,8 @@ def plot_highlighted_integrals(frequency, power, points, color_mapping, points_c right_boundary = frequency[np.where((frequency > point + delta) & (frequency <= point + 5 * delta))[0][-1]] # Add vertical dashed lines at the boundaries of the adjacent regions - ax.axvline(x=left_boundary, color="k", linestyle="--") - ax.axvline(x=right_boundary, color="k", linestyle="--") + #ax.axvline(x=left_boundary, color="k", linestyle="--") + #ax.axvline(x=right_boundary, color="k", linestyle="--") ax.set_xlim([0, 1200]) ax.set_xlabel('Frequency (Hz)') From 6e54a8c508e5bb5f1fbb5d75406d9ab7e77f2975 Mon Sep 17 00:00:00 2001 From: Diana <diana.stoll@stundent.uni-tuebingen.de> Date: Thu, 24 Oct 2024 10:20:46 +0200 Subject: [PATCH 2/4] Changed my plot function --- code/useful_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/useful_functions.py b/code/useful_functions.py index 9f56b57..4bd1360 100644 --- a/code/useful_functions.py +++ b/code/useful_functions.py @@ -483,9 +483,9 @@ def valid_integrals(integral, local_mean, point, threshold = 0.1): """ valid = integral > (local_mean * (1 + threshold)) if valid: - print(f"The point {point} is valid, as its integral exceeds the threshold.") + print(f"The point {point} is valid.") else: - print(f"The point {point} is not valid, as its integral does not exceed the threshold.") + print(f"The point {point} is not valid.") return valid '''TODO Sarah: AM-freq plot: From b0d5d5ccfbdbf352dfe7cca9e599d35f2778718b Mon Sep 17 00:00:00 2001 From: Diana <diana.stoll@stundent.uni-tuebingen.de> Date: Thu, 24 Oct 2024 10:21:15 +0200 Subject: [PATCH 3/4] Changed my plot function --- code/plot_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/plot_functions.py b/code/plot_functions.py index f8ea237..78cfcea 100644 --- a/code/plot_functions.py +++ b/code/plot_functions.py @@ -114,7 +114,7 @@ def plot_highlighted_integrals(frequency, power, points, color_mapping, points_c ax.axvspan(point - delta, point + delta, color=color, alpha=0.3, label=f'{point:.2f} Hz') # Print out point and color - print(f"Integral around {point:.2f} Hz: {integral:.5e}, Color: {color}") + print(f"{points_categories}: {integral:.5e}, Color: {color}") # Annotate the plot with the point and its color ax.text(point, max(power) * 0.9, f'{point:.2f}', color=color, fontsize=10, ha='center') From 89b1254425aca1513e914f749f17e7c0bcce2276 Mon Sep 17 00:00:00 2001 From: Diana <diana.stoll@stundent.uni-tuebingen.de> Date: Thu, 24 Oct 2024 10:25:26 +0200 Subject: [PATCH 4/4] Changed my plot function --- code/plot_functions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/plot_functions.py b/code/plot_functions.py index 78cfcea..7bf001f 100644 --- a/code/plot_functions.py +++ b/code/plot_functions.py @@ -110,11 +110,14 @@ def plot_highlighted_integrals(frequency, power, points, color_mapping, points_c # Define color based on the category of the point color = next((c for cat, c in color_mapping.items() if point in points_categories[cat]), 'gray') + # Find the category of the point + point_category = next((cat for cat, pts in points_categories.items() if point in pts), "Unknown") + # Shade the region around the point where the integral was calculated ax.axvspan(point - delta, point + delta, color=color, alpha=0.3, label=f'{point:.2f} Hz') - # Print out point and color - print(f"{points_categories}: {integral:.5e}, Color: {color}") + # Print out point, category, and color + print(f"{point_category}: Integral: {integral:.5e}, Color: {color}") # Annotate the plot with the point and its color ax.text(point, max(power) * 0.9, f'{point:.2f}', color=color, fontsize=10, ha='center')