コード例 #1
0
ファイル: lazy_filters.py プロジェクト: uqjwen/audiolazy
  def freq_response(self, freq):
    """
    Frequency response for this filter.

    Parameters
    ----------
    freq :
      Frequency, in rad/sample. Can be an iterable with frequencies.

    Returns
    -------
    Complex number with the frequency response of the filter.

    See Also
    --------
    dB10 :
      Logarithmic power magnitude from data with squared magnitude.
    dB20 :
      Logarithmic power magnitude from raw complex data or data with linear
      amplitude.
    phase :
      Phase from complex data.
    LinearFilter.plot :
      Method to plot the LTI filter frequency and phase response into a
      Matplotlib figure.

    """
    z_ = complex_exp(-1j * freq)
    num = self.numpoly(z_)
    den = self.denpoly(z_)
    if not isinstance(den, Stream):
      if den == 0:
        return nan
    return num / den
コード例 #2
0
  def freq_response(self, freq):
    """
    Frequency response for this filter.

    Parameters
    ----------
    freq :
      Frequency, in rad/sample. Can be an iterable with frequencies.

    Returns
    -------
    Complex number with the frequency response of the filter.

    See Also
    --------
    dB10 :
      Logarithmic power magnitude from data with squared magnitude.
    dB20 :
      Logarithmic power magnitude from raw complex data or data with linear
      amplitude.
    phase :
      Phase from complex data.

    """
    z_ = complex_exp(-1j * freq)
    num = self.numpoly(z_)
    den = self.denpoly(z_)
    if not isinstance(den, Stream):
      if den == 0:
        return nan
    return num / den
コード例 #3
0
ファイル: lazy_filters.py プロジェクト: aylons/audiolazy
  def freq_response(self, freq):
    """
    Frequency response for this filter.

    Parameters
    ----------
    freq :
      Frequency, in rad/sample. Can be an iterable with frequencies.

    Returns
    -------
    Complex number with the frequency response of the filter. You can use
    ``20 * log10(abs(result))`` to get its power magnitude in dB, and
    Numpy ``angle(result)`` or built-in ``phase(result)`` to get its phase.

    """
    z_ = complex_exp(-1j * freq)
    num = self.numpoly(z_)
    den = self.denpoly(z_)
    if not isinstance(den, Stream):
      if den == 0:
        return nan
    return num / den