def test_multitaper_spectral_normalization():

    x = np.random.randn(1024)
    f1, Xp1, _ = tsa.multi_taper_psd(x)
    f2, Xp2, _ = tsa.multi_taper_psd(x, Fs=100)
    f3, Xp3, _ = tsa.multi_taper_psd(x, NFFT=2**12)

    p1 = np.sum(Xp1) * 2 * np.pi / 2**10
    p2 = np.sum(Xp2) * 100 / 2**10
    p3 = np.sum(Xp3) * 2 * np.pi / 2**12
    nt.assert_true( np.abs(p1 - p2) < 1e-14,
                    'Inconsistent frequency normalization in MTM PSD (1)' )
    nt.assert_true( np.abs(p3 - p2) < 1e-8,
                    'Inconsistent frequency normalization in MTM PSD (2)' )

    td_var = np.var(x)
    # assure that the estimators are at least in the same
    # order of magnitude as the time-domain variance
    nt.assert_true( np.abs(np.log10(p1/td_var)) < 1,
                    'Incorrect frequency normalization in MTM PSD' )

    # check the freq vector while we're here
    nt.assert_true( f2.max() == 50, 'MTM PSD returns wrong frequency bins' )
Sets the gamma correction of the FadeCandy. Specifically this is the
dataset/ETHPy150Open nipy/nitime/nitime/algorithms/tests/test_spectral.py/test_multitaper_spectral_normalization--crossover with--dataset/ETHPy150Open missionpinball/mpf/mpf/platform/fadecandy.py/FadeCandyOPClient.set_gamma