public void DirectConvolutionTestMethod4()
        {
            DirectConvolution dc = new DirectConvolution();
            // test case 4 ..
            var expectedOutput = new Signal(new List <float>()
            {
                1, 1, -1, 0, 0, 3, 3, 2, 1
            }, new List <int>()
            {
                -2, -1, 0, 1, 2, 3, 4, 5, 6
            }, false);

            dc.InputSignal1 = new Signal(new List <float>()
            {
                1, 2, 1, 1
            }, new List <int>()
            {
                -2, -1, 0, 1
            }, false);

            dc.InputSignal2 = new Signal(new List <float>()
            {
                1, -1, 0, 0, 1, 1
            }, new List <int>()
            {
                0, 1, 2, 3, 4, 5
            }, false);

            dc.Run();

            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesAreEqual(expectedOutput.Samples, dc.OutputConvolvedSignal.Samples));
            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesIndicesAreEqual(expectedOutput, dc.OutputConvolvedSignal));
        }
        public void HighFilteredSignalTestMethod2()
        {
            FIR FIR = new FIR();

            var sig1 = UnitTestUtitlities.LoadSignal("TestingSignals/ecg400.ds");
            var expectedFilteredSignal = UnitTestUtitlities.LoadSignal("TestingSignals/ecg_high_pass_filtered.ds");

            FIR.InputFilterType          = DSPAlgorithms.DataStructures.FILTER_TYPES.HIGH;
            FIR.InputFS                  = 8000;
            FIR.InputStopBandAttenuation = 70;
            FIR.InputCutOffFrequency     = 1500;
            FIR.InputTransitionBand      = 500;

            FIR.InputTimeDomainSignal = sig1;

            FIR.Run();

            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesIndicesAreEqual(expectedFilteredSignal, FIR.OutputYn));
        }
        public void LowCoefficientsTestMethod1()
        {
            FIR FIR = new FIR();

            var sig1 = UnitTestUtitlities.LoadSignal("TestingSignals/ecg400.ds");
            var expectedCoefficients = UnitTestUtitlities.LoadSignal("TestingSignals/LPFCoefficients.ds");

            FIR.InputFilterType          = DSPAlgorithms.DataStructures.FILTER_TYPES.LOW;
            FIR.InputFS                  = 8000;
            FIR.InputStopBandAttenuation = 50;
            FIR.InputCutOffFrequency     = 1500;
            FIR.InputTransitionBand      = 500;

            FIR.InputTimeDomainSignal = sig1;

            FIR.Run();

            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesIndicesAreEqual(expectedCoefficients, FIR.OutputHn));
        }
        public void BandStopFilteredSignalTestMethod4()
        {
            FIR FIR = new FIR();

            var sig1 = UnitTestUtitlities.LoadSignal("TestingSignals/ecg400.ds");
            var expectedFilteredSignal = UnitTestUtitlities.LoadSignal("TestingSignals/ecg_band_stop_filtered.ds");

            FIR.InputFilterType = DSPAlgorithms.DataStructures.FILTER_TYPES.BAND_STOP;

            FIR.InputFS = 1000;
            FIR.InputStopBandAttenuation = 60;
            FIR.InputF1             = 150;
            FIR.InputF2             = 250;
            FIR.InputTransitionBand = 50;

            FIR.InputTimeDomainSignal = sig1;

            FIR.Run();

            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesIndicesAreEqual(expectedFilteredSignal, FIR.OutputYn));
        }
        public void BandPassCoefficientsTestMethod3()
        {
            FIR FIR = new FIR();

            var sig1 = UnitTestUtitlities.LoadSignal("TestingSignals/ecg400.ds");
            var expectedCoefficients = UnitTestUtitlities.LoadSignal("TestingSignals/BPFCoefficients.ds");

            FIR.InputFilterType = DSPAlgorithms.DataStructures.FILTER_TYPES.BAND_PASS;

            FIR.InputFS = 1000;
            FIR.InputStopBandAttenuation = 60;
            FIR.InputF1             = 150;
            FIR.InputF2             = 250;
            FIR.InputTransitionBand = 50;

            FIR.InputTimeDomainSignal = sig1;

            FIR.Run();

            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesIndicesAreEqual(expectedCoefficients, FIR.OutputHn));
        }
 public void ShiftingAndFoldingValidation()
 {
     Assert.IsTrue(UnitTestUtitlities.SignalsSamplesIndicesAreEqual(expectedOutputSignal, actualOutputSignal));
 }