コード例 #1
0
    def __init__(self, F, accountForDelay=True):
        """Constructor

        applies sinx/x interpolating filter.

        @param F float amount of delay to apply.  The delay is in samples of the input waveform.
        @param accountForDelay (optional) boolean whether to account for the delay
        @remark
        if accountForDelay, then the filter provides a sample phase adjustment, meaning
        that there is no actual delay applied to the waveform, but the time axis under
        the waveform is shifted.  This is the usual way to apply this filter and is used
        to adapt waveforms on different time axes to each other.\n
        if not accountForDelay, then the filter actually delays waveforms by the delay
        specified.
        @remark
        The filter is hard-coded  in a static member to have 64 samples on each side of a center sample.
        In other words, it is 2*64+1=129 samples in length.
        """
        # pragma: silent exclude
        from SignalIntegrity.Lib.TimeDomain.Filters.FilterDescriptor import FilterDescriptor
        # pragma: include
        U = 1
        FirFilter.__init__(
            self,
            FilterDescriptor(U, self.S + F if accountForDelay else self.S,
                             2 * self.S), SinX(self.S, U, F))
コード例 #2
0
 def __init__(self, S=1):
     """Constructor
     @param S integer side samples.  The filter is 2*S+1 total samples.
     """
     L = 2 * S + 1
     w = [math.cos(2 * math.pi * (k - S) / L) * 0.5 + 0.5 for k in range(L)]
     Scale = sum(w)
     w = [tap / Scale for tap in w]
     FirFilter.__init__(self, FilterDescriptor(1, S, 2 * S), w)
コード例 #3
0
 def __init__(self, U):
     """Constructor  
     applies a sinx/x interpolating filter.
     @param U integer upsample factor of the filter.
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.TimeDomain.Filters.FilterDescriptor import FilterDescriptor
     # pragma: include
     F = 0.
     FirFilter.__init__(self, FilterDescriptor(U, self.S + F, 2 * self.S),
                        SinX(self.S, U, F))
コード例 #4
0
 def __init__(self, U):
     """Constructor  
     applies a linear interpolating filter.
     @param U integer upsample factor of the filter.
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.TimeDomain.Filters.FilterDescriptor import FilterDescriptor
     # pragma: include
     FirFilter.__init__(
         self,
         FilterDescriptor(U, (U - 1.) / float(U), 2 * (U - 1.) / float(U)),
         [float(u + 1) / float(U) for u in range(U)] +
         [1 - float(u + 1) / float(U) for u in range(U - 1)])
コード例 #5
0
 def FirFilter(self):
     """FIR filter equivalent of impulse response for processing
     
     @return an instance of class FirFilter that can be convolved with a waveform
     """
     td = self.td
     return FirFilter(FilterDescriptor(1, -td.H * td.Fs, td.K - 1),
                      self.Values())
コード例 #6
0
 def __init__(self, F, accountForDelay=True):
     """Constructor  
     applies a two-tap linear interpolating filter.
     @param F float amount of delay to apply.  The delay is in samples of the input waveform.
     @param accountForDelay (optional) boolean whether to account for the delay
     @remark if accountForDelay, then the filter provides a sample phase adjustment, meaning
     that there is no actual delay applied to the waveform, but the time axis under
     the waveform is shifted.  This is the usual way to apply this filter and is used
     to adapt waveforms on different time axes to each other.\n
     if not accountForDelay, then the filter actually delays waveforms by the delay
     specified.
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.TimeDomain.Filters.FilterDescriptor import FilterDescriptor
     # pragma: include
     FirFilter.__init__(
         self,
         FilterDescriptor(1, (F if F >= 0 else 1 +
                              F) if accountForDelay else 0, 1),
         [1 - F, F] if F >= 0 else [-F, 1 + F])
コード例 #7
0
 def FilterWaveform(self, wf):
     """overloads base class FilterWaveform
     @param wf instance of class Waveform
     @return instance of class Waveform containing the upsampled, interpolated wf
     @remark
     This method first classically upsamples the waveform by inserting zeros
     between the samples and then passes the upsampled waveform through the sinx/x
     interpolation filter.
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.TimeDomain.Waveform.Waveform import Waveform
     # pragma: include
     fd = self.FilterDescriptor()
     us = [0. for k in range(len(wf) * fd.U)]
     for k in range(len(wf)):
         us[k * fd.U] = wf[k]
     return FirFilter.FilterWaveform(self, Waveform(wf.td, us))