From 1200b13f956ca24436bbf148702d743964c69a4d Mon Sep 17 00:00:00 2001 From: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:53:00 +0000 Subject: [PATCH] Exception handling in CTD --- .../mht/MHTClickTrainAlgorithm.java | 5 ++++ .../clickTrainAlgorithms/mht/MHTKernel.java | 25 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTClickTrainAlgorithm.java b/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTClickTrainAlgorithm.java index 66fdabe3..7f50025e 100644 --- a/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTClickTrainAlgorithm.java +++ b/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTClickTrainAlgorithm.java @@ -354,6 +354,7 @@ public class MHTClickTrainAlgorithm implements ClickTrainAlgorithm, PamSettings TrackBitSet trackBitSet; TrackDataUnits trackUnits; if (nTracks>0) Debug.out.println("-------------------Grab Done Trains---------------"); + try { for (int i =0; i0) Debug.out.println("-------------------------------------------------"); diff --git a/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTKernel.java b/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTKernel.java index 3a4fb0ee..4fa9cdfb 100644 --- a/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTKernel.java +++ b/src/clickTrainDetector/clickTrainAlgorithms/mht/MHTKernel.java @@ -3,6 +3,7 @@ package clickTrainDetector.clickTrainAlgorithms.mht; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; +import java.util.Comparator; import PamUtils.PamArrayUtils; import PamguardMVC.debug.Debug; @@ -286,6 +287,7 @@ public class MHTKernel { MHTChi2 mhtChi2; int index; synchronized(trackSynchronisation) { + try { for (int i=0; i { //added the cloned bitset to not mess up references newPossibilities.add(new TrackBitSet(currentBitSet, mhtChi2)); } + } + catch (Exception e) { + System.out.printf("******* MHTKernel Exception %s in growProbMatrix: %s\n", e.getClass().getSimpleName(), e.getMessage()); + } } } @@ -348,10 +354,21 @@ public class MHTKernel { //first sort the tracks by increasing chi2 values. //sort the possible tracks by chi2 values //now sort the chi2 values so they correspond to the track list. - Collections.sort(newPossibleTracks, (left, right)->{ - //Note- this is definitely in the correct order - return Double.compare(left.chi2Track.getChi2(), right.chi2Track.getChi2()); - }); +// Collections.sort(newPossibleTracks, (left, right)->{ +// //Note- this is definitely in the correct order +// return Double.compare(left.chi2Track.getChi2(), right.chi2Track.getChi2()); +// }); + try { + Collections.sort(newPossibleTracks, new Comparator() { + @Override + public int compare(TrackBitSet left, TrackBitSet right) { + return Double.compare(left.chi2Track.getChi2(), right.chi2Track.getChi2()); + } + }); + } + catch (Exception e) { + System.out.printf("******* MHTKernel Exception %s in pruneProbMatrix: %s\n", e.getClass().getSimpleName(), e.getMessage()); + } // for (int i=0; i