Ejemplo n.º 1
0
 def __init__(self, bpass, bstop, ftype='butter'):
     self.b, self.a = fd.iirdesign(bpass,
                                   bstop,
                                   1,
                                   100,
                                   ftype=ftype,
                                   output='ba')
     self.ic = st.lfiltic(self.b, self.a, (0.0, ))
Ejemplo n.º 2
0
 def __init__(self, bpass, bstop, ftype='butter'):
     import scipy.signal.filter_design as fd
     import scipy.signal.signaltools as st
     self.b, self.a = fd.iirdesign(bpass,
                                   bstop,
                                   1,
                                   100,
                                   ftype=ftype,
                                   output='ba')
     self.ic = st.lfiltic(self.b, self.a, (0.0, ))
Ejemplo n.º 3
0
    def __init__(self, outputConfig, frequency_hz=0.):
        '''
    Initialize filter object.

    Parameters
    ----------
    outputConfig : object
      Output configuration parameters object
    frequency_hz : float
      Intermediate frequency
    '''
        super(LowPassFilter, self).__init__(3., 40.)

        self.bw_hz = 1e6
        passBand_hz = frequency_hz + self.bw_hz
        stopBand_hz = frequency_hz + self.bw_hz * 1.2

        nyqFreq_s = 2. / outputConfig.SAMPLE_RATE_HZ  # 1.0 /Nyquist frequency
        wp = passBand_hz * nyqFreq_s
        ws = stopBand_hz * nyqFreq_s

        order, wn = cheb2ord(wp=wp,
                             ws=ws,
                             gpass=self.passBandAtt_dbhz,
                             gstop=self.stopBandAtt_dbhz,
                             analog=False)
        self.order = order
        self.wn = wn

        b, a = cheby2(
            order + 1,  # Order of the filter
            # Minimum attenuation required in the stop band in dB
            self.stopBandAtt_dbhz,
            wn,
            btype="lowpass",
            analog=False,
            output='ba')

        self.a = a
        self.b = b
        self.zi = lfiltic(self.b, self.a, [])
Ejemplo n.º 4
0
    def __init__(self, outputConfig, frequency_hz, bw_hz=1e6):
        '''
    Initialize filter object.

    Parameters
    ----------
    outputConfig : object
      Output configuration parameters object
    frequency_hz : float
      Intermediate frequency in hertz
    bw_hz : float, optional
      Noise bandwidth in hertz
    '''
        super(BandPassFilter, self).__init__(3., 40.)

        self.bw_hz = bw_hz
        self.frequency_hz = frequency_hz
        passBand_hz = bw_hz
        stopBand_hz = bw_hz * 1.2
        mult = 2. / outputConfig.SAMPLE_RATE_HZ
        order, wn = cheb2ord(wp=[(frequency_hz - passBand_hz) * mult,
                                 (frequency_hz + passBand_hz) * mult],
                             ws=[(frequency_hz - stopBand_hz) * mult,
                                 (frequency_hz + stopBand_hz) * mult],
                             gpass=self.passBandAtt_dbhz,
                             gstop=self.stopBandAtt_dbhz,
                             analog=False)

        b, a = cheby2(
            order + 1,  # Order of the filter
            # Minimum attenuation required in the stop band in dB
            self.stopBandAtt_dbhz,
            wn,
            btype="bandpass",
            analog=False,
            output='ba')

        self.a = a
        self.b = b
        self.zi = lfiltic(self.b, self.a, [])
Ejemplo n.º 5
0
  def __init__(self, outputConfig, frequency_hz, bw_hz=1e6):
    '''
    Initialize filter object.

    Parameters
    ----------
    outputConfig : object
      Output configuration parameters object
    frequency_hz : float
      Intermediate frequency in hertz
    bw_hz : float, optional
      Noise bandwidth in hertz
    '''
    super(BandPassFilter, self).__init__(3., 40.)

    self.bw_hz = bw_hz
    self.frequency_hz = frequency_hz
    passBand_hz = bw_hz
    stopBand_hz = bw_hz * 1.2
    mult = 2. / outputConfig.SAMPLE_RATE_HZ
    order, wn = cheb2ord(wp=[(frequency_hz - passBand_hz) * mult,
                             (frequency_hz + passBand_hz) * mult],
                         ws=[(frequency_hz - stopBand_hz) * mult,
                             (frequency_hz + stopBand_hz) * mult],
                         gpass=self.passBandAtt_dbhz,
                         gstop=self.stopBandAtt_dbhz,
                         analog=False)

    b, a = cheby2(order + 1,  # Order of the filter
                  # Minimum attenuation required in the stop band in dB
                  self.stopBandAtt_dbhz,
                  wn,
                  btype="bandpass",
                  analog=False,
                  output='ba')

    self.a = a
    self.b = b
    self.zi = lfiltic(self.b, self.a, [])
Ejemplo n.º 6
0
    def __init__(self, outputConfig, frequency_hz=0.0):
        """
    Initialize filter object.

    Parameters
    ----------
    outputConfig : object
      Output configuration parameters object
    frequency_hz : float
      Intermediate frequency
    """
        super(LowPassFilter, self).__init__(3.0, 40.0)

        self.bw_hz = 1e6
        passBand_hz = frequency_hz + self.bw_hz
        stopBand_hz = frequency_hz + self.bw_hz * 1.2

        nyqFreq_s = 2.0 / outputConfig.SAMPLE_RATE_HZ  # 1.0 /Nyquist frequency
        wp = passBand_hz * nyqFreq_s
        ws = stopBand_hz * nyqFreq_s

        order, wn = cheb2ord(wp=wp, ws=ws, gpass=self.passBandAtt_dbhz, gstop=self.stopBandAtt_dbhz, analog=False)
        self.order = order
        self.wn = wn

        b, a = cheby2(
            order + 1,  # Order of the filter
            # Minimum attenuation required in the stop band in dB
            self.stopBandAtt_dbhz,
            wn,
            btype="lowpass",
            analog=False,
            output="ba",
        )

        self.a = a
        self.b = b
        self.zi = lfiltic(self.b, self.a, [])
Ejemplo n.º 7
0
 def __init__(self, bpass, bstop, ftype='butter'):
     import scipy.signal.filter_design as fd
     import scipy.signal.signaltools as st
     self.b, self.a = fd.iirdesign(bpass, bstop, 1, 100, ftype=ftype, output='ba')
     self.ic = st.lfiltic(self.b, self.a, (0.0,))
Ejemplo n.º 8
0
 def __init__(self, bpass, bstop, ftype='butter'):
     self.b, self.a = fd.iirdesign(
             bpass, bstop, 1, 100, ftype=ftype, output='ba')
     self.ic = st.lfiltic(self.b, self.a, (0.0,))