Commit fedba9e5 authored by Thomas Vincent's avatar Thomas Vincent

adapt qspace widget to multiple energies

parent f0a6736d
...@@ -61,7 +61,7 @@ class ConversionParamsWidget(Qt.QWidget): ...@@ -61,7 +61,7 @@ class ConversionParamsWidget(Qt.QWidget):
def __init__(self, def __init__(self,
medfiltDims=None, medfiltDims=None,
normalizers=None, normalizers=None,
beamEnergy=None, beamEnergies=None,
directBeam=None, directBeam=None,
channelsPerDegree=None, channelsPerDegree=None,
**kwargs): **kwargs):
...@@ -82,7 +82,8 @@ class ConversionParamsWidget(Qt.QWidget): ...@@ -82,7 +82,8 @@ class ConversionParamsWidget(Qt.QWidget):
self.__acqParamWid = AcqParamsWidget() self.__acqParamWid = AcqParamsWidget()
# Set default values with provided info # Set default values with provided info
self.__acqParamWid.beam_energy = beamEnergy self.__acqParamWid.setBeamEnergyFromList(beamEnergies)
self.__acqParamWid.setBeamEnergyEnabled(len(set(beamEnergies)) == 1)
self.__acqParamWid.direct_beam_v = directBeam[0] self.__acqParamWid.direct_beam_v = directBeam[0]
self.__acqParamWid.direct_beam_h = directBeam[1] self.__acqParamWid.direct_beam_h = directBeam[1]
self.__acqParamWid.chperdeg_v = channelsPerDegree[0] self.__acqParamWid.chperdeg_v = channelsPerDegree[0]
...@@ -369,7 +370,10 @@ class ConversionParamsWidget(Qt.QWidget): ...@@ -369,7 +370,10 @@ class ConversionParamsWidget(Qt.QWidget):
def getBeamEnergy(self): def getBeamEnergy(self):
"""Returns beam energy in eV or None if no input""" """Returns beam energy in eV or None if no input"""
return self.__acqParamWid.beam_energy if self.__acqParamWid.isBeamEnergyEnabled():
return self.__acqParamWid.beam_energy
else:
return None
def getDirectBeam(self): def getDirectBeam(self):
"""Returns direct beam calibration position None if no input """Returns direct beam calibration position None if no input
...@@ -568,18 +572,18 @@ class QSpaceWidget(Qt.QDialog): ...@@ -568,18 +572,18 @@ class QSpaceWidget(Qt.QDialog):
topLayout.addWidget(convGbx, 1, 0, alignment=Qt.Qt.AlignTop) topLayout.addWidget(convGbx, 1, 0, alignment=Qt.Qt.AlignTop)
if entries: # Get default config from first entry if entries: # Get default config from first entry
beamEnergy = xsocsH5.beam_energy(entries[0])
directBeam = xsocsH5.direct_beam(entries[0]) directBeam = xsocsH5.direct_beam(entries[0])
channelsPerDegree = xsocsH5.chan_per_deg(entries[0]) channelsPerDegree = xsocsH5.chan_per_deg(entries[0])
else: # This should not happen else: # This should not happen
beamEnergy = ''
directBeam = '', '' directBeam = '', ''
channelsPerDegree = '', '' channelsPerDegree = '', ''
beamEnergies = [xsocsH5.beam_energy(entry) for entry in entries]
self.__paramsWid = ConversionParamsWidget( self.__paramsWid = ConversionParamsWidget(
medfiltDims=self.__converter.medfilt_dims, medfiltDims=self.__converter.medfilt_dims,
normalizers=xsocsH5.normalizers(), normalizers=xsocsH5.normalizers(),
beamEnergy=beamEnergy, beamEnergies=beamEnergies,
directBeam=directBeam, directBeam=directBeam,
channelsPerDegree=channelsPerDegree) channelsPerDegree=channelsPerDegree)
self.__paramsWid.setNormalizer(normalizer) self.__paramsWid.setNormalizer(normalizer)
...@@ -647,7 +651,7 @@ class QSpaceWidget(Qt.QDialog): ...@@ -647,7 +651,7 @@ class QSpaceWidget(Qt.QDialog):
img_size=xsocsH5.image_size(entry), img_size=xsocsH5.image_size(entry),
center_chan=xsocsH5.direct_beam(entry), center_chan=xsocsH5.direct_beam(entry),
chan_per_deg=xsocsH5.chan_per_deg(entry), chan_per_deg=xsocsH5.chan_per_deg(entry),
beam_energy=xsocsH5.beam_energy(entry), beam_energy=beamEnergies,
phi=phi, phi=phi,
eta=eta, eta=eta,
nu=nu, nu=nu,
......
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