From 182188cd7d16e7aa9456ac531e8e40cca9857b9e Mon Sep 17 00:00:00 2001 From: Dylan McDowell Date: Fri, 19 Nov 2021 16:43:06 -0700 Subject: [PATCH 1/4] ARMA Changes for zeroFilter --- framework/SupervisedLearning/ARMA.py | 25 +++++++++++++++---- framework/SupervisedLearning/ROMCollection.py | 4 ++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/framework/SupervisedLearning/ARMA.py b/framework/SupervisedLearning/ARMA.py index 21473b02df..7b79439e40 100644 --- a/framework/SupervisedLearning/ARMA.py +++ b/framework/SupervisedLearning/ARMA.py @@ -2239,7 +2239,7 @@ def finalizeLocalRomSegmentEvaluation(self, settings, evaluation, globalPicker, evaluation[target][localPicker] += sig return evaluation - def finalizeGlobalRomSegmentEvaluation(self, settings, evaluation, weights=None): + def finalizeGlobalRomSegmentEvaluation(self, settings, evaluation, weights=None, slicer=None): """ Allows any global settings to be applied to the signal collected by the ROMCollection instance. Note this is called on the GLOBAL templateROM from the ROMcollection, NOT on the LOCAL supspace segment ROMs! @@ -2251,7 +2251,7 @@ def finalizeGlobalRomSegmentEvaluation(self, settings, evaluation, weights=None) # backtransform signal to preserve CDF ## how nicely does this play with zerofiltering? evaluation = self._finalizeGlobalRSE_preserveCDF(settings, evaluation, weights) - evaluation = self._finalizeGlobalRSE_zeroFilter(settings, evaluation, weights) + evaluation = self._finalizeGlobalRSE_zeroFilter(settings, evaluation, weights, slicer=slicer) return evaluation def _finalizeGlobalRSE_preserveCDF(self, settings, evaluation, weights): @@ -2287,7 +2287,7 @@ def _finalizeGlobalRSE_preserveCDF(self, settings, evaluation, weights): evaluation[target] = self._transformThroughInputCDF(evaluation[target], dist, weights) return evaluation - def _finalizeGlobalRSE_zeroFilter(self, settings, evaluation, weights): + def _finalizeGlobalRSE_zeroFilter(self, settings, evaluation, weights, slicer): """ Helper method for finalizeGlobalRomSegmentEvaluation, particularly for zerofiltering @@ -2298,10 +2298,25 @@ def _finalizeGlobalRSE_zeroFilter(self, settings, evaluation, weights): """ if self.zeroFilterTarget: mask = self._masks[self.zeroFilterTarget]['zeroFilterMask'] + if slicer is not None: + # truncated evaluation + # newMask = [] + # for sl in slicer: + # m = mask[sl.start:sl.stop].tolist() + # newMask.extend(m) + # newMask = np.asarray(newMask) + # clustered evaluation + newMask = [] + for sl in slicer: + m = mask[sl.start:sl.stop].tolist() + newMask.append(np.asarray(m)) + newMask = np.asarray(newMask) + else: + newMask = mask if self.multicycle: - evaluation[self.zeroFilterTarget][:, mask] = 0 + evaluation[self.zeroFilterTarget][:, newMask] = 0 else: - evaluation[self.zeroFilterTarget][mask] = 0 + evaluation[self.zeroFilterTarget][newMask] = 0 return evaluation diff --git a/framework/SupervisedLearning/ROMCollection.py b/framework/SupervisedLearning/ROMCollection.py index 0a34836cd8..8de2196821 100644 --- a/framework/SupervisedLearning/ROMCollection.py +++ b/framework/SupervisedLearning/ROMCollection.py @@ -902,6 +902,7 @@ def evaluate(self, edict): else: result, weights = self._createNDEvaluation(edict) clusterStartIndex = 0 # what index does this cluster start on in the truncated signal? + globalLocalPicker = [] for r, rom in enumerate(self._roms): # "r" is the cluster label # find ROM in cluster @@ -916,6 +917,7 @@ def evaluate(self, edict): #where in the original signal does this cluster-representing segment come from globalPicker = slice(delim[0], delim[-1] + 1) segmentLen = globalPicker.stop - globalPicker.start + globalLocalPicker.append(globalPicker) # where in the truncated signal does this cluster sit? if self._evaluationMode == 'truncated': localPicker = slice(clusterStartIndex, clusterStartIndex + segmentLen) @@ -928,7 +930,7 @@ def evaluate(self, edict): # make final modifications to full signal based on global settings ## for truncated mode, this is trivial. ## for clustered mode, this is complicated. - result = self._templateROM.finalizeGlobalRomSegmentEvaluation(self._romGlobalAdjustments, result, weights=weights) + result = self._templateROM.finalizeGlobalRomSegmentEvaluation(self._romGlobalAdjustments, result, weights=weights, slicer=globalLocalPicker) # TODO add cluster multiplicity to "result" as meta to the output #if self._evaluationMode == 'clustered': # result['cluster_multiplicity'] = np.asarray([len(x) for c, x in self._clusterInfo['map'].items() if c != 'unclustered']) From 88b3740556428dff7f685010a4390f716e2be49c Mon Sep 17 00:00:00 2001 From: Dylan McDowell Date: Mon, 10 Jan 2022 11:23:16 -0700 Subject: [PATCH 2/4] Remove comments --- framework/SupervisedLearning/ARMA.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/framework/SupervisedLearning/ARMA.py b/framework/SupervisedLearning/ARMA.py index 7b79439e40..f06e76753b 100644 --- a/framework/SupervisedLearning/ARMA.py +++ b/framework/SupervisedLearning/ARMA.py @@ -2300,12 +2300,6 @@ def _finalizeGlobalRSE_zeroFilter(self, settings, evaluation, weights, slicer): mask = self._masks[self.zeroFilterTarget]['zeroFilterMask'] if slicer is not None: # truncated evaluation - # newMask = [] - # for sl in slicer: - # m = mask[sl.start:sl.stop].tolist() - # newMask.extend(m) - # newMask = np.asarray(newMask) - # clustered evaluation newMask = [] for sl in slicer: m = mask[sl.start:sl.stop].tolist() From dc2a3e0de261ab3616c39e56cb98b4351e0a244b Mon Sep 17 00:00:00 2001 From: "Paul W. Talbot" Date: Wed, 12 Jan 2022 15:42:22 -0700 Subject: [PATCH 3/4] updated submod to dec2021 milestone updates --- plugins/HERON | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/HERON b/plugins/HERON index 9f6372466e..fde59c90f6 160000 --- a/plugins/HERON +++ b/plugins/HERON @@ -1 +1 @@ -Subproject commit 9f6372466e169d68d238dd21227fb421e5ab34c0 +Subproject commit fde59c90f6a09eca09cf67081b78edf9b056963f From 8ca2a9ea0e1c9af16c9ca74b28c392c9f88630b5 Mon Sep 17 00:00:00 2001 From: "Paul W. Talbot" Date: Mon, 17 Jan 2022 08:01:13 -0700 Subject: [PATCH 4/4] serialization of shared-folder test in HERON --- plugins/HERON | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/HERON b/plugins/HERON index fde59c90f6..f9fbe2f81e 160000 --- a/plugins/HERON +++ b/plugins/HERON @@ -1 +1 @@ -Subproject commit fde59c90f6a09eca09cf67081b78edf9b056963f +Subproject commit f9fbe2f81ec16cc6209168d312425c934c134540