예제 #1
0
        public static PlateConstantsFit FromReflectedObject(object reflObj)
        {
            string constType = reflObj.GetType().ToString();

            if (constType.Contains("PlateConstantsLinearFit"))
            {
                return(PlateConstantsLinearFit.FromReflectedLinearFit(reflObj));
            }
            else if (constType.Contains("PlateConstantsQadraticFit"))
            {
                return(PlateConstantsQadraticFit.FromReflectedQadraticFit(reflObj));
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public static PlateConstantsFit LeastSquareSolve(
            List <PlateConstStarPair> pairs,
            double ra0Deg,
            double de0Deg,
            FitOrder fitOrder,
            int minNumberOfStars)
        {
            if (fitOrder == FitOrder.Linear)
            {
                PlateConstantsLinearFit linearFit = new PlateConstantsLinearFit(pairs);
                try
                {
                    if (linearFit.LeastSquareSolve(ra0Deg, de0Deg, minNumberOfStars))
                    {
                        return(linearFit);
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("{0} exception during PlateConstantsFit.", ex.GetType().Name);
                    return(null);
                }
            }

            if (fitOrder == FitOrder.Quadratic)
            {
                PlateConstantsQadraticFit qadraticFit = new PlateConstantsQadraticFit(pairs);
                try
                {
                    if (qadraticFit.LeastSquareSolve(ra0Deg, de0Deg, minNumberOfStars))
                    {
                        return(qadraticFit);
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("{0} exception during PlateConstantsFit.", ex.GetType().Name);
                    return(null);
                }
            }

            return(null);
        }
예제 #3
0
        public static PlateConstantsQadraticFit FromReflectedQadraticFit(object reflObj)
        {
            var rv = new PlateConstantsQadraticFit();

            rv.Const_A = StarMap.GetPropValue <double>(reflObj, "Const_A");
            rv.Const_B = StarMap.GetPropValue <double>(reflObj, "Const_B");
            rv.Const_C = StarMap.GetPropValue <double>(reflObj, "Const_C");
            rv.Const_D = StarMap.GetPropValue <double>(reflObj, "Const_D");
            rv.Const_E = StarMap.GetPropValue <double>(reflObj, "Const_E");
            rv.Const_F = StarMap.GetPropValue <double>(reflObj, "Const_F");
            rv.Const_G = StarMap.GetPropValue <double>(reflObj, "Const_G");
            rv.Const_H = StarMap.GetPropValue <double>(reflObj, "Const_H");
            rv.Const_K = StarMap.GetPropValue <double>(reflObj, "Const_K");
            rv.Const_L = StarMap.GetPropValue <double>(reflObj, "Const_L");
            rv.Const_M = StarMap.GetPropValue <double>(reflObj, "Const_M");
            rv.Const_N = StarMap.GetPropValue <double>(reflObj, "Const_N");

            rv.Const_A1 = StarMap.GetPropValue <double>(reflObj, "Const_A1");
            rv.Const_B1 = StarMap.GetPropValue <double>(reflObj, "Const_B1");
            rv.Const_C1 = StarMap.GetPropValue <double>(reflObj, "Const_C1");
            rv.Const_D1 = StarMap.GetPropValue <double>(reflObj, "Const_D1");
            rv.Const_E1 = StarMap.GetPropValue <double>(reflObj, "Const_E1");
            rv.Const_F1 = StarMap.GetPropValue <double>(reflObj, "Const_F1");
            rv.Const_G1 = StarMap.GetPropValue <double>(reflObj, "Const_G1");
            rv.Const_H1 = StarMap.GetPropValue <double>(reflObj, "Const_H1");
            rv.Const_K1 = StarMap.GetPropValue <double>(reflObj, "Const_K1");
            rv.Const_L1 = StarMap.GetPropValue <double>(reflObj, "Const_L1");
            rv.Const_M1 = StarMap.GetPropValue <double>(reflObj, "Const_M1");
            rv.Const_N1 = StarMap.GetPropValue <double>(reflObj, "Const_N1");

            rv.m_FitInfo = new FitInfo(new List <PlateConstStarPair>());
            object fitInfo = StarMap.GetPropValue <object>(reflObj, "m_FitInfo");

            rv.m_FitInfo.FittedFocalLength = StarMap.GetPropValue <double>(fitInfo, "FittedFocalLength");

            return(rv);
        }
예제 #4
0
        public static PlateConstantsQadraticFit FromReflectedQadraticFit(object reflObj)
        {
            var rv = new PlateConstantsQadraticFit();

            rv.Const_A = StarMap.GetPropValue<double>(reflObj, "Const_A");
            rv.Const_B = StarMap.GetPropValue<double>(reflObj, "Const_B");
            rv.Const_C = StarMap.GetPropValue<double>(reflObj, "Const_C");
            rv.Const_D = StarMap.GetPropValue<double>(reflObj, "Const_D");
            rv.Const_E = StarMap.GetPropValue<double>(reflObj, "Const_E");
            rv.Const_F = StarMap.GetPropValue<double>(reflObj, "Const_F");
            rv.Const_G = StarMap.GetPropValue<double>(reflObj, "Const_G");
            rv.Const_H = StarMap.GetPropValue<double>(reflObj, "Const_H");
            rv.Const_K = StarMap.GetPropValue<double>(reflObj, "Const_K");
            rv.Const_L = StarMap.GetPropValue<double>(reflObj, "Const_L");
            rv.Const_M = StarMap.GetPropValue<double>(reflObj, "Const_M");
            rv.Const_N = StarMap.GetPropValue<double>(reflObj, "Const_N");

            rv.Const_A1 = StarMap.GetPropValue<double>(reflObj, "Const_A1");
            rv.Const_B1 = StarMap.GetPropValue<double>(reflObj, "Const_B1");
            rv.Const_C1 = StarMap.GetPropValue<double>(reflObj, "Const_C1");
            rv.Const_D1 = StarMap.GetPropValue<double>(reflObj, "Const_D1");
            rv.Const_E1 = StarMap.GetPropValue<double>(reflObj, "Const_E1");
            rv.Const_F1 = StarMap.GetPropValue<double>(reflObj, "Const_F1");
            rv.Const_G1 = StarMap.GetPropValue<double>(reflObj, "Const_G1");
            rv.Const_H1 = StarMap.GetPropValue<double>(reflObj, "Const_H1");
            rv.Const_K1 = StarMap.GetPropValue<double>(reflObj, "Const_K1");
            rv.Const_L1 = StarMap.GetPropValue<double>(reflObj, "Const_L1");
            rv.Const_M1 = StarMap.GetPropValue<double>(reflObj, "Const_M1");
            rv.Const_N1 = StarMap.GetPropValue<double>(reflObj, "Const_N1");

            rv.m_FitInfo = new FitInfo(new List<PlateConstStarPair>());
            object fitInfo = StarMap.GetPropValue<object>(reflObj, "m_FitInfo");
            rv.m_FitInfo.FittedFocalLength = StarMap.GetPropValue<double>(fitInfo, "FittedFocalLength");

            return rv;
        }
예제 #5
0
        public static PlateConstantsFit LeastSquareSolve(
			List<PlateConstStarPair> pairs,
			double ra0Deg,
			double de0Deg,
			FitOrder fitOrder,
			int minNumberOfStars)
        {
            if (fitOrder == FitOrder.Linear)
            {
                PlateConstantsLinearFit linearFit = new PlateConstantsLinearFit(pairs);
                try
                {
                    if (linearFit.LeastSquareSolve(ra0Deg, de0Deg, minNumberOfStars))
                        return linearFit;
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("{0} exception during PlateConstantsFit.", ex.GetType().Name);
                    return null;
                }
            }

            if (fitOrder == FitOrder.Quadratic)
            {
                PlateConstantsQadraticFit qadraticFit = new PlateConstantsQadraticFit(pairs);
                try
                {
                    if (qadraticFit.LeastSquareSolve(ra0Deg, de0Deg, minNumberOfStars))
                        return qadraticFit;
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("{0} exception during PlateConstantsFit.", ex.GetType().Name);
                    return null;
                }
            }

            return null;
        }