In [1]:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import sys
sys.path.insert(0, 'C:\Users\Dominik\Documents\GitRep\kt-2015-DSPHandsOn\MedianFilter\Python') #Add a new path with needed .py files
import functions
import gitInformation
In [2]:
gitInformation.printInformation()
In [3]:
%matplotlib inline
I am adding white noise to the sine wave to simulate a more realistic wave. Then I am plotting the sine waves with different wave numbers , the filtered wave and the difference between filtered and original wave.
In [ ]:
pp = PdfPages('median sin with white noise.pdf')
for z in range (3, 16, 2):
# Creates different figures in one plot, z is the window length.
fig = plt.figure(z, figsize=(30, 20))
for x in range(1, 5):
for y in range(1, 6):
# Creates different subplots in one figure,
# with x and y the wave number is calculated.
plt.subplot(5, 5, x + (y-1)*4)
wavenum = (x-1) + (y-1)*4
functions.medianSinPlotNoised( wavenum, z )
plt.suptitle('Median filtered, noised sine waves with window length '
+ str(z), fontsize = 60)
plt.xlabel(("Wave number = " + str((x-1) + (y-1)*4)), fontsize=18)
pp.savefig(fig)
pp.close()