diff --git a/pymht/initiators/m_of_n.py b/pymht/initiators/m_of_n.py index 9c2fbccf..6aef70b3 100644 --- a/pymht/initiators/m_of_n.py +++ b/pymht/initiators/m_of_n.py @@ -6,6 +6,7 @@ from scipy.stats import chi2 import logging import time +# import scipy.optimize.linear_sum_assignment tracking_parameters = { 'gate_probability': 0.99, diff --git a/pymht/pyTarget.py b/pymht/pyTarget.py index 5fffdeb3..77e69362 100644 --- a/pymht/pyTarget.py +++ b/pymht/pyTarget.py @@ -781,7 +781,8 @@ def _storeNodeSparse(self, simulationElement, **kwargs): unSmoothedNodes = self.backtrackNodes() - for node in unSmoothedNodes: + storeIndices = (0, -1) if len(unSmoothedNodes) > 1 else (0,) + for node in [unSmoothedNodes[i] for i in storeIndices]: stateElement = ET.SubElement(unSmoothedStates, stateTag, attrib={timeTag: str(node.time)}) diff --git a/pymht/tracker.py b/pymht/tracker.py index 1ebca908..e606c05f 100644 --- a/pymht/tracker.py +++ b/pymht/tracker.py @@ -1076,7 +1076,8 @@ def plotActiveTracks(self, **kwargs): def plotTerminatedTracks(self, **kwargs): colors = kwargs.get("colors", self._getColorCycle()) for track in self.__terminatedTargets__: - track.plotTrack(c=next(colors), markInitial=True, markEnd=True, terminated = True, **kwargs) + defaults = {'c':next(colors), 'markInitial': True, 'markEnd': True, 'terminated': True} + track.plotTrack(**{**defaults,**kwargs}) if kwargs.get('markStates', False): defaults = {'labels': False, 'dummy': True, 'real': True, 'ais': True} track.plotStates(float('inf'), **{**defaults, **kwargs}) diff --git a/pymht/utils/classDefinitions.py b/pymht/utils/classDefinitions.py index 9c8790ae..4ec41a64 100644 --- a/pymht/utils/classDefinitions.py +++ b/pymht/utils/classDefinitions.py @@ -186,12 +186,14 @@ def storeGroundTruth(self, scenarioElement, scenario, **kwargs): attrib={idTag:str(i)}) statesElement = ET.SubElement(trackElement, statesTag) + sampleCounter = 0 for j in range(nSamples): simTarget = self[j][i] inRange = simTarget.inRange(p0, radarRange) radarTime = ((simTarget.time-initialTime)%radarPeriod) == 0. if (not inRange) or (not radarTime): continue + sampleCounter += 1 stateElement = ET.SubElement(statesElement, stateTag, attrib={timeTag:str(simTarget.time), @@ -208,7 +210,7 @@ def storeGroundTruth(self, scenarioElement, scenario, **kwargs): trackElement.attrib[aisclassTag] = str(simTarget.aisClass) trackElement.attrib[prTag] = str(simTarget.P_r) statesElement.attrib[sigmaqTag] = str(simTarget.sigma_Q) - trackElement.attrib[lengthTag] = str(j+1) + trackElement.attrib[lengthTag] = str(sampleCounter) diff --git a/pymht/utils/xmlDefinitions.py b/pymht/utils/xmlDefinitions.py index bcab7dd9..7e14d63b 100644 --- a/pymht/utils/xmlDefinitions.py +++ b/pymht/utils/xmlDefinitions.py @@ -60,4 +60,14 @@ inverseResidualCovarianceTag = "S_inv" terminatedTag = "terminated" +totalTimeTag = "Total" +initTimeTag = "Init" +clusterTimeTag = "Cluster" +dynamicWindowTimeTag = "DynN" +optimizationTimeTag = "Optim" +npruneTimeTag = "N-prune" +growingTimeTag = "Process" +ilpPruneTimeTag = "ILP-Prune" +terminateTimeTag = "Terminate" + timeLogPrecision = 6 \ No newline at end of file