Пример #1
0
    def __init__(self,
                 smoothness_param=1,
                 redux=1,
                 fix_end_points=True,
                 max_iter=100,
                 min_diff=1e-6,
                 parent=None):

        super(widgetArPLS, self).__init__(parent)  ### EDIT ###

        self.ui = _Ui_Form()
        self.ui.setupUi(self)  ##

        # Update parameter dict
        self.parameters['smoothness_param'] = smoothness_param
        self.parameters['redux'] = redux
        self.parameters['fix_end_points'] = fix_end_points
        self.parameters['max_iter'] = max_iter
        self.parameters['min_diff'] = min_diff

        # Lambda/smoothness parameter rlated
        self.ui.label_2.setText('{} (Smoothness)'.format(u'\u03BB'))
        self.ui.spinBoxLambda = _SciSpin()
        self.ui.verticalLayout_2.insertWidget(1, self.ui.spinBoxLambda)
        self.ui.spinBoxLambda.setValue(self.parameters['smoothness_param'])

        # Redux factor
        self.ui.spinBoxRedux.setValue(self.parameters['redux'])

        # Fixed ends
        self.ui.checkBox.setChecked(self.parameters['fix_end_points'])

        # Max iterations
        self.ui.spinBoxMaxIter.setValue(self.parameters['max_iter'])

        # Min Difference
        self.ui.spinBoxMinDiff = _SciSpin()
        self.ui.verticalLayout_9.insertWidget(4, self.ui.spinBoxMinDiff)
        self.ui.spinBoxMinDiff.setValue(self.parameters['min_diff'])

        # SIGNALS & SLOTS
        self.ui.spinBoxLambda.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxRedux.editingFinished.connect(self.spinBoxChanged)

        self.ui.spinBoxMaxIter.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMinDiff.editingFinished.connect(self.spinBoxChanged)

        self.ui.checkBox.clicked.connect(self.selectFixedEnds)
Пример #2
0
    def asym_sub_val_change(self):
        """ P Subsections spinbox has changed value """
        sbval = self.ui.spinBoxAsymSubSections.value()
        n_rows = self.ui.tableWidgetAsym.rowCount()
        n_cols = self.ui.tableWidgetAsym.columnCount()

        max_x = _np.max(self.x)
        min_x = _np.min(self.x)

        if sbval > n_rows:
            for nr in _np.arange(n_rows, sbval):
                self.ui.tableWidgetAsym.setRowCount(sbval)
                n_rows = self.ui.tableWidgetAsym.rowCount()

                # Start X
                scispin = _SciSpin()
                scispin.setMinimum(self._x.min())
                scispin.setMaximum(self._x.max())
                scispin.setValue(min_x)
                scispin.editingFinished.connect(self.asymspinboxchanged)
                self.ui.tableWidgetAsym.setCellWidget(nr, 0, scispin)

                # Stop X
                scispin = _SciSpin()
                scispin.setMinimum(self._x.min())
                scispin.setMaximum(self._x.max())
                scispin.setValue(max_x)
                scispin.editingFinished.connect(self.asymspinboxchanged)
                self.ui.tableWidgetAsym.setCellWidget(nr, 1, scispin)

                # Asym Parameter
                scispin = _SciSpin()
                scispin.setMinimum(0)
                scispin.setMaximum(1e20)
                scispin.setValue(self.ui.spinBoxP.value())
                scispin.editingFinished.connect(self.asymspinboxchanged)
                self.ui.tableWidgetAsym.setCellWidget(nr, 2, scispin)
        elif sbval < n_rows:
            for nr in _np.arange(sbval, n_rows):
                for nc in range(n_cols):
                    sw = self.ui.tableWidgetAsym.cellWidget(nr, nc)
                    sw.editingFinished.disconnect()

            self.ui.tableWidgetAsym.setRowCount(sbval)
            n_rows = self.ui.tableWidgetAsym.rowCount()

        self.asymspinboxchanged()
Пример #3
0
    def setup_asym(self):
        """
        P/asymmetry parameter related
        """

        self.ui.spinBoxP = _SciSpin()
        self.ui.verticalLayout.insertWidget(1, self.ui.spinBoxP)
        self.ui.spinBoxP.setValue(self.parameters['asym_param'])
Пример #4
0
    def __init__(self,
                 asym_param=1e-3,
                 smoothness_param=1,
                 redux=10,
                 pstart=1e-2,
                 pend=1e-3,
                 fixed_p=True,
                 fix_end_points=True,
                 max_iter=100,
                 min_diff=1e-6,
                 parent=None):

        super(widgetALS, self).__init__(parent)  ### EDIT ###

        self.ui = _Ui_Form()
        self.ui.setupUi(self)

        # Update parameter dict
        self.parameters['smoothness_param'] = smoothness_param
        self.parameters['asym_param'] = asym_param
        self.parameters['fixed_p'] = fixed_p
        self.parameters['asym_param_start'] = pstart
        self.parameters['asym_param_end'] = pend
        self.parameters['redux'] = redux
        self.parameters['fix_end_points'] = fix_end_points
        self.parameters['max_iter'] = max_iter
        self.parameters['min_diff'] = min_diff

        self.setup_asym()  # Setup controls for asymmetry parameter
        self.setup_smoothness()  # Setup controls for smoothness parameter

        # Redux factor
        self.ui.spinBoxRedux.setValue(self.parameters['redux'])

        # Fixed ends
        self.ui.checkBox.setChecked(self.parameters['fix_end_points'])

        # Max iterations
        self.ui.spinBoxMaxIter.setValue(self.parameters['max_iter'])

        # Min Difference
        self.ui.spinBoxMinDiff = _SciSpin()
        self.ui.verticalLayout_9.insertWidget(4, self.ui.spinBoxMinDiff)
        self.ui.spinBoxMinDiff.setValue(self.parameters['min_diff'])

        # SIGNALS & SLOTS
        self.ui.spinBoxP.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxLambda.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxRedux.editingFinished.connect(self.spinBoxChanged)

        self.ui.spinBoxPStart.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxPEnd.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMaxIter.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMinDiff.editingFinished.connect(self.spinBoxChanged)

        self.ui.radioButtonFixedP.clicked.connect(self.selectFixedOrLog)
        self.ui.radioButtonLogLinearP.clicked.connect(self.selectFixedOrLog)
        self.ui.checkBox.clicked.connect(self.selectFixedEnds)
Пример #5
0
 def setup_smoothness(self):
     """ 
     Lambda/smoothness parameter rlated
     """
     
     self.ui.label_2.setText('{} (Smoothness)'.format(u'\u03BB'))
     self.ui.spinBoxLambda = _SciSpin()
     self.ui.verticalLayout_2.insertWidget(1, self.ui.spinBoxLambda)
     self.ui.spinBoxLambda.setValue(self.parameters['smoothness_param'])
Пример #6
0
    def setup_smoothness(self):
        """ 
        Lambda/smoothness parameter rlated
        """

        self.ui.label_2.setText('{} (Smoothness)'.format(u'\u03BB'))
        self.ui.spinBoxLambda = _SciSpin()
        self.ui.verticalLayout_2.insertWidget(1, self.ui.spinBoxLambda)
        self.ui.spinBoxLambda.setValue(self.parameters['smoothness_param'])
Пример #7
0
    def __init__(self, smoothness_param=1, redux=1, fix_end_points=True, 
                 max_iter=100, min_diff=1e-6, parent = None):
                      
        super(widgetArPLS, self).__init__(parent) ### EDIT ###
        
        self.ui = _Ui_Form()
        self.ui.setupUi(self)##
        
        # Update parameter dict
        self.parameters['smoothness_param'] = smoothness_param
        self.parameters['redux'] = redux
        self.parameters['fix_end_points'] = fix_end_points
        self.parameters['max_iter'] = max_iter
        self.parameters['min_diff'] = min_diff
        
        
        # Lambda/smoothness parameter rlated
        self.ui.label_2.setText('{} (Smoothness)'.format(u'\u03BB'))
        self.ui.spinBoxLambda = _SciSpin()
        self.ui.verticalLayout_2.insertWidget(1, self.ui.spinBoxLambda)
        self.ui.spinBoxLambda.setValue(self.parameters['smoothness_param'])
                
        # Redux factor
        self.ui.spinBoxRedux.setValue(self.parameters['redux'])

        # Fixed ends
        self.ui.checkBox.setChecked(self.parameters['fix_end_points'])
        
        # Max iterations
        self.ui.spinBoxMaxIter.setValue(self.parameters['max_iter'])
        
        # Min Difference
        self.ui.spinBoxMinDiff = _SciSpin()
        self.ui.verticalLayout_9.insertWidget(4, self.ui.spinBoxMinDiff)
        self.ui.spinBoxMinDiff.setValue(self.parameters['min_diff'])
        
        # SIGNALS & SLOTS
        self.ui.spinBoxLambda.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxRedux.editingFinished.connect(self.spinBoxChanged)
        
        self.ui.spinBoxMaxIter.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMinDiff.editingFinished.connect(self.spinBoxChanged)
        
        self.ui.checkBox.clicked.connect(self.selectFixedEnds)
Пример #8
0
    def __init__(self, asym_param=1e-3, smoothness_param=1, redux=10,
                 pstart=1e-2, pend=1e-3, fixed_p=True, fix_end_points=True, 
                 max_iter=100, min_diff=1e-6, parent = None):
                      
        super(widgetALS, self).__init__(parent) ### EDIT ###
        
        self.ui = _Ui_Form()
        self.ui.setupUi(self)
        
        # Update parameter dict
        self.parameters['smoothness_param'] = smoothness_param
        self.parameters['asym_param'] = asym_param
        self.parameters['fixed_p'] = fixed_p
        self.parameters['asym_param_start'] = pstart
        self.parameters['asym_param_end'] = pend
        self.parameters['redux'] = redux
        self.parameters['fix_end_points'] = fix_end_points
        self.parameters['max_iter'] = max_iter
        self.parameters['min_diff'] = min_diff
        
        self.setup_asym()  # Setup controls for asymmetry parameter
        self.setup_smoothness()  # Setup controls for smoothness parameter
        
        # Redux factor
        self.ui.spinBoxRedux.setValue(self.parameters['redux'])

        # Fixed ends
        self.ui.checkBox.setChecked(self.parameters['fix_end_points'])
        
        # Max iterations
        self.ui.spinBoxMaxIter.setValue(self.parameters['max_iter'])
        
        # Min Difference
        self.ui.spinBoxMinDiff = _SciSpin()
        self.ui.verticalLayout_9.insertWidget(4, self.ui.spinBoxMinDiff)
        self.ui.spinBoxMinDiff.setValue(self.parameters['min_diff'])
        
        # SIGNALS & SLOTS
        self.ui.spinBoxP.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxLambda.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxRedux.editingFinished.connect(self.spinBoxChanged)
        
        self.ui.spinBoxPStart.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxPEnd.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMaxIter.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMinDiff.editingFinished.connect(self.spinBoxChanged)
        
        self.ui.radioButtonFixedP.clicked.connect(self.selectFixedOrLog)
        self.ui.radioButtonLogLinearP.clicked.connect(self.selectFixedOrLog)
        self.ui.checkBox.clicked.connect(self.selectFixedEnds)
Пример #9
0
    def setup_asym(self):
        """
        P/asymmetry parameter related
        """

        self.ui.spinBoxP = _SciSpin()
        self.ui.verticalLayout.insertWidget(1, self.ui.spinBoxP)
        self.ui.spinBoxP.setValue(self.parameters['asym_param'])
        if self.parameters['fixed_p']:
            self.ui.radioButtonFixedP.setChecked(True)
            self.ui.radioButtonLogLinearP.setChecked(False)
        else:
            self.ui.radioButtonFixedP.setChecked(False)
            self.ui.radioButtonLogLinearP.setChecked(True)
        self.selectFixedOrLog()

        self.ui.spinBoxPStart = _SciSpin()
        self.ui.verticalLayout_5.insertWidget(1, self.ui.spinBoxPStart)
        self.ui.spinBoxPStart.setValue(self.parameters['asym_param_start'])

        self.ui.spinBoxPEnd = _SciSpin()
        self.ui.verticalLayout_6.insertWidget(1, self.ui.spinBoxPEnd)
        self.ui.spinBoxPEnd.setValue(self.parameters['asym_param_end'])
Пример #10
0
 def setup_asym(self):
     """
     P/asymmetry parameter related
     """
     
     
     self.ui.spinBoxP = _SciSpin()
     self.ui.verticalLayout.insertWidget(1, self.ui.spinBoxP)
     self.ui.spinBoxP.setValue(self.parameters['asym_param'])
     if self.parameters['fixed_p']:
         self.ui.radioButtonFixedP.setChecked(True)
         self.ui.radioButtonLogLinearP.setChecked(False)
     else:
         self.ui.radioButtonFixedP.setChecked(False)
         self.ui.radioButtonLogLinearP.setChecked(True)
     self.selectFixedOrLog()
         
     self.ui.spinBoxPStart = _SciSpin()
     self.ui.verticalLayout_5.insertWidget(1, self.ui.spinBoxPStart)
     self.ui.spinBoxPStart.setValue(self.parameters['asym_param_start'])
     
     self.ui.spinBoxPEnd = _SciSpin()
     self.ui.verticalLayout_6.insertWidget(1, self.ui.spinBoxPEnd)
     self.ui.spinBoxPEnd.setValue(self.parameters['asym_param_end'])
Пример #11
0
    def __init__(self,
                 x=None,
                 rng=None,
                 smoothness_param=1,
                 asym_param=1e-3,
                 redux=10,
                 order=2,
                 fix_end_points=True,
                 fix_const=1,
                 fix_rng=None,
                 max_iter=100,
                 min_diff=1e-6,
                 verbose=False,
                 sub_asym_list=None,
                 sub_w_list=None,
                 parent=None):

        super(widgetALS, self).__init__(parent)  ### EDIT ###

        self._x = x
        self.rng = rng

        self.ui = _Ui_Form()
        self.ui.setupUi(self)

        self.sub_asym_list = sub_asym_list
        self.sub_w_list = sub_w_list

        # ! Change this into its own function after
        # ! the asym table widget is all setup
        if not self.sub_asym_list:
            self.parameters['asym_param'] = asym_param
        else:
            self.parameters['asym_param'] = 0 * self.x + asym_param

        # Update parameter dict
        self.parameters['smoothness_param'] = smoothness_param
        self.parameters['rng'] = rng
        self.parameters['redux'] = redux
        self.parameters['order'] = order
        self.parameters['fix_end_points'] = fix_end_points
        self.parameters['fix_rng'] = fix_rng
        self.parameters['fix_const'] = fix_const
        self.parameters['max_iter'] = max_iter
        self.parameters['min_diff'] = min_diff
        self.parameters['verbose'] = verbose

        self.setup_asym()  # Setup controls for asymmetry parameter
        self.setup_smoothness()  # Setup controls for smoothness parameter

        # Redux factor
        self.ui.spinBoxRedux.setValue(self.parameters['redux'])

        # Fixed ends
        self.ui.checkBox.setChecked(self.parameters['fix_end_points'])

        # Max iterations
        self.ui.spinBoxMaxIter.setValue(self.parameters['max_iter'])

        # Min Difference
        self.ui.spinBoxMinDiff = _SciSpin()
        self.ui.verticalLayout_9.insertWidget(4, self.ui.spinBoxMinDiff)
        self.ui.spinBoxMinDiff.setValue(self.parameters['min_diff'])

        # SIGNALS & SLOTS
        self.ui.spinBoxP.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxLambda.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxRedux.editingFinished.connect(self.spinBoxChanged)

        self.ui.spinBoxMaxIter.editingFinished.connect(self.spinBoxChanged)
        self.ui.spinBoxMinDiff.editingFinished.connect(self.spinBoxChanged)

        self.ui.checkBox.clicked.connect(self.selectFixedEnds)

        self.ui.spinBoxAsymSubSections.valueChanged.connect(
            self.asym_sub_val_change)
        self.ui.spinBoxWSubSections.valueChanged.connect(
            self.weight_sub_val_change)

        self.ui.spinBoxWeight = _SciSpin()
        self.ui.spinBoxWeight.setMinimum(0)
        self.ui.spinBoxWeight.setMaximum(1e10)
        self.ui.spinBoxWeight.setValue(1)
        self.ui.spinBoxWeight.editingFinished.connect(
            self.weightspinboxchanged)
        self.ui.verticalLayout_7.insertWidget(1, self.ui.spinBoxWeight)