Changeset 305114c in sasview
- Timestamp:
- Sep 14, 2018 10:10:09 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- aa88b76
- Parents:
- 86d3207
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py
raed0532 r305114c 13 13 import webbrowser 14 14 15 from sas.qtgui.Perspectives.Fitting import FittingUtilities 15 16 import sas.qtgui.Utilities.GuiUtils as GuiUtils 16 17 ALLOWED_OPERATORS = ['=','<','>','>=','<='] … … 32 33 self.operator = '=' 33 34 35 self.warning = self.lblWarning.text() 34 36 self.setupData() 37 self.setupSignals() 35 38 self.setupWidgets() 36 self.setupSignals()37 39 self.setupTooltip() 38 39 self.setFixedSize(self.minimumSizeHint())40 40 41 41 # Default focus is on OK … … 101 101 # Find out the signal source 102 102 source = self.sender().objectName() 103 param1 = self.cbParam1.currentText() 104 param2 = self.cbParam2.currentText() 103 105 if source == "cbParam1": 104 self.txtParam.setText(self.tab_names[0] + ":" + self.cbParam1.currentText())106 self.txtParam.setText(self.tab_names[0] + ":" + param1) 105 107 else: 106 self.txtConstraint.setText(self.tab_names[1] + "." + self.cbParam2.currentText()) 108 self.txtConstraint.setText(self.tab_names[1] + "." + param2) 109 # Check if any of the parameters are polydisperse 110 params_list = [param1, param2] 111 all_pars = [tab.model_parameters for tab in self.tabs] 112 is2Ds = [tab.is2D for tab in self.tabs] 113 txt = "" 114 for pars, is2D in zip(all_pars, is2Ds): 115 if any([FittingUtilities.isParamPolydisperse(p, pars, is2D) for p in params_list]): 116 # no parameters are pd - reset the text to not show the warning 117 txt = self.warning 118 self.lblWarning.setText(txt) 119 107 120 108 121 def onOperatorChange(self, index): -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r1a15ada r305114c 781 781 782 782 return output_string 783 784 def isParamPolydisperse(param_name, kernel_params, is2D=False): 785 """ 786 Simple lookup for polydispersity for the given param name 787 """ 788 parameters = kernel_params.form_volume_parameters 789 if is2D: 790 parameters += kernel_params.orientation_parameters 791 has_poly = False 792 for param in parameters: 793 if param.name==param_name and param.polydisperse: 794 has_poly = True 795 break 796 return has_poly 797 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r86d3207 r305114c 649 649 # Create and display the widget for param1 and param2 650 650 mc_widget = MultiConstraint(self, params=params_list) 651 # Check if any of the parameters are polydisperse 652 if not np.any([FittingUtilities.isParamPolydisperse(p, self.model_parameters, is2D=self.is2D) for p in params_list]): 653 # no parameters are pd - reset the text to not show the warning 654 mc_widget.lblWarning.setText("") 651 655 if mc_widget.exec_() != QtWidgets.QDialog.Accepted: 652 656 return -
src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py
raed0532 r305114c 28 28 29 29 self.setupUi(self) 30 self.setFixedSize(self.minimumSizeHint())31 30 self.setModal(True) 32 31 self.params = params -
src/sas/qtgui/Perspectives/Fitting/UI/ComplexConstraintUI.ui
ra90c9c5 r305114c 7 7 <x>0</x> 8 8 <y>0</y> 9 <width>4 06</width>10 <height> 167</height>9 <width>463</width> 10 <height>234</height> 11 11 </rect> 12 12 </property> … … 21 21 </property> 22 22 <layout class="QGridLayout" name="gridLayout"> 23 <item row="1" column="0"> 24 <layout class="QHBoxLayout" name="horizontalLayout_2"> 25 <item> 26 <widget class="QLabel" name="txtParam"> 27 <property name="sizePolicy"> 28 <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> 29 <horstretch>0</horstretch> 30 <verstretch>0</verstretch> 31 </sizepolicy> 32 </property> 33 <property name="text"> 34 <string>param1</string> 35 </property> 36 </widget> 37 </item> 38 <item> 39 <widget class="QLabel" name="txtOperator"> 40 <property name="text"> 41 <string>=</string> 42 </property> 43 </widget> 44 </item> 45 <item> 46 <widget class="QLineEdit" name="txtConstraint"> 47 <property name="text"> 48 <string/> 49 </property> 50 </widget> 51 </item> 52 </layout> 53 </item> 23 54 <item row="0" column="0"> 24 55 <layout class="QHBoxLayout" name="horizontalLayout"> … … 98 129 </layout> 99 130 </item> 100 <item row="1" column="0">101 <spacer name="verticalSpacer">102 <property name="orientation">103 <enum>Qt::Vertical</enum>104 </property>105 <property name="sizeHint" stdset="0">106 <size>107 <width>20</width>108 <height>25</height>109 </size>110 </property>111 </spacer>112 </item>113 <item row="2" column="0">114 <layout class="QHBoxLayout" name="horizontalLayout_2">115 <item>116 <widget class="QLabel" name="txtParam">117 <property name="sizePolicy">118 <sizepolicy hsizetype="Minimum" vsizetype="Preferred">119 <horstretch>0</horstretch>120 <verstretch>0</verstretch>121 </sizepolicy>122 </property>123 <property name="text">124 <string>param1</string>125 </property>126 </widget>127 </item>128 <item>129 <widget class="QLabel" name="txtOperator">130 <property name="text">131 <string>=</string>132 </property>133 </widget>134 </item>135 <item>136 <widget class="QLineEdit" name="txtConstraint">137 <property name="text">138 <string/>139 </property>140 </widget>141 </item>142 </layout>143 </item>144 131 </layout> 145 132 </widget> 146 133 </item> 147 134 <item row="1" column="0"> 135 <widget class="QLabel" name="lblWarning"> 136 <property name="text"> 137 <string><html><head/><body><p><span style=" color:#ff0000;">Warning! Polydisperse parameter selected.<br/></span>Constraints involving polydisperse parameters only apply to<br/>starting values and are nor re-applied during size or angle polydispersity<br/>integrations. To do which requires creating a custom model.</p></body></html></string> 138 </property> 139 </widget> 140 </item> 141 <item row="2" column="0"> 142 <spacer name="verticalSpacer_2"> 143 <property name="orientation"> 144 <enum>Qt::Vertical</enum> 145 </property> 146 <property name="sizeHint" stdset="0"> 147 <size> 148 <width>20</width> 149 <height>9</height> 150 </size> 151 </property> 152 </spacer> 153 </item> 154 <item row="3" column="0"> 148 155 <layout class="QHBoxLayout" name="horizontalLayout_3"> 149 156 <item> -
src/sas/qtgui/Perspectives/Fitting/UI/MultiConstraintUI.ui
ra90c9c5 r305114c 11 11 <y>0</y> 12 12 <width>426</width> 13 <height>1 62</height>13 <height>185</height> 14 14 </rect> 15 15 </property> 16 16 <property name="sizePolicy"> 17 <sizepolicy hsizetype="Minimum" vsizetype="Minimum ">17 <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> 18 18 <horstretch>0</horstretch> 19 19 <verstretch>0</verstretch> … … 119 119 </item> 120 120 <item row="2" column="0"> 121 <widget class="QLabel" name="lblWarning"> 122 <property name="text"> 123 <string><html><head/><body><p><span style=" color:#ff0000;">Warning! </span>Constraints involving polydisperse parameters only apply to<br/>starting values and are nor re-applied during size or angle polydispersity<br/>integrations. To do which requires creating a custom model.</p></body></html></string> 124 </property> 125 </widget> 126 </item> 127 <item row="3" column="0"> 121 128 <spacer name="verticalSpacer"> 122 129 <property name="orientation"> … … 131 138 </spacer> 132 139 </item> 133 <item row=" 3" column="0">140 <item row="4" column="0"> 134 141 <layout class="QHBoxLayout" name="horizontalLayout_2"> 135 142 <item>
Note: See TracChangeset
for help on using the changeset viewer.