From 2238dac49b27b0ada5126c703cc1a5a7f2f217d3 Mon Sep 17 00:00:00 2001 From: Ananth Ravi Kumar Date: Mon, 11 Apr 2016 09:56:08 -0700 Subject: [PATCH] Removed Files --- function3.py | 27 --------------------------- function4.py | 19 ------------------- 2 files changed, 46 deletions(-) delete mode 100644 function3.py delete mode 100644 function4.py diff --git a/function3.py b/function3.py deleted file mode 100644 index 0710598..0000000 --- a/function3.py +++ /dev/null @@ -1,27 +0,0 @@ -import numpy as np -from function4 import getSkipMean -def removePeriodicMean(signalMat, period, sliderWidth, NoDataCode): - """ - :param signalMat: n - column matrix where variables represent timeseries - :param period: length of repeating pattern of data (i.e. seasons, years, etc). - :param sliderWidth: Number of periods to base the anomaly on. - :param NoDatCode: data value to be ignored - :return: matrix of values that accounts for periodic averages - """ - nData, nSignals = np.shape(signalMat) - newLength = nData - period * (sliderWidth - 1) - anomalyMat = np.nan * np.zeros(shape = (newLength, nSignals)) - avg = np.nan * np.zeros(shape=(nData, nSignals)) - - for i in range(newLength): - for j in range(nSignals): - end = i + (sliderWidth*period) - 1 - avg[i,j] = getSkipMean(signalMat[i:end:period, j], NoDataCode) - - if avg[i,j] == NoDataCode or signalMat[i,j] == NoDataCode: - anomalyMat[i,j] = NoDataCode - else: - anomalyMat[i,j] = signalMat[i,j] - avg[i,j] - - return anomalyMat - diff --git a/function4.py b/function4.py deleted file mode 100644 index a41b527..0000000 --- a/function4.py +++ /dev/null @@ -1,19 +0,0 @@ -import numpy as np -def getSkipMean(vector, NoDataCode): - """ - :param vector: vector of values. - :param NoDataCode: indicates value to be ignored - :return: average of the values in the vector ignoring NoData values - """ - N, _ = np.shape(vector) - sum = 0 - nVals = 0 - for i in range(N): - if vector[i] != NoDataCode: - sum+=vector[i] - nVals += 1 - if nVals > 0: - avg = sum/nVals - else: - avg = NoDataCode - return avg \ No newline at end of file