def test_filter_bank_layer_psd(l_freq, h_freq, method):
    """
    Test the FilterBankLayer by analyzing the power spectral density (PSD) of
    the output using MNE.
    """
    # Test parameters
    sfreq = 256  # Sampling frequency in Hz
    duration = 5  # Duration in seconds
    t = np.arange(0, duration, 1 / sfreq)  # Time vector

    # Generate a composite signal with multiple sine waves
    freqs = [2, 4, 6, 10, 14, 18, 22, 26, 30, 34, 38]
    signals = [np.sin(2 * np.pi * freq * t) for freq in freqs]
    composite_signal = np.sum(signals, axis=0)

    # Convert the signal to a torch tensor
    composite_signal_torch = torch.tensor(composite_signal, dtype=torch.float32).unsqueeze(0).unsqueeze(1)

    # Initialize the FilterBankLayer
    filter_bank_layer = FilterBankLayer(
        n_chans=1,
        sfreq=sfreq,
        method=method,
        filter_length=1024, # Making an huge filter
        l_trans_bandwidth=1.0,  # Narrower transition bands
        h_trans_bandwidth=1.0, # Narrower transition bands
        band_filters=[(l_freq, h_freq)],
        verbose=False
    )

    # Apply the FilterBankLayer to the composite signal
    filtered_signals = filter_bank_layer(composite_signal_torch)
    # Shape after squeezing: (n_times,)
    filtered_signal_np = filtered_signals.squeeze().detach().numpy()

    # Compute PSD using MNE
    psds, freqs = psd_array_welch(
        filtered_signal_np,
        sfreq=sfreq,
        fmin=0,
        fmax=sfreq / 2,
        n_fft=1024,
        average='mean',
        verbose=False
    )

    # Identify frequencies within and outside the band
    idx_in_band = np.where((freqs >= l_freq) & (freqs <= h_freq))[0]
    idx_out_band = np.where((freqs < l_freq) | (freqs > h_freq))[0]

    # Calculate power in and out of the band
    power_in_band = np.sum(psds[idx_in_band])
    power_out_band = np.sum(psds[idx_out_band])

    # Assert that power in the band is significantly higher than outside
    assert power_in_band > 10 * power_out_band, \
        (f"Power in band {l_freq}-{h_freq} Hz is not significantly higher "
         f"than outside the band.")

    Test the FilterBankLayer by analyzing the power spectral density (PSD) of
    the output using MNE.
    
test/unit_tests/models/test_modules.py