docstr: For one lowpass, bandpass, and highpass example filter, this test
  checks two things:
    - the mean squared error over the frequency domain of the unscaled
      filter is smaller than the scaled filter (true for rectangular
      window)
    - the response of the scaled filter is exactly unity at the center
      of the first passband
docstr_tok: ["For","one","lowpass",",","bandpass",",","and","highpass","example","filter",",","this","test","checks","two","things",":","-","the","mean","squared","error","over","the","frequency","domain","of","the","unscaled","filter","is","smaller","than","the","scaled","filter","(","true","for","rectangular","window",")","-","the","response","of","the","scaled","filter","is","exactly","unity","at","the","center","of","the","first","passband"]
code: def test_scaling(self):
      """
      For one lowpass, bandpass, and highpass example filter, this test
      checks two things:
        - the mean squared error over the frequency domain of the unscaled
          filter is smaller than the scaled filter (true for rectangular
          window)
        - the response of the scaled filter is exactly unity at the center
          of the first passband
      """
      N = 11
      cases = [
          ([0.5], True, (0, 1)),
          ([0.2, 0.6], False, (0.4, 1)),
          ([0.5], False, (1, 1)),
      ]
      for cutoff, pass_zero, expected_response in cases:
          h = firwin(
              N, cutoff, scale=False, pass_zero=pass_zero, window="ones"
          )
          hs = firwin(
              N, cutoff, scale=True, pass_zero=pass_zero, window="ones"
          )
          if len(cutoff) == 1:
              if pass_zero:
                  cutoff = [0] + cutoff
              else:
                  cutoff = cutoff + [1]
          assert_(
              self.mse(h, [cutoff]) < self.mse(hs, [cutoff]),
              "least squares violation",
          )
          self.check_response(hs, [expected_response], 1e-12)
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_equal, assert_, assert_allclose, assert_warns
  from pytest import raises
  from scipy.special import sinc
  from scipy.signal import kaiser_beta, kaiser_atten, kaiserord, firwin, firwin2, freqz, remez, firls, minimum_phase
label_desc: Use image node_id 4 for calling the TestFirwin obj's underlying member method code with example usage: obj.test_scaling() without return types