rework patternByWavelet
the pattern recognition by wavelet algorithm need to be revised. Also the test for it.