Commit 3b24b716 authored by Edoardo Zatterin's avatar Edoardo Zatterin
Browse files

update to comply with new h5py syntax

parent ae06448c
......@@ -87,7 +87,7 @@ def get_qspace_vals(scan, cen_pix=None,
calib_addr = "instrument/detectors/%s/calibration"%detector.alias
try:
calib = scan[calib_addr]
calib = dict((k, calib[k].value) for k in calib)
calib = dict((k, calib[k][()]) for k in calib)
except:
calib = dict()
......@@ -114,7 +114,7 @@ def get_qspace_vals(scan, cen_pix=None,
if energy is None:
ene_addr = "instrument/monochromator/mononrj"
try:
energy = scan[ene_addr].value
energy = scan[ene_addr][()]
if isinstance(energy, np.ndarray):
energy = energy.item()
energy = float(energy.strip("keV")) # keV
......@@ -128,8 +128,8 @@ def get_qspace_vals(scan, cen_pix=None,
energy *= 1000. # eV
if isinstance(detector, MaxiPix) and not ignore_mpx4trans:
mpxy = motors["mpxy"].value
mpxz = motors["mpxz"].value
mpxy = motors["mpxy"][()]
mpxz = motors["mpxz"][()]
cen_pix = list(cen_pix)
cen_pix[0] += mpxz/1000. / detector.pixsize[0]
cen_pix[1] -= mpxy/1000. / detector.pixsize[1]
......@@ -173,7 +173,7 @@ def get_qspace_vals(scan, cen_pix=None,
dset = motors[angle if angle is not "delta" else "del"]
if len(dset.shape):
maxlen = max(maxlen, dset.shape[0])
position = dset.value
position = dset[()]
else:
position = 0.
angles[angle] = position - geometry.offsets[angle]
......@@ -374,7 +374,7 @@ def scan_to_qspace_h5(scan, cen_pix=None,
num_im = image_data.shape[0]
# process monitor readings
if monitor is not None:
mon = scan["measurement/%s"%monitor].value
mon = scan["measurement/%s"%monitor][()]
else:
mon = np.ones(num_im)
if not (mon>0).all():
......@@ -481,21 +481,21 @@ def kmap_get_qcoordinates(kmap_masterh5, energy=None,
for name in sorted(kmap_masterh5):
entry = kmap_masterh5[name]
if energy is None:
_energy = entry["instrument/detector/beam_energy"].value
_energy = entry["instrument/detector/beam_energy"][()]
print("found energy=%.3fkeV"%_energy, end=", ")
else:
_energy = energy
if cenpix is None:
_cenpix = (entry["instrument/detector/center_chan_dim0"].value,
entry["instrument/detector/center_chan_dim1"].value)
_cenpix = (entry["instrument/detector/center_chan_dim0"][()],
entry["instrument/detector/center_chan_dim1"][()])
print("found cen pix=(%.1f, %.1f)"%_cenpix, end=", ")
else:
_cenpix = cenpix
if ddistance is None:
pixperdeg = (entry["instrument/detector/chan_per_deg_dim0"].value,
entry["instrument/detector/chan_per_deg_dim1"].value)
pixperdeg = (entry["instrument/detector/chan_per_deg_dim0"][()],
entry["instrument/detector/chan_per_deg_dim1"][()])
_ddistance = pixperdeg[0]*detector.pixsize[0]/np.tan(np.radians(1))
print("found detector distance=%.3f"%_ddistance)
else:
......
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