Removed use of Filter.type property

This commit is contained in:
Will Boyd 2016-11-28 10:22:47 -05:00
parent 2c25ec9765
commit 0a0b50de2f
2 changed files with 627 additions and 437 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,7 @@
from abc import ABCMeta, abstractproperty
from abc import ABCMeta
from collections import Iterable, OrderedDict
import copy
from numbers import Real, Integral
import sys
from xml.etree import ElementTree as ET
from six import add_metaclass
@ -829,7 +828,7 @@ class EnergyFilter(Filter):
if bins[index] < bins[index-1]:
msg = 'Unable to add bin edges "{0}" to a "{1}" Filter ' \
'since they are not monotonically ' \
'increasing'.format(bins, self.type)
'increasing'.format(bins, type(self))
raise ValueError(msg)
def can_merge(self, other):
@ -848,7 +847,7 @@ class EnergyFilter(Filter):
def merge(self, other):
if not self.can_merge(other):
msg = 'Unable to merge "{0}" with "{1}" ' \
'filters'.format(self.type, other.type)
'filters'.format(type(self), other.type)
raise ValueError(msg)
# Merge unique filter bins
@ -1324,13 +1323,11 @@ class PolarFilter(Filter):
# Extract the lower and upper angle bounds, then repeat and tile
# them as necessary to account for other filters.
lo_bins = np.repeat(self.bins[:-1], self.stride)
hi_bins = np.repeat(self.bins[1:], self.stride)
tile_factor = data_size / len(lo_bins)
lo_bins = np.tile(lo_bins, tile_factor)
hi_bins = np.tile(hi_bins, tile_factor)
# Add the new angle columns to the DataFrame.
df.loc[:, self.type + ' low'] = lo_bins
df.loc[:, 'polar low'] = lo_bins
return df
@ -1402,13 +1399,11 @@ class AzimuthalFilter(Filter):
# Extract the lower and upper angle bounds, then repeat and tile
# them as necessary to account for other filters.
lo_bins = np.repeat(self.bins[:-1], self.stride)
hi_bins = np.repeat(self.bins[1:], self.stride)
tile_factor = data_size / len(lo_bins)
lo_bins = np.tile(lo_bins, tile_factor)
hi_bins = np.tile(hi_bins, tile_factor)
# Add the new angle columns to the DataFrame.
df.loc[:, self.type + ' low'] = lo_bins
df.loc[:, 'azimuthal low'] = lo_bins
return df