def test_filter_bank_layer_fftconvolve_comparison_fir(l_freq, h_freq,
                                                      fir_design, fir_window,
                                                      phase):
    """
    Test that the FilterBankLayer applies FIR filters correctly across multiple channels
    by comparing its output to scipy's fftconvolve.
    """
    # ---------------------------
    # 1. Setup Test Parameters
    # ---------------------------

    # Set random seeds for reproducibility
    torch.manual_seed(0)
    np.random.seed(0)

    # Define parameters
    batch_size = 1
    n_chans = 22
    n_times = 1000
    sfreq = 256  # Sampling frequency in Hz
    tolerance = 1e5
    # Generate random input tensor: Shape (batch_size, n_chans, n_times)
    x = torch.randn(batch_size, n_chans, n_times).float()

    filter_parameters = dict(
        sfreq=sfreq,
        method='fir',
        phase=phase,
        filter_length=1024, # If the filter length is not this side, nothing works
        l_trans_bandwidth=1.0,  # Narrower transition bandwidth
        h_trans_bandwidth=1.0,
        fir_window=fir_window,
        fir_design=fir_design,
        verbose=True)

    # Create FIR filter using MNE:
    filt = create_filter(data=None, l_freq=l_freq, h_freq=h_freq, **filter_parameters)

    # Expand filter to match channels: Shape (1, n_chans, filter_length)
    filt_expanded = torch.from_numpy(filt).unsqueeze(0).repeat(n_chans,
                                                               1).unsqueeze(0).float()

    # ---------------------------
    # 2. Initialize FilterBankLayer
    # ---------------------------

    # Initialize the FilterBankLayer with one band
    filter_bank_layer = FilterBankLayer(
        n_chans=n_chans,
        band_filters=[(l_freq, h_freq)],
        # Increased filter length for better frequency resolution
        **filter_parameters
    )

    # ---------------------------
    # 3. Apply FilterBankLayer
    # ---------------------------

    # Apply the filter bank to the input tensor
    # Expected output shape: (batch_size, n_bands, n_chans, n_times)
    filtered_output = filter_bank_layer(x)

    # Convert the FilterBankLayer output to NumPy for comparison
    filtered_torch_np = filtered_output.numpy()

    # Convert input tensor and filter to NumPy arrays
    x_numpy = x.numpy()  # Shape: (1, n_chans, n_times)
    filt_numpy = filt_expanded.numpy()  # Shape: (1, n_chans, filter_length)

    # Apply scipy's fftconvolve per Channel
    filtered_scipy = fftconvolve_scipy(x_numpy, filt_numpy, mode='same', axes=2)

    # Assert that all differences are below the tolerance
    assert np.allclose(filtered_torch_np, filtered_scipy, atol=tolerance), (
        f"Filtered outputs differ beyond the tolerance of {tolerance}."
    )

    Test that the FilterBankLayer applies FIR filters correctly across multiple channels
    by comparing its output to scipy's fftconvolve.
    
test/unit_tests/models/test_modules.py