Exemple #1
0
 /// <summary>
 /// Creates a Tracklet from the given arguments. This constructor is internally called by the Tracklet factories.
 /// </summary>
 public Tracklet(ImageDetection[] Detections, TrackletVelocity Velocity, TrackletVelocityRegression Regression)
 {
     this.Detections    = Detections;
     this.Velocity      = Velocity;
     VelReg             = Regression;
     ExtendedProperties = new Dictionary <Type, IExtensionProperty>();
 }
Exemple #2
0
        /// <summary>
        /// Creates a tracklet from a set of detections.
        /// </summary>
        /// <param name="Detections">Input detections; one per image.</param>
        /// <returns>A new Tracklet instance.</returns>
        public static Tracklet CreateTracklet(ImageDetection[] Detections)
        {
            long[] Ticks = Detections.Select((x) => x.Time.Time.Ticks).ToArray();
            Array.Sort(Ticks, Detections);

            EquatorialPoint[] ValidEP    = new EquatorialPoint[Detections.Length];
            double[]          ValidTimes = new double[Detections.Length];
            DateTime          ZeroTime   = Detections[0].Time.Time;

            WCS.IWCSProjection Projection = Detections[0].ParentImage.Transform;

            for (int i = 0; i < Detections.Length; i++)
            {
                ValidEP[i]    = Detections[i].Barycenter.EP;
                ValidTimes[i] = (Detections[i].Time.Time - ZeroTime).TotalSeconds;
            }

            var                XRA      = ValidEP.Select((x) => x.RA).ToArray();
            var                XDec     = ValidEP.Select((x) => x.Dec).ToArray();
            var                RAreg    = LinearRegression.ComputeLinearRegression(ValidTimes, XRA);
            var                Decreg   = LinearRegression.ComputeLinearRegression(ValidTimes, XDec);
            var                RADecreg = LinearRegression.ComputeLinearRegression(XRA, XDec);
            double             ResRA    = LineFit.ComputeResidualSqSum(RAreg, ValidTimes, XRA);
            double             ResDec   = LineFit.ComputeResidualSqSum(Decreg, ValidTimes, XDec);
            EquatorialVelocity ev       = new EquatorialVelocity()
            {
                RAvel = RAreg.Slope, Decvel = Decreg.Slope
            };
            TrackletVelocityRegression tvr = new TrackletVelocityRegression()
            {
                R_TR = RAreg.PearsonR, R_TD = Decreg.PearsonR, R_RD = RADecreg.PearsonR,
                S_TR = ResRA, S_TD = ResDec, ZeroTime = ZeroTime, P_TD = Decreg, P_TR = RAreg
            };
            TrackletVelocity tvel = new TrackletVelocity()
            {
                EquatorialVelocity = ev,
                PixelVelocity      = Projection.GetPixelVelocity(ev),
                SphericalVelocity  = Math.Sqrt(ev.Decvel * ev.Decvel + ev.RAvel * ev.RAvel * Math.Cos(XRA[0]) * Math.Cos(XRA[0]))
            };

            return(new Tracklet(Detections, tvel, tvr));
        }