def test_spoiled_gre(self): im = spoiled_gre(self.T1s, self.T2s, TR=.3, TE=.003, alpha=None, M0=self.PD) # All nonzero pixels should be the same magnitude self.assertTrue(np.all(np.diff(im[np.nonzero(im)]) == 0))
def test_gre_sim_using_tol_against_closed_form_sol(self): '''Verify iterative solution against closed form solution. Used tolerance instead of fixed number of iterations. ''' im1 = spoiled_gre(self.T1s, self.T2s, TR=self.TR, TE=self.TE, alpha=self.alpha, M0=self.PD) im2 = gre_sim(self.T1s, self.T2s, TR=self.TR, TE=self.TE, alpha=self.alpha, field_map=None, M0=self.PD, tol=1) # same within a scale factor... val = np.abs(im1) - np.abs(im2) self.assertTrue(np.all(np.diff(val[np.nonzero(val)]) == 0))
def test_gre_sim_using_tol_against_closed_form_sol(self): im1 = spoiled_gre(self.T1s, self.T2s, TR=self.TR, TE=self.TE, alpha=self.alpha, M0=self.PD) im2 = gre_sim(self.T1s, self.T2s, TR=self.TR, TE=self.TE, alpha=self.alpha, field_map=None, M0=self.PD, tol=1) # same within a scale factor... val = np.abs(im1) - np.abs(im2) self.assertTrue(np.all(np.diff(val[np.nonzero(val)]) == 0))