def __init__(self, *args, **kwargs): """ kwarg keys: name weight arm_ratio order """ # this filter bank has a name ScalarFilterBase.__init__(self, *args, **kwargs) """ This filter bank looks like this: |---------------------------------------------| | | | -------------- | | ----------- | diffr M1 |---------------|----> slope | / -------------- | px --->|- | | \ | | \ -------------------- | | \---------| dbl-diffr M1/2 |------------|----> curvature | -------------------- | | | |---------------------------------------------| """ # aux this_order = kwargs.get('order', 1) name_slope_arm = "%s-slope" % kwargs.get('name', 'scf') name_curv_arm = "%s-curv" % kwargs.get('name', 'scf') # the slope filter self._slope_filter = ScalarHomogeneousDifferencer(name=name_slope_arm, order=this_order, weight=1.0) # the curvature filter. This filter is a chain of two half-M1 differencers self._curv_filter = ScalarHomogeneousDoubleDifferencer(name=name_curv_arm, order=this_order, weight=1.0) self._meta_data_queue = deque() #-------------------------------------------------------------------- # in this pythonic environ need to have more explicit assurance that the filter is made self._is_made = False
def __init__(self, *args, **kwargs): """ This double-differencer is a cascade of two differencers: |-------------------------------------------| | | | ---------------- ---------------- | --->|---| diffr M1 |---| diffr M1 |-----|----> double difference | ---------------- ---------------- | | | |-------------------------------------------| This cascade halves the bandwidth of either differencer. When used in conjuction with a single differencer, the M1 value here must be 1/2 the M1 value of the single differencer. Specifically: single differencer: M1 = (tau_+ + tau_-) / 2 double differencer: M1 = (tau_+ + tau_-) / 4 With these conditions, the delay of the single- and double-differencer is nearly the same. kwarg keys: name weight arm_ratio order """ # the differencer has a name ScalarFilterBase.__init__(self, *args, **kwargs) # instantiate an underlying poly-ema pair this_order = kwargs.get('order', 1) name_1st_fltr = "%s-1st" % kwargs.get('name', 'f') name_2nd_fltr = "%s-2nd" % kwargs.get('name', 'f') # a note on weights: the filter output is the cascade of these two filters. The total filter # output weight needs to be 1/2 self._1st_fltr = ScalarHomogeneousDifferencer(name=name_1st_fltr, order=this_order, weight=1.0) self._2nd_fltr = ScalarHomogeneousDifferencer(name=name_2nd_fltr, order=this_order, weight=0.5) #-------------------------------------------------------------------- # in this pythonic environ need to have more explicit assurance that the filter is made self._is_made = False
def __init__(self, *args, **kwargs): # base class ctor first ScalarFilterBase.__init__(self, *args, **kwargs) # all poly emas have an order self._order = kwargs.get('order', 1) self._zero_based_order = self._order - 1 #-------------------------------------------------------------------- # buffers # 1 linear buffer for lags on output y[n] self._Ycoef = [0.0 for x in range(self._order)] # 1 circular buffer for lags on output y[n] self._yn = FixedLengthCircularBuffer(self._order) # we only have 1 x[n] for polyemas self._Xcoef = 1.0 self._xn = 0.0 #-------------------------------------------------------------------- # initialization self._init = False self._v0 = 0.0 #-------------------------------------------------------------------- # filter parameters self._inv_gain = 1.0 # gain adjustment self._M1 = 1.0 # location parameter #-------------------------------------------------------------------- # event count to determine when the filter is ready self._event_count = 0 #-------------------------------------------------------------------- # in this pythonic environ need to have more explicit assurance that the filter is made self._is_made = False