コード例 #1
0
        public void GuideStepsHistory_ClearTest()
        {
            var historySize = 100;
            var scale       = 1.59;

            GuideStepsHistory gsh = new GuideStepsHistory(historySize, GuiderScaleEnum.ARCSECONDS, 4);

            gsh.PixelScale = scale;

            IGuideStep step1 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -25,
                DECDistanceRaw = -36
            };

            IGuideStep step2 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -625,
                DECDistanceRaw = -1296
            };

            IGuideStep step3 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -25,
                DECDistanceRaw = -36
            };

            IGuideStep step4 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -625,
                DECDistanceRaw = -1296
            };

            gsh.AddGuideStep(step1);
            gsh.AddGuideStep(step2);
            gsh.AddGuideStep(step3);
            gsh.AddGuideStep(step4);

            gsh.Clear();

            Assert.AreEqual(0, gsh.GuideSteps.Count);
            Assert.AreEqual(0, gsh.RMS.RA);
            Assert.AreEqual(0, gsh.RMS.Dec);
            Assert.AreEqual(0, gsh.RMS.Total);
        }
コード例 #2
0
        public void GuideStepsHistory_AddPHDDataPointsScaledTest()
        {
            var historySize = 100;
            var scale       = 1.59;

            GuideStepsHistory gsh = new GuideStepsHistory(historySize, GuiderScaleEnum.ARCSECONDS, 4);

            gsh.PixelScale = scale;

            IGuideStep step1 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -25,
                DECDistanceRaw = -36
            };

            IGuideStep step2 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -625,
                DECDistanceRaw = -1296
            };

            IGuideStep step3 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -25,
                DECDistanceRaw = -36
            };

            IGuideStep step4 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -625,
                DECDistanceRaw = -1296
            };

            gsh.AddGuideStep(step1);
            gsh.AddGuideStep(step2);
            gsh.AddGuideStep(step3);
            gsh.AddGuideStep(step4);

            Assert.AreEqual(300, gsh.RMS.RA);
            Assert.AreEqual(630, gsh.RMS.Dec);
            var total = Math.Sqrt((Math.Pow(300, 2) + Math.Pow(630, 2)));

            Assert.AreEqual(total, gsh.RMS.Total);
        }
コード例 #3
0
        public void GuideStepsHistory_HistorySize_AddMoreThanSizeTest()
        {
            var historySize       = 5;
            GuideStepsHistory gsh = new GuideStepsHistory(historySize, GuiderScaleEnum.PIXELS, 4);

            IGuideStep step1 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -1,
                DECDistanceRaw = -1
            };

            IGuideStep step2 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -2,
                DECDistanceRaw = -2
            };

            IGuideStep step3 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -3,
                DECDistanceRaw = -3
            };

            IGuideStep step4 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -4,
                DECDistanceRaw = -4
            };

            IGuideStep step5 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -5,
                DECDistanceRaw = -5
            };

            IGuideStep step6 = new PHD2Guider.PhdEventGuideStep()
            {
                RADistanceRaw  = -6,
                DECDistanceRaw = -6
            };

            gsh.AddGuideStep(step1);
            gsh.AddGuideStep(step2);
            gsh.AddGuideStep(step3);
            gsh.AddGuideStep(step4);
            gsh.AddGuideStep(step5);
            gsh.AddGuideStep(step6);

            Assert.AreEqual(step2.RADistanceRaw, gsh.GuideSteps.ElementAt(0).RADistanceRaw);
            Assert.AreEqual(step3.RADistanceRaw, gsh.GuideSteps.ElementAt(1).RADistanceRaw);
            Assert.AreEqual(step4.RADistanceRaw, gsh.GuideSteps.ElementAt(2).RADistanceRaw);
            Assert.AreEqual(step5.RADistanceRaw, gsh.GuideSteps.ElementAt(3).RADistanceRaw);
            Assert.AreEqual(step6.RADistanceRaw, gsh.GuideSteps.ElementAt(4).RADistanceRaw);
            Assert.AreEqual(step2.DECDistanceRaw, gsh.GuideSteps.ElementAt(0).DECDistanceRaw);
            Assert.AreEqual(step3.DECDistanceRaw, gsh.GuideSteps.ElementAt(1).DECDistanceRaw);
            Assert.AreEqual(step4.DECDistanceRaw, gsh.GuideSteps.ElementAt(2).DECDistanceRaw);
            Assert.AreEqual(step5.DECDistanceRaw, gsh.GuideSteps.ElementAt(3).DECDistanceRaw);
            Assert.AreEqual(step6.DECDistanceRaw, gsh.GuideSteps.ElementAt(4).DECDistanceRaw);
        }
コード例 #4
0
ファイル: GuiderVM.cs プロジェクト: daleghent/NINA
        private void Guider_GuideEvent(object sender, IGuideStep e)
        {
            try {
                var step = e;

                GuideStepsHistory.AddGuideStep(step);

                foreach (RMS rms in recordedRMS.Values)
                {
                    rms.AddDataPoint(step.RADistanceRaw, step.DECDistanceRaw);
                }
            } catch (Exception ex) {
                Logger.Error(ex);
            }
        }
コード例 #5
0
        public void GuideStepsHistory_MaxDurationY_CalculateWhenResizedTest()
        {
            var historySize       = 3;
            GuideStepsHistory gsh = new GuideStepsHistory(historySize, GuiderScaleEnum.PIXELS, 4);

            IGuideStep step1 = new PHD2Guider.PhdEventGuideStep()
            {
                RADuration  = -100,
                DECDuration = -100
            };

            IGuideStep step2 = new PHD2Guider.PhdEventGuideStep()
            {
                RADuration  = -20,
                DECDuration = -20
            };

            IGuideStep step3 = new PHD2Guider.PhdEventGuideStep()
            {
                RADuration  = -3,
                DECDuration = -3
            };

            IGuideStep step4 = new PHD2Guider.PhdEventGuideStep()
            {
                RADuration  = -4,
                DECDuration = -4
            };

            IGuideStep step5 = new PHD2Guider.PhdEventGuideStep()
            {
                RADuration  = -5,
                DECDuration = -5
            };

            IGuideStep step6 = new PHD2Guider.PhdEventGuideStep()
            {
                RADuration  = -6,
                DECDuration = -6
            };

            gsh.AddGuideStep(step1);
            gsh.AddGuideStep(step2);
            gsh.AddGuideStep(step3);
            gsh.AddGuideStep(step4);
            gsh.AddGuideStep(step5);
            gsh.AddGuideStep(step6);

            gsh.HistorySize = 100;

            Assert.AreEqual(100, gsh.MaxDurationY);
            Assert.AreEqual(-100, gsh.MinDurationY);
        }