Skip to content
Snippets Groups Projects

[AGIPD] Add support to round intensity to absolute photon numbers

Merged Philipp Schmidt requested to merge feat/AGIPD-rounded-photon-count into master
+ 5
9
@@ -475,7 +475,10 @@ class AgipdCorrections:
agipd_base = f'INSTRUMENT/{self.h5_data_path}/'.format(module_idx)
idx_base = self.h5_index_path.format(module_idx)
data_path = f'{agipd_base}/image'
data_dict = self.shared_dict[i_proc]
# Obtain a shallow copy of the pointer map to allow for local
# changes in this method.
data_dict = self.shared_dict[i_proc].copy()
image_fields = [
'trainId', 'pulseId', 'cellId', 'data', 'gain', 'mask', 'blShift',
@@ -486,11 +489,8 @@ class AgipdCorrections:
return
trains = data_dict['trainId'][:n_img]
# Create new views with a different dtype for arrays to be
# recast and store the original array temporarily.
orig_image_arrays = {}
# Re-cast fields in-place, i.e. using the same memory region.
for field, dtype in self.recast_image_fields.items():
orig_image_arrays[field] = data_dict[field]
data_dict[field] = cast_array_inplace(data_dict[field], dtype)
with h5py.File(ofile_name, "w") as outfile:
@@ -536,10 +536,6 @@ class AgipdCorrections:
else:
image_grp[field][:] = data_dict[field][:n_img]
# Restore the original arrays with their proper dtype.
for field, dtype in self.recast_image_fields.items():
data_dict[field] = orig_image_arrays[field]
def _write_compressed_frames(self, dataset, arr):
"""Compress gain/mask frames in multiple threads, and save their data
Loading