Esempio n. 1
0
        public void TestAverageFirstBin()
        {
            Average.AverageCorrelation avgCorr = new Average.AverageCorrelation();

            // Create an ensemble
            DataSet.Ensemble ens1 = EnsembleHelper.GenerateEnsemble(30);
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_0_INDEX] = 2;
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_1_INDEX] = 3;
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_2_INDEX] = 4;
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_3_INDEX] = 5;

            DataSet.Ensemble ens2 = EnsembleHelper.GenerateEnsemble(30);
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_0_INDEX] = 2;
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_1_INDEX] = 3;
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_2_INDEX] = 4;
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_3_INDEX] = 5;

            avgCorr.AddEnsemble(ens1);
            avgCorr.AddEnsemble(ens2);

            float[,] result = avgCorr.GetAverage();

            Assert.IsNotNull(result, "Result is incorrect.");
            Assert.AreEqual(2, result[0, DataSet.Ensemble.BEAM_0_INDEX], "Bin 0 Beam 0 is incorrect.");
            Assert.AreEqual(3, result[0, DataSet.Ensemble.BEAM_1_INDEX], "Bin 0 Beam 1 is incorrect.");
            Assert.AreEqual(4, result[0, DataSet.Ensemble.BEAM_2_INDEX], "Bin 0 Beam 2 is incorrect.");
            Assert.AreEqual(5, result[0, DataSet.Ensemble.BEAM_3_INDEX], "Bin 0 Beam 3 is incorrect.");
        }
Esempio n. 2
0
        public void TestAverage()
        {
            Average.AverageCorrelation avgCorr = new Average.AverageCorrelation();

            // Create an ensemble
            // All zeros for correlation
            DataSet.Ensemble ens1 = EnsembleHelper.GenerateEnsemble(30);
            DataSet.Ensemble ens2 = EnsembleHelper.GenerateEnsemble(30);

            avgCorr.AddEnsemble(ens1);
            avgCorr.AddEnsemble(ens2);

            float[,] result = avgCorr.GetAverage();

            Assert.IsNotNull(result, "Result is incorrect.");
            Assert.AreEqual(0, result[0, DataSet.Ensemble.BEAM_0_INDEX], "Bin 0 Beam 0 is incorrect.");
            Assert.AreEqual(0, result[0, DataSet.Ensemble.BEAM_1_INDEX], "Bin 0 Beam 1 is incorrect.");
            Assert.AreEqual(0, result[0, DataSet.Ensemble.BEAM_2_INDEX], "Bin 0 Beam 2 is incorrect.");
            Assert.AreEqual(0, result[0, DataSet.Ensemble.BEAM_3_INDEX], "Bin 0 Beam 3 is incorrect.");
        }
Esempio n. 3
0
        public void TestRunningAverageNumSamples()
        {
            Average.AverageCorrelation avgCorr = new Average.AverageCorrelation();
            avgCorr.NumSamples       = 2;
            avgCorr.IsRunningAverage = true;

            // Create an ensemble
            DataSet.Ensemble ens1 = EnsembleHelper.GenerateEnsemble(30);
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_0_INDEX] = 2;
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_1_INDEX] = 3;
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_2_INDEX] = 4;
            ens1.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_3_INDEX] = 5;

            DataSet.Ensemble ens2 = EnsembleHelper.GenerateEnsemble(30);
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_0_INDEX] = DataSet.Ensemble.BAD_VELOCITY;
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_1_INDEX] = DataSet.Ensemble.BAD_VELOCITY;
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_2_INDEX] = DataSet.Ensemble.BAD_VELOCITY;
            ens2.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_3_INDEX] = DataSet.Ensemble.BAD_VELOCITY;

            DataSet.Ensemble ens3 = EnsembleHelper.GenerateEnsemble(30);
            ens3.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_0_INDEX] = 6;
            ens3.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_1_INDEX] = 7;
            ens3.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_2_INDEX] = 8;
            ens3.CorrelationData.CorrelationData[0, DataSet.Ensemble.BEAM_3_INDEX] = 9;

            avgCorr.AddEnsemble(ens1);
            avgCorr.AddEnsemble(ens2);
            avgCorr.AddEnsemble(ens3);

            float[,] result = avgCorr.GetAverage();

            Assert.IsNotNull(result, "Result is incorrect.");
            Assert.AreEqual(4, result[0, DataSet.Ensemble.BEAM_0_INDEX], "Bin 0 Beam 0 is incorrect.");
            Assert.AreEqual(5, result[0, DataSet.Ensemble.BEAM_1_INDEX], "Bin 0 Beam 1 is incorrect.");
            Assert.AreEqual(6, result[0, DataSet.Ensemble.BEAM_2_INDEX], "Bin 0 Beam 2 is incorrect.");
            Assert.AreEqual(7, result[0, DataSet.Ensemble.BEAM_3_INDEX], "Bin 0 Beam 3 is incorrect.");
        }