944e6b86998de00172ff7afb037e0dcf6544931c
java/com.sap.sailing.windestimation.test/src/com/sap/sailing/windestimation/integration/IncrementalMstHmmWindEstimationForTrackedRaceTest.java
| ... | ... | @@ -153,11 +153,11 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra |
| 153 | 153 | @Test |
| 154 | 154 | public void testIncrementalMstHmmWindEstimationForTrackedRace() throws NoWindException, IOException { |
| 155 | 155 | assertTrue(windEstimationFactoryService.isReady(), "Wind estimation models are empty"); |
| 156 | - DynamicTrackedRaceImpl trackedRace = getTrackedRace(); |
|
| 157 | - WindTrack estimatedWindTrackOfTrackedRace = trackedRace |
|
| 156 | + final DynamicTrackedRaceImpl trackedRace = getTrackedRace(); |
|
| 157 | + final WindTrack estimatedWindTrackOfTrackedRace = trackedRace |
|
| 158 | 158 | .getOrCreateWindTrack(new WindSourceImpl(WindSourceType.MANEUVER_BASED_ESTIMATION)); |
| 159 | - List<CompetitorTrackWithEstimationData<CompleteManeuverCurveWithEstimationData>> competitorTracks = new ArrayList<>(); |
|
| 160 | - for (Competitor competitor : trackedRace.getRace().getCompetitors()) { |
|
| 159 | + final List<CompetitorTrackWithEstimationData<CompleteManeuverCurveWithEstimationData>> competitorTracks = new ArrayList<>(); |
|
| 160 | + for (final Competitor competitor : trackedRace.getRace().getCompetitors()) { |
|
| 161 | 161 | IncrementalManeuverDetectorImpl maneuverDetector = new IncrementalManeuverDetectorImpl(trackedRace, |
| 162 | 162 | competitor, null); |
| 163 | 163 | ManeuverDetectorWithEstimationDataSupportDecoratorImpl maneuverDetectorWithEstimationDataSupportDecorator = new ManeuverDetectorWithEstimationDataSupportDecoratorImpl( |
| ... | ... | @@ -172,32 +172,32 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra |
| 172 | 172 | completeManeuverCurvesWithEstimationData, 1, null, null, null, 0, 0); |
| 173 | 173 | competitorTracks.add(competitorTrack); |
| 174 | 174 | } |
| 175 | - RaceWithEstimationData<CompleteManeuverCurveWithEstimationData> race = new RaceWithEstimationData<>( |
|
| 175 | + final RaceWithEstimationData<CompleteManeuverCurveWithEstimationData> race = new RaceWithEstimationData<>( |
|
| 176 | 176 | competitorTracks.get(0).getRegattaName(), competitorTracks.get(0).getRaceName(), WindQuality.LOW, |
| 177 | 177 | competitorTracks); |
| 178 | - ManeuverBasedWindEstimationComponentImpl<RaceWithEstimationData<CompleteManeuverCurveWithEstimationData>> targetWindEstimation = new ManeuverBasedWindEstimationComponentImpl<>( |
|
| 178 | + final ManeuverBasedWindEstimationComponentImpl<RaceWithEstimationData<CompleteManeuverCurveWithEstimationData>> targetWindEstimation = new ManeuverBasedWindEstimationComponentImpl<>( |
|
| 179 | 179 | new RaceElementsFilteringPreprocessingPipelineImpl(false, |
| 180 | 180 | new CompleteManeuverCurveWithEstimationDataToManeuverForEstimationTransformer()), |
| 181 | 181 | windEstimationFactoryService.maneuverClassifiersCache, |
| 182 | 182 | new ManeuverClassificationsAggregatorFactory(null, modelStore, false, Long.MAX_VALUE).mstHmm(false), |
| 183 | 183 | new WindTrackCalculatorImpl(new MiddleCourseBasedTwdCalculatorImpl(), |
| 184 | 184 | new DummyBasedTwsCalculatorImpl())); |
| 185 | - List<WindWithConfidence<Pair<Position, TimePoint>>> windFixes = targetWindEstimation.estimateWindTrack(race); |
|
| 185 | + final List<WindWithConfidence<Pair<Position, TimePoint>>> windFixes = targetWindEstimation.estimateWindTrack(race); |
|
| 186 | 186 | final MeasurementXMLFile performanceReport = new MeasurementXMLFile(this.getClass()); |
| 187 | 187 | final MeasurementCase performanceReportCase = performanceReport.addCase(getClass().getSimpleName()); |
| 188 | 188 | performanceReportCase.addMeasurement(new Measurement("NumberOfTargetEstimationFixes", windFixes.size())); |
| 189 | - List<Wind> targetWindFixes = new ArrayList<>(windFixes.size()); |
|
| 190 | - for (WindWithConfidence<Pair<Position, TimePoint>> windFix : windFixes) { |
|
| 191 | - Wind wind = windFix.getObject(); |
|
| 189 | + performanceReport.write(); |
|
| 190 | + final List<Wind> targetWindFixes = new ArrayList<>(windFixes.size()); |
|
| 191 | + for (final WindWithConfidence<Pair<Position, TimePoint>> windFix : windFixes) { |
|
| 192 | + final Wind wind = windFix.getObject(); |
|
| 192 | 193 | targetWindFixes.add(wind); |
| 193 | - // System.out.println("Target: " + wind.getTimePoint() + " " + wind.getPosition() + " " |
|
| 194 | - // + Math.round(wind.getFrom().getDegrees())); |
|
| 194 | + System.out.println("" + wind.getTimePoint().asMillis() + "," + Math.round(wind.getFrom().getDegrees())); |
|
| 195 | 195 | } |
| 196 | - List<Wind> estimatedWindFixes = new ArrayList<>(); |
|
| 196 | + final List<Wind> estimatedWindFixes = new ArrayList<>(); |
|
| 197 | 197 | assertMostFixesTWDAround(targetWindFixes, 233, /* range for 90% quantile */ 17, /* average tolerance */ 2); |
| 198 | 198 | estimatedWindTrackOfTrackedRace.lockForRead(); |
| 199 | 199 | try { |
| 200 | - for (Wind wind : estimatedWindTrackOfTrackedRace.getFixes()) { |
|
| 200 | + for (final Wind wind : estimatedWindTrackOfTrackedRace.getFixes()) { |
|
| 201 | 201 | estimatedWindFixes.add(wind); |
| 202 | 202 | // System.out.println("Estimated: " + wind.getTimePoint() + " " + wind.getPosition() + " " |
| 203 | 203 | // + Math.round(wind.getFrom().getDegrees())); |
| ... | ... | @@ -239,7 +239,6 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra |
| 239 | 239 | } |
| 240 | 240 | assertTrue((double) foundCount / (double) targetWindFixes.size() > PERCENT_QUANTILE, |
| 241 | 241 | "Expected ratio of matching fixes to be at least "+PERCENT_QUANTILE+" but was only "+(double) foundCount / (double) estimatedWindFixes.size()); |
| 242 | - performanceReport.write(); |
|
| 243 | 242 | } |
| 244 | 243 | |
| 245 | 244 | /** |