Changeset b14db78 in sasview
- Timestamp:
- Oct 6, 2018 10:20:50 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- f20ea3f
- Parents:
- 00a40bd
- Location:
- src/sas/qtgui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/MainWindow.py
ra486918 rb14db78 6 6 from PyQt5.QtWidgets import QApplication 7 7 from PyQt5.QtGui import QPixmap 8 import os 8 9 import sys 9 10 # Local UI … … 44 45 The screen will disappear as soon as the event loop starts. 45 46 """ 46 # TODO: standardize path to images 47 pixmap = QPixmap("src/sas/qtgui/images/SVwelcome_mini.png") 47 pixmap_path = "images/SVwelcome_mini.png" 48 if os.path.splitext(sys.argv[0])[1].lower() == ".py": 49 pixmap_path = "src/sas/qtgui/images/SVwelcome_mini.png" 50 pixmap = QPixmap(pixmap_path) 48 51 splashScreen = QSplashScreen(pixmap) 49 52 return splashScreen -
src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py
r8b6e4be rb14db78 33 33 SMEARING_1D = ["Custom Pinhole Smear", "Custom Slit Smear"] 34 34 SMEARING_2D = ["Custom Pinhole Smear"] 35 SMEARING_QD = "Use dQ Data" 35 36 36 37 MODEL = [ … … 62 63 self.current_smearer = None 63 64 self.kernel_model = None 64 65 # dQ data variables 66 smear_type = None 67 dq_l = None 68 dq_r = None 65 69 # Let only floats in the line edits 66 70 self.txtSmearDown.setValidator(GuiUtils.DoubleValidator()) … … 117 121 """ 118 122 self.kernel_model = kernel_model 123 self.cbSmearing.clear() 124 self.cbSmearing.addItem("None") 119 125 if self.data is None: 120 126 self.setElementsVisibility(False) … … 122 128 if self.kernel_model is None: 123 129 return 124 elif isinstance(self.data, Data1D): 130 # Find out if data has dQ 131 (self.smear_type, self.dq_l, self.dq_r) = self.getSmearInfo() 132 if self.smear_type is not None: 133 self.cbSmearing.addItem(SMEARING_QD) 134 if isinstance(self.data, Data1D): 125 135 self.cbSmearing.addItems(SMEARING_1D) 126 136 else: … … 136 146 Callback for smearing combobox index change 137 147 """ 138 if index == 0: 148 text = self.cbSmearing.currentText() 149 if text == 'None': 139 150 self.setElementsVisibility(False) 140 151 self.current_smearer = None 141 elif index == 1: 152 elif text == "Use dQ Data": 153 self.setElementsVisibility(True) 154 self.setDQLabels() 155 if self.smear_type == "Pinhole": 156 self.onPinholeSmear() 157 else: 158 self.onSlitSmear() 159 elif text == "Custom Pinhole Smear": 142 160 self.setElementsVisibility(True) 143 161 self.setPinholeLabels() 144 162 self.onPinholeSmear() 145 elif index == 2:163 elif text == "Custom Slit Smear": 146 164 self.setElementsVisibility(True) 147 165 self.setSlitLabels() … … 192 210 self.lblSmearUp.setText('<html><head/><body><p>dQ<span style=" vertical-align:sub;">%</span></p></body></html>') 193 211 self.lblUnitUp.setText('%') 212 self.txtSmearDown.setEnabled(True) 213 self.txtSmearUp.setEnabled(True) 214 self.txtSmearDown.setText(str(0.0)) 215 self.txtSmearUp.setText(str(0.0)) 194 216 195 217 def setSlitLabels(self): … … 203 225 self.lblUnitDown.setText('<html><head/><body><p>Ã 204 226 <span style=" vertical-align:super;">-1</span></p></body></html>') 227 self.txtSmearDown.setEnabled(True) 228 self.txtSmearUp.setEnabled(True) 229 self.txtSmearDown.setText(str(0.0)) 230 self.txtSmearUp.setText(str(0.0)) 231 232 def setDQLabels(self): 233 """ 234 Use pinhole labels 235 """ 236 if self.smear_type == "Pinhole": 237 self.lblSmearDown.setText('<html><head/><body><p>dQ<span style=" vertical-align:sub;">high</span></p></body></html>') 238 self.lblSmearUp.setText('<html><head/><body><p>dQ<span style=" vertical-align:sub;">low</span></p></body></html>') 239 else: 240 self.lblSmearUp.setText('<dQp>') 241 self.lblSmearDown.setText('<dQs>') 242 self.lblUnitUp.setText('<html><head/><body><p>Ã 243 <span style=" vertical-align:super;">-1</span></p></body></html>') 244 self.lblUnitDown.setText('<html><head/><body><p>Ã 245 <span style=" vertical-align:super;">-1</span></p></body></html>') 246 self.txtSmearDown.setText(str(self.dq_r)) 247 self.txtSmearUp.setText(str(self.dq_l)) 248 self.txtSmearDown.setEnabled(False) 249 self.txtSmearUp.setEnabled(False) 205 250 206 251 def state(self): … … 306 351 307 352 self.current_smearer = smear_selection(data, self.kernel_model) 353 354 def getSmearInfo(self): 355 """ 356 Get the smear info from data. 357 358 :return: self.smear_type, self.dq_l and self.dq_r, 359 respectively the type of the smear, dq_min and 360 dq_max for pinhole smear data 361 while dxl and dxw for slit smear 362 """ 363 # default 364 smear_type = None 365 dq_l = None 366 dq_r = None 367 data = self.data 368 if self.data is None: 369 return smear_type, dq_l, dq_r 370 elif isinstance(data, Data2D): 371 if data.dqx_data is None or data.dqy_data is None: 372 return smear_type, dq_l, dq_r 373 elif data.dqx_data.any() != 0 and data.dqx_data.any() != 0: 374 smear_type = "Pinhole2d" 375 dq_l = GuiUtils.formatNumber(np.average(data.dqx_data)) 376 dq_r = GuiUtils.formatNumber(np.average(data.dqy_data)) 377 return smear_type, dq_l, dq_r 378 else: 379 return smear_type, dq_l, dq_r 380 # check if it is pinhole smear and get min max if it is. 381 if data.dx is not None and np.any(data.dx): 382 smear_type = "Pinhole" 383 dq_l = data.dx[0] 384 dq_r = data.dx[-1] 385 386 # check if it is slit smear and get min max if it is. 387 elif data.dxl is not None or data.dxw is not None: 388 smear_type = "Slit" 389 if data.dxl is not None and np.all(data.dxl, 0): 390 dq_l = data.dxl[0] 391 if data.dxw is not None and np.all(data.dxw, 0): 392 dq_r = data.dxw[0] 393 394 return smear_type, dq_l, dq_r
Note: See TracChangeset
for help on using the changeset viewer.