Source code for wizard.CalibrationHDRCommonPhaseOffset
from PySide import QtGui, QtCore
from calibration.HDRcommonphaseoffset import hdrCommonPhaseOffset
from functools import partial
from CalibrationCommonPhase import CalibrationCommonPhasePage
[docs]class CalibrationHDRCommonPhasePage(CalibrationCommonPhasePage):
"""CalibrationHDRCommonPhasePage: This page is similar to CalibrationCommonPhasePage. HDR coefficients are required when HDR is enabled. """
#TODO: Create a live capture method
def __init__(self, calibrationWizard):
super (CalibrationHDRCommonPhasePage, self).__init__(calibrationWizard)
self.calibrated = False
self.setTitle('HDR Common Phase Calibration')
self.setSubTitle('Please provide the two files, distances and modulation frequencies.')
self.fileName = None
self.fileName2 = None
# If file2 and modulation frequency 2 are not selected, ')
[docs] def initializePage(self):
self.calibLayout = 'self.' + self.calibrationWizard.calibs['hdrCommonPhase'] + '()'
eval(self.calibLayout)
self.calibrateButton = QtGui.QPushButton('Calibrate')
self.calibrateButton.setDisabled(True)
hlayout = QtGui.QHBoxLayout()
hlayout.addStretch()
hlayout.addWidget(self.calibrateButton)
hlayout.addStretch()
self.layout.addLayout(hlayout)
self.calibrateButton.clicked.connect(self.calibrate)
# #
[docs] def calibrate(self):
ret = hdrCommonPhaseOffset(self.fileName, self.distance1, self.modFreq1,0, 0, self.fileName2, self.modFreq2)
if not ret:
self.valueLabel = QtGui.QLabel()
self.valueLabel.setText('Cannot calibrate with the given file(s). Choose a different file')
self.line.clear()
self.line2.clear()
self.layout.addWidget(self.valueLabel)
self.calibrateButton.setEnabled(False)
if ret:
ret1, self.hdrphaseCorr1, self.hdrphaseCorr2 = ret
self.valueLabel = QtGui.QLabel()
text = "hdr_phase_corr1 = %d\n"%(self.hdrphaseCorr1)
if self.phaseCorr2:
text += "hdr_phase_corr_2 = %d"%(self.hdrphaseCorr2)
self.calibrationWizard.calibParams['hdr_phase_corr_2'] = self.hdrphaseCorr2
self.valueLabel.setText(text)
self.layout.addWidget(self.valueLabel)
self.calibrationWizard.calibParams['hdr_phase_corr_1'] = self.hdrphaseCorr1
self.calibrated = True