Exemplo n.º 1
0
    def test_sorted_and_unsorted(self):
        with h5py.File(test_h5_file_path, mode='r') as h5_f:
            usi_dset = USIDataset(h5_f['/Raw_Measurement/source_main'])
            nd_slow_to_fast, nd_fast_to_slow = self.get_expected_n_dim(h5_f)
            actual_f2s = usi_dset.get_n_dim_form(lazy=False)
            self.assertTrue(np.allclose(nd_fast_to_slow, actual_f2s))

            nd_form, success = reshape_to_n_dims(usi_dset, sort_dims=True)
            print(nd_form.shape)

            usi_dset.toggle_sorting()
            actual_s2f = usi_dset.get_n_dim_form(lazy=False)
            self.assertTrue(np.allclose(nd_slow_to_fast, actual_s2f))
Exemplo n.º 2
0
 def test_unsorted(self):
     with h5py.File(test_h5_file_path, mode='r') as h5_f:
         h5_main = h5_f['/Raw_Measurement/source_main']
         expected = np.reshape(h5_main, (3, 5, 7, 2))
         expected = np.transpose(expected, (1, 0, 2, 3))
         usi_dset = USIDataset(h5_main)
         self.assertTrue(np.allclose(expected, usi_dset.get_n_dim_form(lazy=False)))
Exemplo n.º 3
0
 def test_get_n_dim_form_sorted(self):
     with h5py.File(test_h5_file_path, mode='r') as h5_f:
         h5_main = h5_f['/Raw_Measurement/source_main']
         expected = np.reshape(h5_main, (3, 5, 7, 2))
         expected = np.transpose(expected, (1, 0, 3, 2))
         pycro_dset = USIDataset(h5_main)
         pycro_dset.toggle_sorting()
         self.assertTrue(np.allclose(expected, pycro_dset.get_n_dim_form()))