def test_solve_eig_bad_ind(self): # Set all the information in one pixel to nil. self.noise_inv[17,3,1,...] = 0 self.noise_inv[...,17,3,1] = 0 self.dirty_map = al.partial_dot(self.noise_inv, self.clean_map) self.eig() new_clean_map, noise_diag = clean_map.solve_from_eig( self.noise_evalsinv, self.noise_evects, self.dirty_map, True, feedback=0) self.clean_map[17,3,1] = 0 self.assertTrue(sp.allclose(new_clean_map, self.clean_map))
def test_solve_eig(self): # Eigen decomposition of the noise inverse. self.eig() # now to actually test. noise_evects_copy = self.noise_evects.copy() new_clean_map, noise_diag = clean_map.solve_from_eig( self.noise_evalsinv, self.noise_evects, self.dirty_map, True, feedback=0) self.assertTrue(sp.allclose(new_clean_map, self.clean_map)) self.assertTrue(sp.allclose(self.noise_evects, noise_evects_copy)) expected_noise_diag = linalg.inv(sp.reshape(self.noise_inv, (self.size, self.size))) expected_noise_diag = expected_noise_diag.flat[::self.size + 1] self.assertTrue(sp.allclose(expected_noise_diag, noise_diag.flat))
def test_solve_eig_bad_ind(self): # Set all the information in one pixel to nil. self.noise_inv[17, 3, 1, ...] = 0 self.noise_inv[..., 17, 3, 1] = 0 self.dirty_map = al.partial_dot(self.noise_inv, self.clean_map) self.eig() new_clean_map, noise_diag = clean_map.solve_from_eig( self.noise_evalsinv, self.noise_evects, self.dirty_map, True, feedback=0) self.clean_map[17, 3, 1] = 0 self.assertTrue(sp.allclose(new_clean_map, self.clean_map))
def test_solve_eig(self): # Eigen decomposition of the noise inverse. self.eig() # now to actually test. noise_evects_copy = self.noise_evects.copy() new_clean_map, noise_diag = clean_map.solve_from_eig( self.noise_evalsinv, self.noise_evects, self.dirty_map, True, feedback=0) self.assertTrue(sp.allclose(new_clean_map, self.clean_map)) self.assertTrue(sp.allclose(self.noise_evects, noise_evects_copy)) expected_noise_diag = linalg.inv( sp.reshape(self.noise_inv, (self.size, self.size))) expected_noise_diag = expected_noise_diag.flat[::self.size + 1] self.assertTrue(sp.allclose(expected_noise_diag, noise_diag.flat))