Skip to content

Commit

Permalink
power_spectrum: allow plotting exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed Sep 26, 2024
1 parent 06f833c commit 6de315e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lumicks/pylake/force_calibration/power_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def with_spectrum(self, power) -> "PowerSpectrum":
total_samples_used=self.total_samples_used,
)

def plot(self, **kwargs):
def plot(self, *, show_excluded=False, **kwargs):
"""Plot power spectrum
Parameters
Expand All @@ -371,6 +371,11 @@ def plot(self, **kwargs):
"""
import matplotlib.pyplot as plt

if show_excluded:
plt.plot(self.unfiltered_frequency, self.unfiltered_power)
for f_min, f_max in self._excluded_ranges:
plt.axvspan(f_min, f_max, alpha=0.1, label="_")

plt.plot(self.frequency, self.power, **kwargs)
plt.xlabel("Frequency [Hz]")
plt.ylabel(f"Power [${self.unit}^2/Hz$]")
Expand Down

0 comments on commit 6de315e

Please sign in to comment.