def saveH5(self, format='emc'): """Save noised diffraction data as a HDF5 file :param format: What format to save the data in. :type format: str """ DD.write(self.output_path, self.data, format)
def test_writeUnsupported(): input_arr = np.random.rand(10, 10) data = DiffractionData(arrary=input_arr) with pytest.raises(UnknownFileTypeError) as excinfo: DD.write("filename", data, format='blabla') print(excinfo.value) assert "Unsupported format" in str(excinfo.value)
def test_write_emc_h5_multi(tmp_path): h5_file = './testFiles/singfel-multi.h5' out_path = tmp_path / "h5_multi.emc" DiffrData = DD.read(h5_file, poissonize=False) DiffrData.multiply(1e9) assert isinstance(DiffrData, DiffractionData) is True DD.write(out_path, DiffrData, 'emc')
def test_readAutoRewriteSingFEL(tmp_path): h5_file = './testFiles/singfel-multi.h5' data = DD.read(h5_file) ofn = tmp_path / 'rewrite_singfel.h5' DD.write(str(ofn), data, 'singfel') DD.read(str(ofn))