public void TestGetWaveletFromName()
 {
     Assert.AreEqual("db4", CommonMotherWavelets.GetWaveletFromName("DB4").Name);
     Assert.AreEqual("db4", CommonMotherWavelets.GetWaveletFromName("Daub4").Name);
     Assert.AreEqual("db4", CommonMotherWavelets.GetWaveletFromName("D4").Name);
     Assert.IsNull(CommonMotherWavelets.GetWaveletFromName("abcd"));
 }
        public void TestGetNoDisturbances()
        {
            var signal       = new Signal(0, 0, 0, 0, 0, 0, 0, 0);
            var levels       = DWT.ExecuteDWT(signal, CommonMotherWavelets.GetWaveletFromName("db4"), 1);
            var disturbances = levels[0].GetDisturbances(0.01, 2);

            Assert.AreEqual(0, disturbances.Count);
        }
        public void TestGetDisturbances()
        {
            var signal       = new Signal(1, 1, 1, 1, 1, 1, 1, 0.5, 2, 1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1, 1, 4, 5, 4, 5, 1);
            var levels       = DWT.ExecuteDWT(signal, CommonMotherWavelets.GetWaveletFromName("haar"), 1);
            var disturbances = levels[0].GetDisturbances(0.01, 2);

            Assert.AreEqual(3, disturbances.Count);
        }
        public void TestGetDisturbancesSag()
        {
            var samples = ReadFile("sag.csv");
            var signal  = new Signal(samples);
            var levels  = DWT.ExecuteDWT(signal, CommonMotherWavelets.GetWaveletFromName("db10"), 2);

            var disturbances = levels[1].GetDisturbances(0.001, 10);

            Assert.AreEqual(4, disturbances.Count);
        }
Exemple #5
0
        public void SelectWavelet(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            string waveName = (sender as System.Windows.Controls.ComboBox).SelectedItem as string;

            if (waveName != null)
            {
                currentWavelet = CommonMotherWavelets.GetWaveletFromName(waveName);
                chosenWavelet  = currentWavelet.Name;
            }
        }
        public WaveletReconstruction Create(int sampleRate)
        {
            var motherWavelet = CommonMotherWavelets.GetWaveletFromName(MotherWaveletName);

            if (motherWavelet == null)
            {
                return(null);
            }
            return(new WaveletReconstruction(WindowSize, ConvolutionMode,
                                             ExtensionMode, motherWavelet, Level, sampleRate, AvgLevel));
        }
        public void TestGetDisturbances2Levels()
        {
            var signal = new Signal(-10, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 1, 1, 1, 6, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.1, -0.5, 2, -1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1.5, 1.9, 0.2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 10, -11, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 2, 2, 2, -12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 5, -1, 2, 3, 11, 12, -4, -1, -1, 1, 3, 2, 8, 7, 4, 6, 6, 7);
            var levels = DWT.ExecuteDWT(signal, CommonMotherWavelets.GetWaveletFromName("haar"), 2);

            var disturbances = levels[0].GetDisturbances(0.05);

            Assert.AreEqual(10, disturbances.Count);

            disturbances = levels[1].GetDisturbances(0.05);
            Assert.AreEqual(7, disturbances.Count);
        }
Exemple #8
0
        private bool LoadWavelets(string waveletName)
        {
            if (waveletName.Contains("|"))
            {
                waveletName = waveletName.Split('|')[0];
            }
            else if (waveletName.Contains("("))
            {
                waveletName = waveletName.Split('(')[1].Replace(")", "");
            }

            if (_motherWavelet == null || waveletName != WaveletName)
            {
                var motherWavelet = CommonMotherWavelets.GetWaveletFromName(waveletName);
                if (motherWavelet == null)
                {
                    return(false);
                }
                _motherWavelet = motherWavelet;
            }
            return(true);
        }