internal static PSFFit GetPSFFitForPeakPixel( uint[,] data, PotentialStarStruct starToTest, float aboveNoiseLevelRequired, double minFWHM, double maxFWHM) { int STAR_MATRIX_FIT = TangraConfig.Settings.Special.StarFinderFitArea; double MIN_DISTANCE_OF_PEAK_PIXEL_FROM_CENTER = TangraConfig.Settings.Special.StarFinderMinDistanceOfPeakPixelFromCenter; PSFFit fit = new PSFFit(starToTest.X, starToTest.Y); int fitMatrix = (int)Math.Min(data.GetLength(0), STAR_MATRIX_FIT + 2); // Get a matrix with 1 pixel larger each way and set the border pixels to zero fit.Fit(data, fitMatrix, starToTest.X, starToTest.Y, true); if (fit.IsSolved) { double distanceFromCenter = ImagePixel.ComputeDistance(fit.X0_Matrix, fitMatrix / 2, fit.Y0_Matrix, fitMatrix / 2); if (fit.Certainty > 0 && fit.FWHM >= minFWHM && fit.FWHM <= maxFWHM && distanceFromCenter < MIN_DISTANCE_OF_PEAK_PIXEL_FROM_CENTER && fit.IMax > aboveNoiseLevelRequired) { //not good for lost tracking allow higher FWHM // This object passes all tests to be furhter considered as a star return(fit); } } return(null); }
public static PSFFit GetPSFFitForPeakPixel( uint[,] data, PotentialStarStruct starToTest, float aboveNoiseLevelRequired, double minFWHM, double maxFWHM) { int STAR_MATRIX_FIT = TangraConfig.Settings.Special.StarFinderFitArea; double MIN_DISTANCE_OF_PEAK_PIXEL_FROM_CENTER = TangraConfig.Settings.Special.StarFinderMinDistanceOfPeakPixelFromCenter; PSFFit fit = new PSFFit(starToTest.X, starToTest.Y); int fitMatrix = (int)Math.Min(data.GetLength(0), STAR_MATRIX_FIT + 2); // Get a matrix with 1 pixel larger each way and set the border pixels to zero fit.Fit(data, fitMatrix, starToTest.X, starToTest.Y, true); if (fit.IsSolved) { double distanceFromCenter = ImagePixel.ComputeDistance(fit.X0_Matrix, fitMatrix / 2, fit.Y0_Matrix, fitMatrix / 2); if (fit.Certainty > 0 && fit.FWHM >= minFWHM && fit.FWHM <= maxFWHM && distanceFromCenter < MIN_DISTANCE_OF_PEAK_PIXEL_FROM_CENTER && fit.IMax > aboveNoiseLevelRequired) { //not good for lost tracking allow higher FWHM // This object passes all tests to be furhter considered as a star return fit; } } return null; }