import pyfar as pf
import matplotlib.pyplot as plt
f_range = (10, 20000)
nominals_third, weights_A = pf.constants.frequency_weighting_band_corrections(
    "A", 3, f_range)
nominals_octave, weights_C = pf.constants.frequency_weighting_band_corrections(
    "C", 1, f_range)
plt.plot(nominals_third, weights_A, "--", c=(0.5, 0.5, 0.5, 0.5))
plt.plot(nominals_third, weights_A, "bo", label="A weighting in third bands")
plt.plot(nominals_octave, weights_C, "--", c=(0.5, 0.5, 0.5, 0.5))
plt.plot(nominals_octave, weights_C, "go", label="C weighting in octave bands")
plt.legend()
ticks = nominals_octave[::2].astype(int)
plt.semilogx()
plt.xticks(ticks, ticks)
plt.xlabel("f in Hz")
plt.ylabel("Corrections in dB")
plt.grid()
