code: def test_scaling(
      scale_to: Literal["magnitude", "psd"], fac_psd, fac_mag
  ):
      """Verify scaling calculations.
  
      * Verify passing `scale_to`parameter  to ``__init__().
      * Roundtrip while changing scaling factor.
      """
      SFT = ShortTimeFFT(np.ones(4) * 2, hop=4, fs=1, scale_to=scale_to)
      assert SFT.fac_psd == fac_psd
      assert SFT.fac_magnitude == fac_mag
      # increase coverage by accessing properties twice:
      assert SFT.fac_psd == fac_psd
      assert SFT.fac_magnitude == fac_mag
  
      x = np.fft.irfft([0, 0, 7, 0, 0, 0, 0])  # periodic signal
      Sx = SFT.stft(x)
      Sx_mag, Sx_psd = Sx * SFT.fac_magnitude, Sx * SFT.fac_psd
  
      SFT.scale_to("magnitude")
      x_mag = SFT.istft(Sx_mag, k1=len(x))
      assert_allclose(x_mag, x)
  
      SFT.scale_to("psd")
      x_psd = SFT.istft(Sx_psd, k1=len(x))
      assert_allclose(x_psd, x)
  
imports: import math
  from itertools import product
  from typing import cast, get_args, Literal
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_equal
  from scipy.fft import fftshift
  from scipy.stats import norm
  from scipy.signal import get_window, welch, stft, istft, spectrogram
  from scipy.signal._short_time_fft import FFT_MODE_TYPE, _calc_dual_canonical_window, ShortTimeFFT, PAD_TYPE
  from scipy.signal.windows import gaussian
label_desc: Use image node_id 9 for calling a global function with example usage: test_scaling(scale_to, fac_psd, fac_mag) without return types