Example #1
0
    def __init__(self, parent=None, data=None):
        super(DialogKKOptions, self).__init__(parent) ### EDIT ###
        self.ui = Ui_KKOptions() ### EDIT ###
        self.ui.setupUi(self)     ### EDIT ###

        self.ui.doubleSpinBoxCARSAmp.setValue(self.CARS_AMP)
        self.ui.doubleSpinBoxNRBAmp.setValue(self.NRB_AMP)
        self.ui.doubleSpinBoxPhase.setValue(self.PHASE_OFFSET)
        self.ui.checkBoxNormToNRB.setChecked(self.NORM_TO_NRB)
        self.ui.spinBoxPadFactor.setValue(self.PAD_FACTOR)

        self.norm_to_nrb = self.NORM_TO_NRB

        self.data = data

        if data is None:
            self.ui.pushButtonInteractive.setEnabled(False)
        else:
            self.ui.pushButtonInteractive.pressed.connect(self.goInteractive)
Example #2
0
    def __init__(self, parent=None, data=None):
        super(DialogKKOptions, self).__init__(parent) ### EDIT ###
        self.ui = Ui_KKOptions() ### EDIT ###
        self.ui.setupUi(self)     ### EDIT ###

        self.ui.doubleSpinBoxCARSAmp.setValue(self.CARS_AMP)
        self.ui.doubleSpinBoxNRBAmp.setValue(self.NRB_AMP)
        self.ui.doubleSpinBoxPhase.setValue(self.PHASE_OFFSET)
        self.ui.checkBoxNormToNRB.setChecked(self.NORM_TO_NRB)
        self.ui.spinBoxPadFactor.setValue(self.PAD_FACTOR)

        self.norm_to_nrb = self.NORM_TO_NRB

        self.data = data

        if data is None:
            self.ui.pushButtonInteractive.setEnabled(False)
        else:
            self.ui.pushButtonInteractive.pressed.connect(self.goInteractive)
Example #3
0
class DialogKKOptions(_QDialog):
    """
    DialogKKOptions : Phase-Retrieval (only Kramers-Kronig currently \
        supported) options dialog

    Static Method
    -------------
    dialogKKOptions : Used to call UI and retrieve results of dialog

    References
    ----------
    [1] Y. Liu, Y. J. Lee, and M. T. Cicerone, "Broadband CARS spectral \
    phase retrieval using a time-domain Kramers-Kronig transform," \
    Opt. Lett. 34, 1363-1365 (2009).

    [2] C H Camp Jr, Y J Lee, and M T Cicerone, "Quantitative, Comparable Coherent \
    Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase \
    Retrieval," Journal of Raman Spectroscopy (2016). arXiv:1507.06543.

    Software Info
    --------------

    Original Python branch: Feb 16 2015

    author: ("Charles H Camp Jr")

    email: ("*****@*****.**")

    version: ("16.2.16")
    """
    NORM_TO_NRB = True
    NRB_AMP = 0.0
    CARS_AMP = 0.0
    PHASE_OFFSET = 0.0
    PAD_FACTOR = 1

    def __init__(self, parent=None, data=None):
        super(DialogKKOptions, self).__init__(parent) ### EDIT ###
        self.ui = Ui_KKOptions() ### EDIT ###
        self.ui.setupUi(self)     ### EDIT ###

        self.ui.doubleSpinBoxCARSAmp.setValue(self.CARS_AMP)
        self.ui.doubleSpinBoxNRBAmp.setValue(self.NRB_AMP)
        self.ui.doubleSpinBoxPhase.setValue(self.PHASE_OFFSET)
        self.ui.checkBoxNormToNRB.setChecked(self.NORM_TO_NRB)
        self.ui.spinBoxPadFactor.setValue(self.PAD_FACTOR)

        self.norm_to_nrb = self.NORM_TO_NRB

        self.data = data

        if data is None:
            self.ui.pushButtonInteractive.setEnabled(False)
        else:
            self.ui.pushButtonInteractive.pressed.connect(self.goInteractive)

    def goInteractive(self):

        plugin = _widgetKK()

        winPlotEffect = _DialogPlotEffect.dialogPlotEffect(self.data[1:], 
                                                           x=self.data[0], 
                                                           plugin=plugin,
                                                           parent=self)

        if winPlotEffect is not None:
            self.ui.doubleSpinBoxCARSAmp.setValue(winPlotEffect.parameters['cars_amp_offset'])
            self.ui.doubleSpinBoxNRBAmp.setValue(winPlotEffect.parameters['nrb_amp_offset'])
            self.ui.checkBoxNormToNRB.setChecked(winPlotEffect.parameters['norm_to_nrb'])
            self.ui.doubleSpinBoxPhase.setValue(winPlotEffect.parameters['phase_offset'])
            self.ui.spinBoxPadFactor.setValue(winPlotEffect.parameters['pad_factor'])

    @staticmethod
    def dialogKKOptions(parent=None, data=None):
        """
        Static Method.

        Retrieve dark subtraction dialog results

        Inputs
        ----------
        None : None

        Returns
        ----------
        out : dict{'cars_amp' : float, 'nrb_amp' : float,
                   'phase_offset' : float, 'norm_to_nrb' : bool,
                   'pad_factor' : int}
            In order: CARS amp offset, NRB amp offset, phase offset, normalize
                by NRB, pad factor
        """
        dialog = DialogKKOptions(parent=parent,data=data)

        result = dialog.exec_()

        if result == 1:
            ret = {}
            ret['cars_amp'] = dialog.ui.doubleSpinBoxCARSAmp.value()
            ret['nrb_amp'] = dialog.ui.doubleSpinBoxNRBAmp.value()
            ret['phase_offset'] = dialog.ui.doubleSpinBoxPhase.value()
            ret['norm_to_nrb'] = dialog.ui.checkBoxNormToNRB.isChecked()
            ret['pad_factor'] = dialog.ui.spinBoxPadFactor.value()
            return ret
        else:
            return None
Example #4
0
class DialogKKOptions(_QDialog):
    """
    DialogKKOptions : Phase-Retrieval (only Kramers-Kronig currently \
        supported) options dialog

    Methods
    --------
    dialogKKOptions : Used to call UI and retrieve results of dialog

    References
    ----------
    [1] Y. Liu, Y. J. Lee, and M. T. Cicerone, "Broadband CARS spectral \
        phase retrieval using a time-domain Kramers-Kronig transform," \
        Opt. Lett. 34, 1363-1365 (2009).

    [2] C H Camp Jr, Y J Lee, and M T Cicerone, "Quantitative, Comparable Coherent \
        Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase \
        Retrieval," Journal of Raman Spectroscopy (2016). arXiv:1507.06543.

    """
    NORM_TO_NRB = True
    NRB_AMP = 0.0
    CARS_AMP = 0.0
    PHASE_OFFSET = 0.0
    PAD_FACTOR = 1

    def __init__(self, parent=None, data=None):
        super(DialogKKOptions, self).__init__(parent) ### EDIT ###
        self.ui = Ui_KKOptions() ### EDIT ###
        self.ui.setupUi(self)     ### EDIT ###

        self.ui.doubleSpinBoxCARSAmp.setValue(self.CARS_AMP)
        self.ui.doubleSpinBoxNRBAmp.setValue(self.NRB_AMP)
        self.ui.doubleSpinBoxPhase.setValue(self.PHASE_OFFSET)
        self.ui.checkBoxNormToNRB.setChecked(self.NORM_TO_NRB)
        self.ui.spinBoxPadFactor.setValue(self.PAD_FACTOR)

        self.ui.checkBoxNormToNRB.stateChanged.connect(self.checkBoxNormToNRB)

        self.norm_to_nrb = self.NORM_TO_NRB

        self.data = data

        if data is None:
            self.ui.pushButtonInteractive.setEnabled(False)
        else:
            self.ui.pushButtonInteractive.pressed.connect(self.goInteractive)

    def checkBoxNormToNRB(self):
        if self.ui.checkBoxNormToNRB.isChecked() == True:
            self.norm_to_nrb = True
        else:
            self.norm_to_nrb = False

    def goInteractive(self):

        plugin = _widgetKK()

        winPlotEffect = _DialogPlotEffect.dialogPlotEffect(self.data, x=self.data[0], plugin=plugin, xlabel='Wavenumber (cm$^{-1}$)', ylabel='Imag. {$\chi_R$} (au)')

        if winPlotEffect is not None:
            self.ui.doubleSpinBoxCARSAmp.setValue(winPlotEffect.cars_bias)
            self.ui.doubleSpinBoxNRBAmp.setValue(winPlotEffect.nrb_bias)
            self.ui.checkBoxNormToNRB.setChecked(winPlotEffect.nrb_norm)
            self.ui.doubleSpinBoxPhase.setValue(winPlotEffect.phaselin)
            self.ui.spinBoxPadFactor.setValue(winPlotEffect.pad_factor)

    @staticmethod
    def dialogKKOptions(parent=None, data=None):
        """
        Retrieve dark subtraction dialog results

        Parameters
        ----------
        None : None

        Returns
        ----------
        out : (tuple)
            HSData amp offset : (float)
            NRB amp offset : (float)
            Phase offset : (float)
            Normalize by NRB : (bool)
            Pad factor : (int)
        """
        dialog = DialogKKOptions(parent=parent,data=data)

        result = dialog.exec_()

        if result == 1:

            return (dialog.ui.doubleSpinBoxCARSAmp.value(),
                    dialog.ui.doubleSpinBoxNRBAmp.value(),
                    dialog.ui.doubleSpinBoxPhase.value(),
                    dialog.norm_to_nrb,
                    dialog.ui.spinBoxPadFactor.value())
        else:
            return (None, None, None, None, None)
Example #5
0
class DialogKKOptions(_QDialog):
    """
    DialogKKOptions : Phase-Retrieval (only Kramers-Kronig currently \
        supported) options dialog

    Static Method
    -------------
    dialogKKOptions : Used to call UI and retrieve results of dialog

    References
    ----------
    [1] Y. Liu, Y. J. Lee, and M. T. Cicerone, "Broadband CARS spectral \
    phase retrieval using a time-domain Kramers-Kronig transform," \
    Opt. Lett. 34, 1363-1365 (2009).

    [2] C H Camp Jr, Y J Lee, and M T Cicerone, "Quantitative, Comparable Coherent \
    Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase \
    Retrieval," Journal of Raman Spectroscopy (2016). arXiv:1507.06543.

    Software Info
    --------------

    Original Python branch: Feb 16 2015

    author: ("Charles H Camp Jr")

    email: ("*****@*****.**")

    version: ("16.2.16")
    """
    NORM_TO_NRB = True
    NRB_AMP = 0.0
    CARS_AMP = 0.0
    PHASE_OFFSET = 0.0
    PAD_FACTOR = 1

    def __init__(self, parent=None, data=None):
        super(DialogKKOptions, self).__init__(parent)  ### EDIT ###
        self.ui = Ui_KKOptions()  ### EDIT ###
        self.ui.setupUi(self)  ### EDIT ###

        self.ui.doubleSpinBoxCARSAmp.setValue(self.CARS_AMP)
        self.ui.doubleSpinBoxNRBAmp.setValue(self.NRB_AMP)
        self.ui.doubleSpinBoxPhase.setValue(self.PHASE_OFFSET)
        self.ui.checkBoxNormToNRB.setChecked(self.NORM_TO_NRB)
        self.ui.spinBoxPadFactor.setValue(self.PAD_FACTOR)

        self.ui.checkBoxNormToNRB.stateChanged.connect(self.checkBoxNormToNRB)

        self.norm_to_nrb = self.NORM_TO_NRB

        self.data = data

        if data is None:
            self.ui.pushButtonInteractive.setEnabled(False)
        else:
            self.ui.pushButtonInteractive.pressed.connect(self.goInteractive)

    def checkBoxNormToNRB(self):
        if self.ui.checkBoxNormToNRB.isChecked() == True:
            self.norm_to_nrb = True
        else:
            self.norm_to_nrb = False

    def goInteractive(self):

        plugin = _widgetKK()

        winPlotEffect = _DialogPlotEffect.dialogPlotEffect(
            self.data,
            x=self.data[0],
            plugin=plugin,
            xlabel='Wavenumber (cm$^{-1}$)',
            ylabel='Imag. {$\chi_R$} (au)')

        if winPlotEffect is not None:
            self.ui.doubleSpinBoxCARSAmp.setValue(winPlotEffect.cars_bias)
            self.ui.doubleSpinBoxNRBAmp.setValue(winPlotEffect.nrb_bias)
            self.ui.checkBoxNormToNRB.setChecked(winPlotEffect.nrb_norm)
            self.ui.doubleSpinBoxPhase.setValue(winPlotEffect.phaselin)
            self.ui.spinBoxPadFactor.setValue(winPlotEffect.pad_factor)

    @staticmethod
    def dialogKKOptions(parent=None, data=None):
        """
        Static Method.

        Retrieve dark subtraction dialog results

        Inputs
        ----------
        None : None

        Returns
        ----------
        out : (tuple)
            HSData amp offset : (float)
            NRB amp offset : (float)
            Phase offset : (float)
            Normalize by NRB : (bool)
            Pad factor : (int)
        """
        dialog = DialogKKOptions(parent=parent, data=data)

        result = dialog.exec_()

        if result == 1:

            return (dialog.ui.doubleSpinBoxCARSAmp.value(),
                    dialog.ui.doubleSpinBoxNRBAmp.value(),
                    dialog.ui.doubleSpinBoxPhase.value(), dialog.norm_to_nrb,
                    dialog.ui.spinBoxPadFactor.value())
        else:
            return (None, None, None, None, None)
Example #6
0
class DialogKKOptions(_QDialog):
    """
    DialogKKOptions : Phase-Retrieval (only Kramers-Kronig currently \
        supported) options dialog

    Methods
    --------
    dialogKKOptions : Used to call UI and retrieve results of dialog

    References
    ----------
    [1] Y. Liu, Y. J. Lee, and M. T. Cicerone, "Broadband CARS spectral \
        phase retrieval using a time-domain Kramers-Kronig transform," \
        Opt. Lett. 34, 1363-1365 (2009).

    [2] C H Camp Jr, Y J Lee, and M T Cicerone, "Quantitative, Comparable Coherent \
        Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase \
        Retrieval," Journal of Raman Spectroscopy (2016). arXiv:1507.06543.

    """
    NORM_TO_NRB = True
    NRB_AMP = 0.0
    CARS_AMP = 0.0
    PHASE_OFFSET = 0.0
    PAD_FACTOR = 1

    def __init__(self, parent=None, data=None):
        super(DialogKKOptions, self).__init__(parent) ### EDIT ###
        self.ui = Ui_KKOptions() ### EDIT ###
        self.ui.setupUi(self)     ### EDIT ###

        self.ui.doubleSpinBoxCARSAmp.setValue(self.CARS_AMP)
        self.ui.doubleSpinBoxNRBAmp.setValue(self.NRB_AMP)
        self.ui.doubleSpinBoxPhase.setValue(self.PHASE_OFFSET)
        self.ui.checkBoxNormToNRB.setChecked(self.NORM_TO_NRB)
        self.ui.spinBoxPadFactor.setValue(self.PAD_FACTOR)

        self.norm_to_nrb = self.NORM_TO_NRB

        self.data = data

        if data is None:
            self.ui.pushButtonInteractive.setEnabled(False)
        else:
            self.ui.pushButtonInteractive.pressed.connect(self.goInteractive)

    def goInteractive(self):

        plugin = _widgetKK()

        winPlotEffect = _DialogPlotEffect.dialogPlotEffect(self.data[1:], 
                                                           x=self.data[0], 
                                                           plugin=plugin,
                                                           parent=self)

        if winPlotEffect is not None:
            self.ui.doubleSpinBoxCARSAmp.setValue(winPlotEffect.parameters['cars_amp_offset'])
            self.ui.doubleSpinBoxNRBAmp.setValue(winPlotEffect.parameters['nrb_amp_offset'])
            self.ui.checkBoxNormToNRB.setChecked(winPlotEffect.parameters['norm_to_nrb'])
            self.ui.doubleSpinBoxPhase.setValue(winPlotEffect.parameters['phase_offset'])
            self.ui.spinBoxPadFactor.setValue(winPlotEffect.parameters['pad_factor'])

    @staticmethod
    def dialogKKOptions(parent=None, data=None):
        """
        Retrieve dark subtraction dialog results

        Parameters
        ----------
        None : None

        Returns
        ----------
        out : dict{'cars_amp' : float, 'nrb_amp' : float,
                   'phase_offset' : float, 'norm_to_nrb' : bool,
                   'pad_factor' : int}
            In order: CARS amp offset, NRB amp offset, phase offset, normalize
                by NRB, pad factor
        """
        dialog = DialogKKOptions(parent=parent,data=data)

        result = dialog.exec_()

        if result == 1:
            ret = {}
            ret['cars_amp'] = dialog.ui.doubleSpinBoxCARSAmp.value()
            ret['nrb_amp'] = dialog.ui.doubleSpinBoxNRBAmp.value()
            ret['phase_offset'] = dialog.ui.doubleSpinBoxPhase.value()
            ret['norm_to_nrb'] = dialog.ui.checkBoxNormToNRB.isChecked()
            ret['pad_factor'] = dialog.ui.spinBoxPadFactor.value()
            return ret
        else:
            return None