From 26b2ecd812d4bc00335edba38d32e81a5df468e7 Mon Sep 17 00:00:00 2001 From: Abe Levitan Date: Fri, 25 Feb 2022 12:16:41 -0500 Subject: [PATCH] add compression to data saving tools --- CDTools/tools/data/data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CDTools/tools/data/data.py b/CDTools/tools/data/data.py index 5fdd982..18b4c2f 100644 --- a/CDTools/tools/data/data.py +++ b/CDTools/tools/data/data.py @@ -643,7 +643,8 @@ def add_dark(cxi_file, dark): d1.create_dataset('data_dark',data=dark) -def add_data(cxi_file, data, axes=None): +def add_data(cxi_file, data, axes=None, compression='lzp', + chunks=True): """Adds the specified data to the cxi file It will add the data unchanged to the file, placing it in two spots: @@ -674,7 +675,8 @@ def add_data(cxi_file, data, axes=None): if isinstance(data, t.Tensor): data = data.detach().cpu().numpy() - det1.create_dataset('data', data=data) + det1.create_dataset('data', data=data, compression=compression, + chunks=chunks) data1['data'] = h5py.SoftLink('/entry_1/instrument_1/detector_1/data') if axes is not None: