Commit c87d1787 authored by Thomas Vincent's avatar Thomas Vincent

simplify _get_all_params

parent e5ece31b
......@@ -1527,49 +1527,19 @@ def _get_all_params(data_h5f):
Each of those fields are N elements arrays, where N is the number of
scans found in the file.
"""
n_images = []
n_positions = []
img_sizes = []
beam_energies = []
center_chans = []
chan_per_degs = []
angles = []
image_roi_offsets = []
result = {}
with XsocsH5.XsocsH5(data_h5f, mode='r') as master_h5:
entries = master_h5.entries()
for entry_idx, entry in enumerate(entries):
n_image = master_h5.n_images(entry=entry)
img_size = master_h5.image_size(entry=entry)
for entry in master_h5.entries():
imgnr = master_h5.measurement(entry, 'imgnr')
n_position = len(imgnr) if imgnr is not None else None
beam_energy = master_h5.beam_energy(entry=entry)
chan_per_deg = master_h5.chan_per_deg(entry=entry)
center_chan = master_h5.direct_beam(entry=entry)
image_roi_offset = master_h5.image_roi_offset(entry=entry)
angle = master_h5.positioner(entry, 'eta')
n_images.append(n_image)
n_positions.append(n_position)
img_sizes.append(img_size)
beam_energies.append(beam_energy)
chan_per_degs.append(chan_per_deg)
center_chans.append(center_chan)
image_roi_offsets.append(image_roi_offset)
angles.append(angle)
result = dict([(scan, dict(scans=entries[idx],
n_images=n_images[idx],
n_positions=n_positions[idx],
img_size=img_sizes[idx],
beam_energy=beam_energies[idx],
chan_per_deg=chan_per_degs[idx],
center_chan=center_chans[idx],
image_roi_offset=image_roi_offsets[idx],
angle=angles[idx]))
for idx, scan in enumerate(entries)])
result[entry] = dict(
scans=entry,
n_images=master_h5.n_images(entry=entry),
n_positions=len(imgnr) if imgnr is not None else None,
img_size=master_h5.image_size(entry=entry),
beam_energy=master_h5.beam_energy(entry=entry),
chan_per_deg=master_h5.chan_per_deg(entry=entry),
center_chan=master_h5.direct_beam(entry=entry),
image_roi_offset=master_h5.image_roi_offset(entry=entry),
angle=master_h5.positioner(entry, 'eta'))
return result
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment