Exemplo n.º 1
0
            protected override double[] Extract(double[] intervals, double[] amplitude)
            {
                ExtremaPointType nextLocalPoint = start;
                int             fromIndex       = 0;
                List <double[]> pointFeatures   = new List <double[]>();

                using (IEnumerator <ExtremaSearchConfig> iterator = searchConfig.GetEnumerator())
                {
                    while (iterator.MoveNext())
                    {
                        ExtremaSearchConfig config       = iterator.Current;
                        PointIndexPair      extremaPoint = Find(nextLocalPoint, fromIndex, config, intervals, amplitude);

                        if (extremaPoint.IndexOutOfRange && config.GeometricRecoveryConfig != null)
                        {
                            GeometricRecoveryConfig recoveryConfig = config.GeometricRecoveryConfig;

                            // use triangular approximation to attempt missing point recovery (need to do 2 points - this + next to approximate missing point)
                            extremaPoint = FindTriangular(nextLocalPoint, fromIndex, recoveryConfig.FirstPointSensitivity, recoveryConfig.FirstTriangleLength, intervals, amplitude);
                            // add first recovered point
                            pointFeatures.Add(GetFeatures(extremaPoint, intervals, config.DataModel));

                            // skip forward one if we can since we've already found the next point
                            if (!iterator.MoveNext())
                            {
                                break;
                            }
                            config = iterator.Current;

                            // recover the second point (which would also be "missing")
                            nextLocalPoint = Alternate(nextLocalPoint);
                            extremaPoint   = FindTriangular(nextLocalPoint, extremaPoint.PointIndex, recoveryConfig.SecondPointSensitivity, recoveryConfig.SecondTriangleLength, intervals, amplitude);
                        }

                        pointFeatures.Add(GetFeatures(extremaPoint, intervals, config.DataModel));
                        fromIndex      = extremaPoint.PointIndex;
                        nextLocalPoint = Alternate(nextLocalPoint);
                    }
                }
                return(pointFeatures.SelectMany(p => p).ToArray());
            }
Exemplo n.º 2
0
 public ExtremaSearchConfig(int sensitivity, ExtremaDataModel dataModel, int?searchIndexLimit = null, GeometricRecoveryConfig geometricRecoveryConfig = null, double?startAmplitude = null)
 {
     this.Sensitivity             = sensitivity;
     this.DataModel               = dataModel;
     this.GeometricRecoveryConfig = geometricRecoveryConfig;
     this.SearchIndexLimit        = searchIndexLimit;
     this.StartAmplitude          = startAmplitude;
 }
Exemplo n.º 3
0
 public GeometricExtractorBuilder FindExtremaPoint(int sensitivity, ExtremaDataModel dataModel = ExtremaDataModel.TIME_AMPLITUDE, int?searchIndexLimit = null, GeometricRecoveryConfig geometricRecoveryConfig = null, double?startAmplitude = null)
 {
     searchConfig.Add(new ExtremaSearchConfig(sensitivity, dataModel, searchIndexLimit, geometricRecoveryConfig, startAmplitude));
     return(this);
 }