def test_3d_data_compute(self): dask_array = da.random.random((4, 10, 15), chunks=(1, 10, 15)) s = LazyElectronDiffraction1D(dask_array) s.compute() assert s.__class__ == ElectronDiffraction1D assert dask_array.shape == s.data.shape
def test_2d_data_compute(self): dask_array = da.random.random((100, 150), chunks=(50, 50)) s = LazyElectronDiffraction1D(dask_array) scale0, scale1, metadata_string = 0.5, 1.5, "test" s.axes_manager[0].scale = scale0 s.axes_manager[1].scale = scale1 s.metadata.Test = metadata_string s.compute() assert isinstance(s, ElectronDiffraction1D) assert not hasattr(s.data, "compute") assert s.axes_manager[0].scale == scale0 assert s.axes_manager[1].scale == scale1 assert s.metadata.Test == metadata_string assert dask_array.shape == s.data.shape