def noise_data(self, data): data = data.copy() data = derampMatrix(trimMatrix(data)) data = trimMatrix(data) data[num.isnan(data)] = 0. self._noise_data = data self._clear()
def test_trim_matrix(): arr = num.full((100, 100), num.nan) arr[-1, -1] = 1.0 assert util.trimMatrix(arr).shape == (1, 1) arr[-2, -2] = 1.0 assert util.trimMatrix(arr).shape == (2, 2) arr[num.diag_indices_from(arr)] = 1.0 assert util.trimMatrix(arr).shape == arr.shape
def _get_noise_data_grid(self): if self._noise_data_grid is None: scene = self.scene llE, llN = scene.frame.mapENMatrix(*self.noise_coord[:2]) sE, sN = scene.frame.mapENMatrix(*self.noise_coord[2:]) slice_E = slice(llE, llE + sE + 1) slice_N = slice(llN, llN + sN + 1) gridE = scene.frame.gridEmeter[slice_N, slice_E] gridN = scene.frame.gridNmeter[slice_N, slice_E] gridE = trimMatrix(self.noise_data, data=gridE) gridN = trimMatrix(self.noise_data, data=gridN) self._noise_data_grid = (gridE, gridN) return self._noise_data_grid