mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
Removed bug in polar filter
AngleCluster based polar mining is now also a part of the pipeline. The filter filtered out reaching courses. This part of the filter has now been removed.
This commit is contained in:
1 parent
9e249d53c9
commit
bbf7e447d5
4 files changed
+16
-20
No files matched your search
+5
@@ -25,5 +25,10 @@ public class BearingClusterGroupTest {
|
||||
Cluster<Bearing> cluster2 = group.getClusterFor(new DegreeBearingImpl(-178));
|
||||
|
||||
assertTrue(cluster1.equals(cluster2));
|
||||
|
||||
cluster1 = group.getClusterFor(new DegreeBearingImpl(-90));
|
||||
cluster2 = group.getClusterFor(new DegreeBearingImpl(-91));
|
||||
|
||||
assertTrue(cluster1.equals(cluster2));
|
||||
}
|
||||
}
|
||||
+6
-11
@@ -8,6 +8,7 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.SpeedWithBearingWithConfidence;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
@@ -170,18 +171,12 @@ public class GPSFixMovingWithPolarContext implements MovingAveragePolarClusterKe
|
||||
|
||||
@Override
|
||||
public LegType getLegType() {
|
||||
return getLegTypeWithPolarConstraints(getAngleToTheWind().getObject());
|
||||
}
|
||||
|
||||
public static LegType getLegTypeWithPolarConstraints(Bearing angleDifferenceWindToBoat) {
|
||||
double absoluteDiffInDeg = Math.abs(angleDifferenceWindToBoat.getDegrees());
|
||||
LegType result = null;
|
||||
if (absoluteDiffInDeg > 20 && absoluteDiffInDeg < 75) {
|
||||
result = LegType.UPWIND;
|
||||
} else if (absoluteDiffInDeg > 105) {
|
||||
result = LegType.DOWNWIND;
|
||||
TimePoint timePoint = fix.getTimePoint();
|
||||
try {
|
||||
return race.getCurrentLeg(timePoint).getLegType(timePoint);
|
||||
} catch (NoWindException e) {
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-6
@@ -49,7 +49,6 @@ public class PolarFixFilterCriteria implements FilterCriterion<GPSFixMovingWithP
|
||||
if (!importantDataIsNotNull) {
|
||||
return false;
|
||||
}
|
||||
boolean hasLegType = hasLegType(element);
|
||||
boolean afterStartTime = isAfterStartTime(element);
|
||||
boolean beforeFinishTime = isBeforeFinishTime(element);
|
||||
boolean noDirectionChange = !hasDirectionChange(element);
|
||||
@@ -58,7 +57,7 @@ public class PolarFixFilterCriteria implements FilterCriterion<GPSFixMovingWithP
|
||||
isInLeadingCompetitors = isInLeadingCompetitors(element.getRace(), element.getCompetitor(),
|
||||
pctOfLeadingCompetitorsToInclude);
|
||||
}
|
||||
return (importantDataIsNotNull && hasLegType && afterStartTime && beforeFinishTime && noDirectionChange && isInLeadingCompetitors);
|
||||
return (importantDataIsNotNull && afterStartTime && beforeFinishTime && noDirectionChange && isInLeadingCompetitors);
|
||||
}
|
||||
|
||||
private boolean importantDataIsNotNull(GPSFixMovingWithPolarContext element) {
|
||||
@@ -71,10 +70,6 @@ public class PolarFixFilterCriteria implements FilterCriterion<GPSFixMovingWithP
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean hasLegType(GPSFixMovingWithPolarContext element) {
|
||||
return element.getLegType() != null;
|
||||
}
|
||||
|
||||
public static boolean isInLeadingCompetitors(TrackedRace trackedRace, Competitor competitor, double numberOfLeadingCompetitorsToInclude) {
|
||||
boolean result;
|
||||
|
||||
+4
-3
@@ -63,9 +63,10 @@ private static final Logger logger = Logger.getLogger(CubicRegressionPerCoursePr
|
||||
if (regressions.containsKey(key)) {
|
||||
speedSum += regressions.get(key).getOrCreatePolynomialFunction().value(windSpeed.getKnots());
|
||||
numberOfSpeeds++;
|
||||
} else {
|
||||
throw new NotEnoughDataHasBeenAddedException("Not enough data has been added to Per Course Regressions");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (numberOfSpeeds < 1) {
|
||||
throw new NotEnoughDataHasBeenAddedException("Not enough data has been added to Per Course Regressions");
|
||||
}
|
||||
Speed speed = new KnotSpeedImpl(speedSum / numberOfSpeeds);
|
||||
return new SpeedWithConfidenceImpl<Void>(speed, /*FIXME*/ 0.5, null);
|
||||
|
||||
Reference in new issue
Block a user