public void Test1() { var matrix = new CCDMatrix(8.6, 8.3, 752, 582); var astroPlate = new AstroPlate(matrix, 720, 576, 8); var userStars = new Dictionary <ImagePixel, IStar>(); var star1 = new TestStar(2890001240, 18.528885242458674, -32.262447583319769, 11.033); var pixel1 = new ImagePixel(72.0519465443632, 240.48754416283302); userStars.Add(pixel1, star1); var star2 = new TestStar(2890001234, 18.353495385568369, -32.296976944037546, 12.294); var pixel2 = new ImagePixel(421.79863331879409, 329.57539665223919); userStars.Add(pixel2, star2); var star3 = new TestStar(2890001229, 18.284537781225755, -32.213242615932892, 10.882); var pixel3 = new ImagePixel(559.51676838260289, 114.86160161500557); userStars.Add(pixel3, star3); var plateSolve = DirectTransRotAstrometry.SolveByThreeStars(astroPlate, userStars, 2); Assert.IsNotNull(plateSolve); Assert.AreEqual(1.2836, plateSolve.Aspect, 0.0001); Assert.AreEqual(-32.2808, plateSolve.DE0Deg, 0.0001); Assert.AreEqual(18.3845, plateSolve.RA0Deg, 0.0001); Assert.AreEqual(179.9401, plateSolve.EtaDeg, 0.0001); Assert.AreEqual(0.00, plateSolve.Residual, 0.01); var newAstro = new ThreeStarAstrometry(astroPlate, userStars, 2); Assert.IsTrue(newAstro.Success); Assert.AreEqual(-32.2808, newAstro.DE0Deg, 0.0001); Assert.AreEqual(18.3845, newAstro.RA0Deg, 0.0001); double ra, de; newAstro.GetRADEFromImageCoords(72.0519465443632, 240.48754416283302, out ra, out de); Assert.AreEqual(18.5288852, ra, 0.0000001); Assert.AreEqual(-32.2624475, de, 0.0000001); double x, y; newAstro.GetImageCoordsFromRADE(18.528885242458674, -32.262447583319769, out x, out y); Assert.AreEqual(72.0519, x, 0.0001); Assert.AreEqual(240.4875, y, 0.0001); }
public void Test1() { var matrix = new CCDMatrix(8.6, 8.3, 752, 582); var astroPlate = new AstroPlate(matrix, 720, 576, 8); var userStars = new Dictionary<ImagePixel, IStar>(); var star1 = new TestStar(2890001240, 18.528885242458674, -32.262447583319769, 11.033); var pixel1 = new ImagePixel(72.0519465443632, 240.48754416283302); userStars.Add(pixel1, star1); var star2 = new TestStar(2890001234, 18.353495385568369, -32.296976944037546, 12.294); var pixel2 = new ImagePixel(421.79863331879409, 329.57539665223919); userStars.Add(pixel2, star2); var star3 = new TestStar(2890001229, 18.284537781225755, -32.213242615932892, 10.882); var pixel3 = new ImagePixel(559.51676838260289, 114.86160161500557); userStars.Add(pixel3, star3); var plateSolve = DirectTransRotAstrometry.SolveByThreeStars(astroPlate, userStars, 2); Assert.IsNotNull(plateSolve); Assert.AreEqual(1.2836, plateSolve.Aspect, 0.0001); Assert.AreEqual(-32.2808, plateSolve.DE0Deg, 0.0001); Assert.AreEqual(18.3845, plateSolve.RA0Deg, 0.0001); Assert.AreEqual(179.9401, plateSolve.EtaDeg, 0.0001); Assert.AreEqual(0.00, plateSolve.Residual, 0.01); var newAstro = new ThreeStarAstrometry(astroPlate, userStars, 2); Assert.IsTrue(newAstro.Success); Assert.AreEqual(-32.2808, newAstro.DE0Deg, 0.0001); Assert.AreEqual(18.3845, newAstro.RA0Deg, 0.0001); double ra, de; newAstro.GetRADEFromImageCoords(72.0519465443632, 240.48754416283302, out ra, out de); Assert.AreEqual(18.5288852, ra, 0.0000001); Assert.AreEqual(-32.2624475, de, 0.0000001); double x, y; newAstro.GetImageCoordsFromRADE(18.528885242458674, -32.262447583319769, out x, out y); Assert.AreEqual(72.0519, x, 0.0001); Assert.AreEqual(240.4875, y, 0.0001); }
public void Test2_NearSouthPole() { var matrix = new CCDMatrix(8.6, 8.3, 752, 582); var astroPlate = new AstroPlate(matrix, 720, 576, 16); var userStars = new Dictionary <ImagePixel, IStar>(); var star1 = new TestStar(670000669, 14.040622402203727, -76.691539882008868, 13.389); var pixel1 = new ImagePixel(111.28789147012657, 170.18336583345945); userStars.Add(pixel1, star1); var star2 = new TestStar(680000642, 13.3447869927272, -76.594950217617452, 9.932); var pixel2 = new ImagePixel(575.00594900921817, 446.45890095859744); userStars.Add(pixel2, star2); var star3 = new TestStar(670000641, 13.550035599758042, -76.722167259223085, 13.842); var pixel3 = new ImagePixel(425.86138030460097, 63.057739094752051); userStars.Add(pixel3, star3); var newAstro = new ThreeStarAstrometry(astroPlate, userStars, 2); Assert.IsTrue(newAstro.Success); Assert.AreEqual(-76.6498, newAstro.DE0Deg, 0.0001); Assert.AreEqual(13.6644, newAstro.RA0Deg, 0.0001); double ra, de; newAstro.GetRADEFromImageCoords(111.28789147012657, 170.18336583345945, out ra, out de); Assert.AreEqual(14.0406224, ra, 0.0000001); Assert.AreEqual(-76.6915398, de, 0.0000001); double x, y; newAstro.GetImageCoordsFromRADE(14.040622402203727, -76.691539882008868, out x, out y); Assert.AreEqual(111.2879, x, 0.0001); Assert.AreEqual(170.1833, y, 0.0001); }
public override void MouseDown(Point location) { if (m_SelectedCalibrationStar != null) { frmIdentifyCalibrationStar frmIdentifyCalibrationStar = new frmIdentifyCalibrationStar(m_CatalogueStars, m_UserStarIdentification); DialogResult res = m_VideoController.ShowDialog(frmIdentifyCalibrationStar); if (res == DialogResult.Abort) { m_UserStarIdentification.Clear(); } else if (res == DialogResult.OK && frmIdentifyCalibrationStar.SelectedStar != null) { m_UserStarIdentification.Add(m_SelectedCalibrationStar, frmIdentifyCalibrationStar.SelectedStar); if (m_UserStarIdentification.Keys.Count > 0 && m_UserStarIdentification.Keys.Count < 3) { m_VideoController.ShowMessageBox( string.Format("Identify another {0} star(s) to attempt calibration", 3 - m_UserStarIdentification.Keys.Count), "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (m_UserStarIdentification.Keys.Count > 2) { List <PSFFit> keysList = m_UserStarIdentification.Keys.ToList(); IStar star1 = m_UserStarIdentification[keysList[0]]; IStar star2 = m_UserStarIdentification[keysList[1]]; IStar star3 = m_UserStarIdentification[keysList[2]]; double ArcSec1 = 1 / 3600.0; bool badRA = false; bool badDE = false; if (Math.Abs(star1.RADeg - star2.RADeg) < ArcSec1 || Math.Abs(star1.RADeg - star3.RADeg) < ArcSec1 || Math.Abs(star2.RADeg - star3.RADeg) < ArcSec1) { badRA = true; } if (Math.Abs(star1.DEDeg - star2.DEDeg) < ArcSec1 || Math.Abs(star1.DEDeg - star3.DEDeg) < ArcSec1 || Math.Abs(star2.DEDeg - star3.DEDeg) < ArcSec1) { badDE = true; } if (badRA) { m_VideoController.ShowMessageBox( "Two of the stars have almost identical Right Ascension. Please try again with different stars.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error); m_UserStarIdentification.Clear(); } else if (badDE) { m_VideoController.ShowMessageBox( "Two of the stars have almost identical Declination. Please try again with different stars.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error); m_UserStarIdentification.Clear(); } else { ThreeStarAstrometry threeStarSolution = ThreeStarAstrometry.SolveByThreeStars(m_Image, m_UserStarIdentification, m_Tolerance); if (threeStarSolution != null) { m_SolvedPlate = threeStarSolution; m_PlatesolveController.UpdateFocalLength((int)Math.Round(threeStarSolution.Image.EffectiveFocalLength)); m_RADegCenter = threeStarSolution.RA0Deg; m_DEDegCenter = threeStarSolution.DE0Deg; m_Image.EffectiveFocalLength = threeStarSolution.Image.EffectiveFocalLength; m_UserStarIdentification.Clear(); m_AstrometryController.RunCalibrationWithCurrentPreliminaryFit(); } else { m_VideoController.ShowMessageBox( "Cannot complete calibration. Please try again with higher initial fit tolerance and/or with different stars. Be sure that the stars are well separated.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Error); m_UserStarIdentification.Remove(m_UserStarIdentification.Keys.ToList()[2]); } } } } DrawCatalogStarsFit(); } else { m_StarPoint = new Point(location.X, location.Y); m_Panning = true; m_VideoController.SetPictureBoxCursor(CustomCursors.PanEnabledCursor); } }
public void Test2_NearSouthPole() { var matrix = new CCDMatrix(8.6, 8.3, 752, 582); var astroPlate = new AstroPlate(matrix, 720, 576, 16); var userStars = new Dictionary<ImagePixel, IStar>(); var star1 = new TestStar(670000669, 14.040622402203727, -76.691539882008868, 13.389); var pixel1 = new ImagePixel(111.28789147012657, 170.18336583345945); userStars.Add(pixel1, star1); var star2 = new TestStar(680000642, 13.3447869927272, -76.594950217617452, 9.932); var pixel2 = new ImagePixel(575.00594900921817, 446.45890095859744); userStars.Add(pixel2, star2); var star3 = new TestStar(670000641, 13.550035599758042, -76.722167259223085, 13.842); var pixel3 = new ImagePixel(425.86138030460097, 63.057739094752051); userStars.Add(pixel3, star3); var newAstro = new ThreeStarAstrometry(astroPlate, userStars, 2); Assert.IsTrue(newAstro.Success); Assert.AreEqual(-76.6498, newAstro.DE0Deg, 0.0001); Assert.AreEqual(13.6644, newAstro.RA0Deg, 0.0001); double ra, de; newAstro.GetRADEFromImageCoords(111.28789147012657, 170.18336583345945, out ra, out de); Assert.AreEqual(14.0406224, ra, 0.0000001); Assert.AreEqual(-76.6915398, de, 0.0000001); double x, y; newAstro.GetImageCoordsFromRADE(14.040622402203727, -76.691539882008868, out x, out y); Assert.AreEqual(111.2879, x, 0.0001); Assert.AreEqual(170.1833, y, 0.0001); }