예제 #1
0
        public XNode Xml(string name, Func <XNode> ifAbsent)
        {
            name = new Normalized(name).AsString();
            XNode result;

            if (!this.xmlMem.ContainsKey(name))
            {
                result = this.origin.Xml(name, ifAbsent);
                if (!IsBlacklisted(name))
                {
                    this.xmlMem.AddOrUpdate(
                        name, (n) => result, (n, current) => result
                        );
                }
            }
            else
            {
                this.xmlMem.TryGetValue(
                    name, out result
                    );
            }
            var xml = this.xmlMem.GetOrAdd(name, (n) => this.origin.Xml(name, ifAbsent));

            return(xml);
        }
예제 #2
0
 /// <summary>
 /// A xocument stored in memories.
 /// </summary>
 public MemorizedXocument(string name, IMnemonic memories)
 {
     this.name     = name;
     this.memories = memories;
     this.node     =
         new Live <XNode>(() =>
                          memories.Contents().Xml(name, () =>
                                                  new XDocument(
                                                      new XElement(this.root.Value())
                                                      )
                                                  )
                          );
     this.root =
         new ScalarOf <string>(() =>
     {
         var rootName = new Normalized(name).AsString();
         if (rootName.ToLower().EndsWith(".xml"))
         {
             rootName = rootName.Substring(0, rootName.Length - 4);
         }
         if (rootName.Contains("/"))
         {
             rootName = rootName.Substring(rootName.LastIndexOf("/"));
             rootName = rootName.TrimStart('/');
         }
         return(rootName);
     });
 }
예제 #3
0
        public void UpdateBytes(string name, byte[] data)
        {
            name = new Normalized(name).AsString();
            var isEmpty     = data.Length == 0;
            var shouldCache = data.Length <= this.maxCachedSize;

            lock (this.byteMem)
            {
                if (isEmpty || !shouldCache)
                {
                    byte[] unused;
                    this.byteMem.TryRemove(name, out unused);
                    this.origin.UpdateBytes(name, data);
                }
                else
                {
                    this.byteMem.AddOrUpdate(
                        name,
                        (n) => data,
                        (n, existing) =>
                    {
                        this.origin.UpdateBytes(name, data);
                        return(data);
                    }
                        );
                }
            }
        }
예제 #4
0
        public byte[] Bytes(string name, Func <byte[]> ifAbsent)
        {
            name = new Normalized(name).AsString();
            var result = this.mem.GetOrAdd(name, (key) => ifAbsent());

            return(result);
        }
예제 #5
0
        public XNode Xml(string name, Func <XNode> ifAbsent)
        {
            name = new Normalized(name).AsString();
            var xml = this.xmlCache.Content(name, () => this.origin.Xml(name, ifAbsent));

            return(xml);
        }
예제 #6
0
        public byte[] Bytes(string name, Func <byte[]> ifAbsent)
        {
            name = new Normalized(name).AsString();
            var bytes = this.byteCache.Content(name, () => this.origin.Bytes(name, ifAbsent));

            return(bytes);
        }
예제 #7
0
        public void UpdateXml(string name, XNode xml)
        {
            name = new Normalized(name).AsString();
            var isEmpty = !xml.Document.Elements().GetEnumerator().MoveNext();

            lock (this.xmlMem)
            {
                if (isEmpty || IsBlacklisted(name))
                {
                    InvalidateCache(name);
                    this.origin.UpdateXml(name, xml);
                }
                else
                {
                    this.xmlMem.AddOrUpdate(
                        name,
                        (n) => xml,
                        (n, existing) =>
                    {
                        this.origin.UpdateXml(name, xml);
                        return(xml);
                    }
                        );
                }
            }
        }
예제 #8
0
        private void PreencherRegrasArParaArEArParaMaiorAr()
        {
            RolesArToGreatAs        = new List <RuleProduction>();
            RolesArToAr             = new List <RuleProduction>();
            RolesSubstituiArGreatAs = new List <RuleProduction>();
            RolesReplaceArParaAr    = new List <RuleProduction>();

            for (int i = 0; i < Normalized.Rules.Count; i++)
            {
                RuleProduction rAtual  = Normalized.Rules[i];
                var            destino = rAtual.Destiny.Copy();
                if (rAtual.IsFirstVariable())
                {
                    if (NewNames.ContainsKey(rAtual.Source))
                    {
                        if (NewNames[rAtual.Source].Id > NewNames[rAtual.FirstDestiny()].Id)
                        {
                            Normalized.Rules.Remove(rAtual);
                            i--;

                            List <RuleProduction> regrasDestino = Normalized.GetRules(rAtual.FirstDestiny());
                            RolesArToGreatAs.Add(rAtual);
                            //Remoção de Regra, decrementa i

                            for (int j = 0; j < regrasDestino.Count; j++)
                            {
                                RuleProduction regraTemp = Normalized.AddRule(rAtual.Source,
                                                                              regrasDestino[j].Destiny.AddRange(rAtual.SkipFirstDestiny()));
                                RolesSubstituiArGreatAs.Add(regraTemp);
                            }
                        }
                        else if (NewNames[rAtual.Source].Name == NewNames[rAtual.FirstDestiny()].Name)
                        {
                            RolesArToAr.Add(rAtual);
                            var bAtual = new Symbol(GetNewId(), string.Empty, false);
                            Normalized.Variables.Add(bAtual);
                            destino = destino.SkipFirst();
                            RuleProduction regraTemp = Normalized.AddRule(bAtual, destino);
                            RolesReplaceArParaAr.Add(regraTemp);
                            regraTemp = Normalized.AddRule(bAtual, destino.Add(bAtual));
                            RolesReplaceArParaAr.Add(regraTemp);

                            //Removi volta o i
                            Normalized.Rules.Remove(rAtual);
                            i--;

                            List <RuleProduction> regrasOrigem = Normalized.GetRules(rAtual.Source);

                            for (int j = 0; j < regrasOrigem.Count; j++)
                            {
                                regraTemp = Normalized.AddRule(rAtual.Source, regrasOrigem[j].Destiny.Add(bAtual));
                                RolesReplaceArParaAr.Add(regraTemp);
                            }
                        }
                    }
                }
            }
        }
예제 #9
0
        public void UpdateBytes(string name, byte[] data)
        {
            name = new Normalized(name).AsString();
            var isEmpty = data.Length == 0;

            lock (this.origin)
            {
                this.origin.UpdateBytes(name, data);
                InvalidateCache(name);
            }
        }
예제 #10
0
 public void UpdateBytes(string name, byte[] data)
 {
     name = new Normalized(name).AsString();
     if (data.Length == 0)
     {
         byte[] removed;
         this.mem.TryRemove(name, out removed);
     }
     else
     {
         this.mem.AddOrUpdate(name, data, (currentName, currentContent) => data);
     }
 }
예제 #11
0
        //action on every frame.
        public void OnFrame(object sender, FrameEventArgs args)
        {
            // Get the most recent frame and report some basic information
            Frame frame = args.frame;

            if (copyflag)
            {
                nowHand0.CopyFrom(frame.Hands[0]);
                copyflag = false;
            }
            //add virtual hand
            if (vhand_flag)
            {
                VirtualHand.AddHand(ref frame, vhand);
            }
            //works when 2 hands in the hans pool
            if (frame.Hands.Count == 2)
            {
                HKD0.Load(frame.Hands[0]);
                HKD1.Load(frame.Hands[1]);
                HKD0.Transform(HKD0.GetRIMatrix());
                //the same side then just transform
                if (frame.Hands[0].IsLeft == frame.Hands[1].IsLeft)
                {
                    HKD1.Transform(HKD1.GetRIMatrix());
                }
                //not the same then transform after mirror on x-axis
                else
                {
                    HKD1.Transform(HKD1.MirrorXRI());
                }
                Normalized.Hand_Normalized(ref HKD0, ref HKD1);
                Compare_Method();
                changeflag = true;
                Thread.Sleep(10);
            }
            else if (frame.Hands.Count > 2)
            {
                changeflag = false;
                answer     = "To many hands!!!";
                clear();
            }
            else
            {
                changeflag = false;
                answer     = "Need " + (2 - frame.Hands.Count).ToString() + " more hands";
                clear();
            }
        }
예제 #12
0
        public XNode Xml(string name, Func <XNode> ifAbsent)
        {
            name = new Normalized(name).AsString();
            XNode result;

            if (!this.mem.Keys.Contains(name))
            {
                result = ifAbsent();
                if (result.Document.Elements().GetEnumerator().MoveNext())
                {
                    UpdateXml(name, result);
                }
            }
            else
            {
                result = Parsed(name, this.Bytes(name, () => throw new ApplicationException($"Internal error, assumend to never access ifAbsent() method here.")));
            }
            return(result);
        }
예제 #13
0
        public override string ToString()
        {
            string result = "";

            result = NormPart + Environment.NewLine;

            result += Sign.ToString() + "|";
            for (int i = 0; i < Exponent.Length; i++)
            {
                result += Exponent[i].ToString();
            }
            result += "|";
            result += Normalized.ToString() + "|";
            for (int i = 0; i < 23; i++)
            {
                result += Fraction[i].ToString();
            }
            return(result);
        }
예제 #14
0
    public void OnFrame(object sender, FrameEventArgs args)
    {
        // Get the most recent frame and report some basic information
        Frame frame = args.frame;

        if (frame.Hands.Count == 2)
        {
            answer = "对比结果:" + "\n";
            HKD0.Load(frame.Hands[0]);
            HKD1.Load(frame.Hands[1]);
            HKD0.Transform(HKD0.GetRIMatrix());
            if (frame.Hands[0].IsLeft == frame.Hands[1].IsLeft)
            {
                HKD1.Transform(HKD1.GetRIMatrix());
            }
            else
            {
                HKD1.Transform(HKD1.MirrorXRI());
            }
            Normalized.Hand_Normalized(ref HKD0, ref HKD1);
            Compare_Method();
        }
        //调试分支

        /*
         * else if (frame.Hands.Count == 1)
         * {
         *  HKD0.Load(frame.Hands[0]);
         *  HKD1.Load(frame.Hands[0]);
         *  answer = "单手归零测试:\n";
         *  Compare_Method();
         * }
         */
        else if (frame.Hands.Count > 2)
        {
            answer = "To many hands!!!";
        }
        else
        {
            answer = "Need " + (2 - frame.Hands.Count).ToString() + " more hands";
        }
    }
예제 #15
0
        public void Remove(string id)
        {
            var prefix = new Normalized($"{scope}/{id}").AsString();

            foreach (var data in this.mem.Contents().Knowledge(prefix))
            {
                if (data.StartsWith(prefix))
                {
                    this.mem.Contents().UpdateBytes(data, new byte[0]);
                }
            }
            lock (idCache)
            {
                if (idCache.Count == 0)
                {
                    idCache.AddRange(IdsFromCell());
                }
                idCache.Remove(id);
                Cell().Update(new InputOf(string.Join(";", idCache)));
            }
        }
예제 #16
0
        public void Update(IInput content)
        {
            var name   = new Normalized(this.name.Value()).AsString();
            var stream = content.Stream();

            if (stream.Length > 0)
            {
                stream.Seek(0, SeekOrigin.Begin);
                this.mem
                .Value()
                .Contents()
                .UpdateBytes(
                    name,
                    new BytesOf(new InputOf(stream)).AsBytes()
                    );
            }
            else
            {
                this.mem.Value().Contents().UpdateBytes(name, new byte[0]);
            }
        }
예제 #17
0
 public byte[] Bytes(string name, Func <byte[]> ifAbsent)
 {
     name = new Normalized(name).AsString();
     byte[] result;
     if (!this.byteMem.ContainsKey(name))
     {
         result = this.origin.Bytes(name, ifAbsent);
         if (result.Length <= this.maxCachedSize && !IsBlacklisted(name))
         {
             this.byteMem.AddOrUpdate(
                 name, (n) => result, (n, current) => result
                 );
         }
     }
     else
     {
         this.byteMem.TryGetValue(
             name, out result
             );
     }
     return(result);
 }
예제 #18
0
        private XNode Parsed(string name, byte[] data)
        {
            XDocument doc;

            if (data.Length == 0)
            {
                var rootName = new Normalized(name).AsString();
                if (rootName.ToLower().EndsWith(".xml"))
                {
                    rootName = rootName.Substring(0, rootName.Length - 4);
                }
                rootName = rootName.Substring(rootName.LastIndexOf("/"));
                rootName = rootName.TrimStart('/');
                doc      =
                    new XDocument(
                        new XDeclaration("1.0", "UTF-8", "yes"),
                        new XElement(rootName)
                        );
            }
            else
            {
                try
                {
                    using (var reader = new StreamReader(new MemoryStream(data)))
                    {
                        doc = XDocument.Load(reader);
                    }
                }
                catch (XmlException ex)
                {
                    throw
                        new ApplicationException(
                            $"Cannot parse this content as XML: '{new TextOf(new InputOf(data), Encoding.UTF8).AsString()}'",
                            ex
                            );
                }
            }
            return(doc);
        }
예제 #19
0
        public void UpdateXml(string name, XNode xml)
        {
            name = new Normalized(name).AsString();
            var isEmpty = !xml.Document.Elements().GetEnumerator().MoveNext();

            lock (this.xmlCache)
            {
                if (isEmpty)
                {
                    this.xmlCache.Remove(name);
                }
                else
                {
                    this.xmlCache
                    .Update(
                        name,
                        () => xml,
                        () => xml
                        );
                }
                this.origin.UpdateXml(name, xml);
            }
        }
예제 #20
0
        public void UpdateBytes(string name, byte[] data)
        {
            name = new Normalized(name).AsString();
            var isEmpty = data.Length == 0;

            lock (this.byteCache)
            {
                if (isEmpty)
                {
                    this.byteCache.Remove(name);
                }
                else
                {
                    this.byteCache
                    .Update(
                        name,
                        () => data,
                        () => data
                        );
                }
                this.origin.UpdateBytes(name, data);
            }
        }
예제 #21
0
        private void ColocarTerminalInicio()
        {
            for (int i = 0; i < Normalized.Rules.Count; i++)
            {
                RuleProduction rAtual = Normalized.Rules[i];

                if (!rAtual.Destiny[0].Terminal)
                {
                    //Removi regra volta regra
                    Normalized.Rules.Remove(rAtual);
                    i--;

                    var destino = rAtual.SkipFirstDestiny();

                    List <RuleProduction> regras = Normalized.GetRules(rAtual.FirstDestiny());

                    for (int j = 0; j < regras.Count; j++)
                    {
                        RuleProduction regraTemp = Normalized.AddRule(rAtual.Source, regras[j].Destiny.Copy().AddRange(destino));
                    }
                }
            }
        }
예제 #22
0
        //Removendo terminais no meio
        private void RemoveTerminalsNoMeio()
        {
            for (int i = 0; i < Normalized.Rules.Count; i++)
            {
                RuleProduction rAtual = Normalized.Rules[i];

                for (int j = 1; j < rAtual.Destiny.Count; j++)
                {
                    if (rAtual.Destiny[j].Terminal)
                    {
                        var variavelExclusiva = Normalized.CapturarVariavelExclusiva(rAtual.Destiny[j]);

                        if (variavelExclusiva == Symbol.EmptyVariable)
                        {
                            variavelExclusiva = new Symbol(GetNewId(), string.Empty, false);
                            Normalized.Variables.Add(variavelExclusiva);
                            Normalized.AddRule(variavelExclusiva, rAtual.Destiny);
                        }

                        rAtual.Destiny[j] = variavelExclusiva;
                    }
                }
            }
        }
예제 #23
0
 /// <summary>
 /// Gets the probability associated with a label.
 /// </summary>
 /// <param name="label">The label whose probability needs to be returned.</param>
 /// <returns>The probability associated with the label.</returns>
 public override double Get(T label)
 {
     return(!Normalized.ContainsKey(label) ? 0d : Normalized[label]);
 }
예제 #24
0
        private void Normalize()
        {
            Normalized.VariableStart = simplified.VariableStart;
            Normalized.Terminals.AddRange(simplified.Terminals);
            Normalized.Variables.AddRange(simplified.Variables);

            for (int i = 0; i < simplified.Rules.Count; i++)
            {
                RuleProduction rgActual = simplified.Rules[i];

                var destiny = rgActual.Destiny;

                foreach (var item in DicVariablesTerminals)
                {
                    destiny = destiny.Replace(item.Key, item.Value);
                }

                if (destiny.Unitary)
                {
                    Normalized.AddRule(rgActual.Source, destiny);
                }
                else
                {
                    if (destiny.Count == 2 && !rgActual.DestinyContainsTerminal())
                    {
                        Normalized.AddRule(rgActual.Source, destiny);
                    }
                    else
                    {
                        List <SymbolList> destinys = new List <SymbolList>();

                        while (destiny.Count > 2)
                        {
                            destinys.Clear();
                            for (int k = 0; k < destiny.Count; k += 2)
                            {
                                if (k + 1 < destiny.Count)
                                {
                                    destinys.Add(new SymbolList(destiny[k], destiny[k + 1]));
                                }
                                else
                                {
                                    destinys.Add(new SymbolList(destiny[k]));
                                }
                            }

                            destiny = new SymbolList();
                            foreach (var des in destinys)
                            {
                                Symbol destinyVariable = des[0];
                                if (!des.Unitary)
                                {
                                    destinyVariable = Normalized.GetExclusiveVars(des);

                                    if (destinyVariable == Symbol.EmptyVariable)
                                    {
                                        destinyVariable = new Symbol(GetNewId(), string.Empty, false);
                                        Normalized.Variables.Add(destinyVariable);
                                        Normalized.AddRule(destinyVariable, des);
                                    }
                                }
                                destiny.Add(destinyVariable);
                            }
                        }
                        Normalized.AddRule(rgActual.Source, destiny);
                    }
                }
            }
        }
예제 #25
0
        /// <summary>
        /// Finds the angle between this vector and another vector
        /// </summary>
        /// <param name="v2">The other vector</param>
        /// <param name="normalized">Whether both vectors are already normalized; if this can be assumed, set this to true to avoid cost of normalization.</param>
        /// <returns>Angle in radians</returns>
        public double AngleR(Vector3d v2, bool normalized = false)
        {
            double fDot = MathUtil.Clamp(normalized ? Dot(v2) : Normalized.Dot(v2.Normalized), -1, 1);

            return(Math.Acos(fDot));
        }
예제 #26
0
        public List <Tracklet> AnalyzeCCD(PipelineArguments Args)
        {
            Logger("Setting up pipeline");
            /* Deal with incorrect SWARP flux scaling */
            SWarpScaling.ApplyTransform = CorrectSWARP;

            string RunDir = Args.RunDir;

            if (!Directory.Exists(RunDir))
            {
                Directory.CreateDirectory(RunDir);
            }

            /* Read input images and preprocess for poisson noise */
            int ImageCount = Args.Inputs.Length;

            FitsImage[] FirstProcess = new FitsImage[ImageCount];
            double[]    PFW          = PipelineHelperFunctions.LinearizedPoissonKernel(PoissonRadius);

            Step.StepPipeline sp = new Step.StepPipeline(StandardBITPIX, RunDir, Args.Inputs.Length, MaxDetections);
            sp.LogHookImage     = LogImage;
            sp.LogHookDetection = LogDet;
            sp.LogMessage       = LogMessage;

            bool HasBadpix = Args.Badpixel != null;

            Logger("Begining to run the pipeline");
            var zpTask = System.Threading.Tasks.Task <Dictionary <IO.Image, double> > .Factory.StartNew(() => CalibrateZP(Args.Inputs));

            var skTask = System.Threading.Tasks.Task <bool> .Factory.StartNew(() => PrecacheSkyBot(Args.Inputs));

            BitArray[] map = PipelineHelperFunctions.ExtractBadpixel(Args.Badpixel, Logger);

            for (int i = 0; i < ImageCount; i++)
            {
                FitsImage Pipeline = Args.Inputs[i];
                Pipeline.GetProperty <ImageSource>().AddToSet(Pipeline, "Original");
                sp.SetModel(i, Pipeline, new List <IO.ImageProperties>()
                {
                    Pipeline.GetProperty <ObservationTime>()
                });

                if (!UseCoreFilter)
                {
                    sp.RunPipeline(RestrictedMean.RestrictedMeanFilter, "Poisson", i, ref Pipeline, PFW, RestrictedMean.Parameters(PoissonRadius));
                }
                else if (HasBadpix)
                {
                    sp.RunPipeline(CoreFilter.Filter, "Poisson", i, ref Pipeline, new CoreFilter.CoreFilterParameters(PFW, map), CoreFilter.Parameters(PoissonRadius));
                }
                else
                {
                    throw new ArgumentException("Must specify Badpixel files if trying to run with CoreFilter");
                }

                if (Operations.HasFlag(EnabledOperations.Normalization))
                {
                    if (!sp.EnsureImage("Normalized", i, out FitsImage Normalized))
                    {
                        Point4Distance p4d = new Point4Distance(Pipeline, Normalized, NormalizationMeshSize);
                        Logger("Generated Normalized image " + i);
                    }
                    else
                    {
                        Logger("Found Normalized image " + i);
                    }
                    Normalized.GetProperty <ImageSource>().AddToSet(Args.Inputs[i], "Normalized");
                    Pipeline = Normalized;
                }
                FirstProcess[i] = Pipeline;
            }

            /* Create the central median */
            string CentralPath = Path.Combine(RunDir, "Central.fits");

            if (!sp.EnsureCentralImage("Central", out FitsImage Central))
            {
                HardMedians.MultiImageMedian.Run(null, FirstProcess, Central, HardMedians.MultiImageMedianParameters);
                Logger("Generated Central image");
            }
            else
            {
                Logger("Found Central image");
            }

            Logger("Computed the multi-image median");

            /* Prepare the mask, slow object detector, trail detector, weights for second median filtering, etc. */
            ImageStatistics CentralStats = new ImageStatistics(Central);

            if (Args.Clipped)
            {
                CentralStats = new ImageStatistics(Central, CentralStats.ZeroLevel, 2 * CentralStats.StDev);
            }
            StarData StarList = new StarData();

            ComputeDetectorData(Central, CentralStats, StarList, out MaskByMedian.MaskProperties MaskProp, out DotDetector SlowDetector,
                                out LongTrailDetector.LongTrailData LTD);
            if (Args.Clipped)
            {
                SlowDetector.HighThresholdMultiplier *= 2;
                SlowDetector.LowThresholdMultiplier  *= 2;
            }

            DetectionReducer dr = new DetectionReducer()
            {
                PairingRadius = 0.7
            };

            if (Operations.HasFlag(EnabledOperations.SourceExtractor))
            {
                try
                {
                    dr.LoadStars(StarList.FixedStarList);
                }
                catch (Exception ex) { throw new ArgumentException("Could not read detections from SE catalog.", ex); }
                dr.GeneratePool();
            }


            Logger("Set up detectors");

            List <ImageDetection> FullDetectionsList = new List <ImageDetection>();

            double[] FMW2 = PipelineHelperFunctions.LinearizedMedianKernel();
            LTLimit  ltl  = new LTLimit()
            {
                MinPix = TrailMinPix
            };
            RipFilter rf = new RipFilter()
            {
                SigmaTop = 30
            };

            Logger("Ready for final image processing and detection");

            for (int i = 0; i < ImageCount; i++)
            {
                List <ImageDetection> LocalDetectionList = new List <ImageDetection>();

                FitsImage DetectionSource = FirstProcess[i];

                if (Operations.HasFlag(EnabledOperations.Masking))
                {
                    sp.RunPipeline(MaskByMedian.Masker, "Masked", i, ref DetectionSource, MaskProp, MaskByMedian.Parameters);
                }

                if (Operations.HasFlag(EnabledOperations.SecondMedian))
                {
                    sp.RunPipeline(HardMedians.WeightedMedian, "Second Median", i, ref DetectionSource, FMW2, HardMedians.WeightedMedianParameters(SecMedRadius));
                }

                ImageStatistics SecMedStat = new ImageStatistics(DetectionSource);

                if (Operations.HasFlag(EnabledOperations.LongTrailDetector))
                {
                    var Dets = sp.RunDetector((FitsImage img) =>
                    {
                        LongTrailDetector.PrepareAlgorithmForImage(img, SecMedStat, ref LTD);
                        LongTrailDetector.Algorithm.Run(LTD, DetectionSource, LongTrailDetector.Parameters);
                        return(LTD.Results);
                    }, DetectionSource, "Trail", DetectionAlgorithm.Trail);
                    LocalDetectionList.AddRange(Dets);
                }

                if (Operations.HasFlag(EnabledOperations.BlobDetector))
                {
                    var Dets = sp.RunDetector(SlowDetector.Detect, DetectionSource, "Blob", DetectionAlgorithm.Blob);
                    LocalDetectionList.AddRange(Dets);
                }

                if (Operations.HasFlag(EnabledOperations.SourceExtractor))
                {
                    var dts = sp.RunDetector((arg) =>
                    {
                        List <ImageDetection> Dets = ExtraIO.SourceExtractor.ParseSEFile(Args.CatalogData[i], Args.Inputs[i]);
                        Dets   = Dets.Where((x) => x.FetchProperty <ObjectPhotometry>().Flux > 300).ToList();
                        var ND = dr.Reduce(Dets);
                        return(ND);
                    }, DetectionSource, "SE", DetectionAlgorithm.SourceExtractor);
                    LocalDetectionList.AddRange(dts);
                }

                if (Operations.HasFlag(EnabledOperations.OutputDetectionMap))
                {
                    DetectionDebugMap(RunDir, i, LocalDetectionList, DetectionSource);
                }

                rf.ImgMean  = SecMedStat.ZeroLevel;
                rf.ImgSigma = SecMedStat.StDev;
                var NLDL = sp.RunFilters(LocalDetectionList, "LocalToGlobal", ltl, rf);
                Logger("Total " + NLDL.Count + " detections.");
                FullDetectionsList.AddRange(NLDL);
            }
            Logger("Filtering and pairing detections...");

            LinearityThresholdFilter LTF = new LinearityThresholdFilter()
            {
                MaxLineThickness = MaxLineThickness
            };
            List <ImageDetection> FilteredDetections = sp.RunFilters(FullDetectionsList, "MainFilter", LTF);

            StarList.MarkStarCrossed(FilteredDetections, StarCrossRadiusM, StarCrossMinFlux);
            if (Args.CCDBadzone != null)
            {
                FilteredDetections = sp.RunFilters(FilteredDetections, "Badzone", Args.CCDBadzone);
            }

            Logger("Before PrePair " + FilteredDetections.Count);
            PrePair.MatchDetections(FilteredDetections, MaxPairmatchDistance, MixMatch, SameArcSep);

            Logger("Left with " + FilteredDetections.Count + " detections");
            LinePoolSimple lps = new LinePoolSimple()
            {
                MaxLinErrorArcSec = MaxResidual, SearchExtraSmall = SmallExtraSearchRadius, SearchExtraBig = BigExtraSearchRadius
            };

            lps.LoadDetections(FilteredDetections);

            lps.GeneratePool();
            var Pairings = lps.FindTracklets();

            sp.NotePairings(FilteredDetections, Pairings);

            Logger("Found " + Pairings.Count + " raw tracklets");

            LinearityTest lintest = new LinearityTest();
            StaticFilter  stf     = new StaticFilter();
            TotalError    te      = new TotalError();
            var           TK2List = sp.RunFilters(Pairings, "Tracklet Filtering", stf, te);

            Logger("After filtering: " + TK2List.Count + " candidate objects found");

            sp.LogDetections(Path.Combine(RunDir, "detlog.txt"));

            Dictionary <IO.Image, double> ZP = zpTask.Result;

            skTask.Wait();

            var Recovered = RecoverTracklets(TK2List, Args.Inputs, Path.Combine(RunDir, "reclog.txt"), ZP);

            TrackletsDeduplication.Deduplicate(Recovered, 1.0);

            Logger("Recovered " + Recovered.Count + " candidate objects");

            PairSkyBot(Recovered, SkyBoTDistance, Args.FieldName, Args.CCDNumber, Args.Inputs, sp);

            return(Recovered);
        }
 public bool Equals(OpenGLVertexInputElement other)
 {
     return(SizeInBytes.Equals(other.SizeInBytes) && ElementCount.Equals(other.ElementCount) &&
            Type == other.Type && Offset.Equals(other.Offset) && Normalized.Equals(other.Normalized) &&
            InstanceStepRate.Equals(other.InstanceStepRate));
 }