<filename>tests/test_band_stop_filter.py<gh_stars>0
import numpy as np
import torch

from torch_audiomentations import BandStopFilter


class TestBandStopFilter:
    def test_band_reject_filter(self):
        samples = np.array(
            [
                [[0.75, 0.5, -0.25, -0.125, 0.0], [0.65, 0.5, -0.25, -0.125, 0.0]],
                [[0.3, 0.5, -0.25, -0.125, 0.0], [0.9, 0.5, -0.25, -0.125, 0.0]],
                [[0.9, 0.5, -0.25, -1.06, 0.0], [0.9, 0.5, -0.25, -1.12, 0.0]],
            ],
            dtype=np.float32,
        )
        sample_rate = 16000

        augment = BandStopFilter(p=1.0, output_type="dict")
        processed_samples = augment(
            samples=torch.from_numpy(samples), sample_rate=sample_rate
        ).samples.numpy()
        assert processed_samples.shape == samples.shape
        assert processed_samples.dtype == np.float32

<filename>tests/test_band_stop_filter.py<gh_stars>0
import numpy as np
import torch

from torch_audiomentations import BandStopFilter


class TestBandStopFilter:
    def test_band_reject_filter(self):
        samples = np.array(
            [
                [[0.75, 0.5, -0.25, -0.125, 0.0], [0.65, 0.5, -0.25, -0.125, 0.0]],
                [[0.3, 0.5, -0.25, -0.125, 0.0], [0.9, 0.5, -0.25, -0.125, 0.0]],
                [[0.9, 0.5, -0.25, -1.06, 0.0], [0.9, 0.5, -0.25, -1.12, 0.0]],
            ],
            dtype=np.float32,
        )
        sample_rate = 16000

        augment = BandStopFilter(p=1.0, output_type="dict")
        processed_samples = augment(
            samples=torch.from_numpy(samples), sample_rate=sample_rate
        ).samples.numpy()
        assert processed_samples.shape == samples.shape
        assert processed_samples.dtype == np.float32
