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

%matplotlib inline

gitInformation.printInformation()

"""
Explanation: Basic median filter
2015.10.06 DW KT
End of explanation
"""


median = plt.figure(figsize=(30,20))
for x in range(1, 5):
    for y in range(1, 6):
        plt.subplot(5, 5, x + (y-1)*4)
        wavenum = (x-1) + (y-1)*4
        functions.medianSinPlot(wavenum, 15)
        plt.suptitle('Median filtered Sine Waves with window length 15', fontsize = 60)
        plt.xlabel(("Wave number = "+str((x-1) + (y-1)*4)), fontsize=18)

"""
Explanation: Testing the median filter with a fixed window length of 16.
End of explanation
"""


pp=PdfPages( 'median sin window length 15.pdf' )
pp.savefig( median )
pp.close()

"""
Explanation: Summary

with higher wave numbers (n=10), the filter makes the signal even worse with a phase (amplitude) reversal!
a bit of ailiasing, would benefit from more sample points

Graphic Export
End of explanation
"""


