def test_gaussian_noise_injection(self, data: np.ndarray, params: Dict): gaussian_noise = noise.Gaussian(params) data_prime, _ = gaussian_noise(data, None) assert not np.array_equal(data, data_prime) n_true_affected = gaussian_noise.get_proba(data.shape[0], gaussian_noise.params.pa) n_true_bands = gaussian_noise.get_proba(data.shape[1], gaussian_noise.params.pb) n_affected = 0 for i in range(data.shape[0]): for j in range(data.shape[1]): if not np.array_equal(data[i, j], data_prime[i, j]): n_affected += 1 assert n_affected == n_true_affected * n_true_bands, \ 'Assert the correct number of noise pixels and their bands.'
def test_if_no_noise_injected(self, data: np.ndarray, params: Dict): gaussian_noise = noise.Gaussian(params) data_prime, _ = gaussian_noise(data, None) assert (data == data_prime).all(), \ 'Assert no element is augmented with noise (\"pa\" == 0)'