Beispiel #1
0
 def test_set_ranges(self):
     fr = FitResult("")
     ran = np.ones((100, 25, 3))
     shape = (100, 25, 3)
     fr.set_ranges(ran, shape)
     self.assertTrue(np.array_equal(ran, fr.fit_ranges))
     self.assertTrue(np.array_equal(shape, fr.fit_ranges_shape))
Beispiel #2
0
 def test_save(self):
     fr = FitResult("")
     ran = np.ones((100, 25, 3))
     shape = (100, 25, 3)
     fr.set_ranges(ran, shape)
     fr.create_empty((10, 25, 4), (10, 4), [2, 3])
     fname = "./test_data/tmp_fitresult.npz"
     fr.save(fname)
     fexists = os.path.isfile(fname)
     self.assertTrue(fexists)
     if fexists:
         f = np.load(fname)
         L = f.files
         self.assertEqual(len(L), 6 * 4 + 2)
         tmp = f['pi00']
         self.assertTrue(np.array_equal(np.zeros((10, 25, 4)), tmp))
         f.close()