<commit_before>"""IIR and FIR filtering functions"""

import warnings
import numpy as np
from scipy.fftpack import fft, ifftshift, fftfreq
from scipy.signal.windows import get_window
from scipy.signal import freqz, iirdesign, iirfilter, filter_dict
from scipy import signal, stats
from copy import deepcopy

import logging
logger = logging.getLogger('mne')

from .fixes import firwin2, filtfilt  # back port for old scipy
from .time_frequency.multitaper import dpss_windows, _mt_spectra
from . import verbose
from .parallel import parallel_func
from .cuda import setup_cuda_fft_multiply_repeated, fft_multiply_repeated, \
                  setup_cuda_fft_resample, fft_resample, _smart_pad


def is_power2(num):
    """Test if number is a power of 2

    Parameters
    ----------
    num : int
        Number.

    Returns
    -------
    b : bool
        True if is power of 2.

    Example
    -------
    >>> is_power2(2 ** 3)<commit_msg>FIX : import for old version of scipy<commit_after>"""IIR and FIR filtering functions"""

import warnings
import numpy as np
from scipy.fftpack import fft, ifftshift, fftfreq
from scipy.signal import freqz, iirdesign, iirfilter, filter_dict, get_window
from scipy import signal, stats
from copy import deepcopy

import logging
logger = logging.getLogger('mne')

from .fixes import firwin2, filtfilt  # back port for old scipy
from .time_frequency.multitaper import dpss_windows, _mt_spectra
from . import verbose
from .parallel import parallel_func
from .cuda import setup_cuda_fft_multiply_repeated, fft_multiply_repeated, \
                  setup_cuda_fft_resample, fft_resample, _smart_pad


def is_power2(num):
    """Test if number is a power of 2

    Parameters
    ----------
    num : int
        Number.

    Returns
    -------
    b : bool
        True if is power of 2.

    Example
    -------
    >>> is_power2(2 ** 3)
{'fraction_non_alphanumeric': 0.08528784648187633, 'fraction_numerical': 0.007462686567164179, 'mean_word_length': 3.0893246187363834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3163663', 'n_tokens_mistral': 619, 'n_tokens_neox': 591, 'n_words': 196}