diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index d32b7328878245b06016b643c078f5524192c51a..552f7be584ed45980b61076d7834fad669addff1 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -138,14 +138,12 @@ class FilterAlgorithm(Algorithm): # sums of the total 'weights' of the filter corresponding to # valid samples as_weight_sums = np.dot(window, (~as_masked.mask).T) - # sums of total number of invalid entries for each appplication + # sums of total number of invalid entries for each application # of the filter as_invalid_sums = np.sum(as_masked.mask) # mark the output locations as 'bad' that don't have the minimum # number of samples - as_invalid_masked = np.ma.masked_greater(as_invalid_sums, - np.floor( - allowed_bad*numtaps)) + as_invalid_masked = np.ma.masked_greater(as_weight_sums, allowed_bad) # apply filter, using masked version of dot (in 3.5 and above, there # seems to be a move toward np.matmul and/or @ operator as opposed to @@ -185,8 +183,8 @@ class FilterAlgorithm(Algorithm): """ half = self.numtaps//2 - start = start - half*self.interval - end = end + half*self.interval + start = start - half*self.sample_period + end = end + half*self.sample_period return (start, end) diff --git a/test/algorithm_test/FilterAlgorithm_test.py b/test/algorithm_test/FilterAlgorithm_test.py index 98b39f14e072016340c6878b23d8118e84db923a..4b06d8d339e6552b56ca373ec5e2de6585b81a79 100644 --- a/test/algorithm_test/FilterAlgorithm_test.py +++ b/test/algorithm_test/FilterAlgorithm_test.py @@ -18,6 +18,7 @@ def test_process(): factory = i2.IAGA2002Factory() min = factory.parse_string(min_iaga2002_string) sec = factory.parse_string(sec_iaga2002_string) + a = filt() # process hezf (raw) channels with loaded transform filt_bou = a.process(sec, inchannels=('SVH','SVE','SVZ','SSF'),