- Timestamp:
- Apr 10, 2018 1:53:59 PM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 76567bb
- Parents:
- bb6b037
- Location:
- src/sas/qtgui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
rbb6b037 reffdd98 16 16 # pr inversion calculation elements 17 17 from sas.sascalc.pr.invertor import Invertor 18 19 # Batch calculation display 20 from sas.qtgui.Utilities.GridPanel import BatchInversionOutputPanel 18 21 19 22 def is_float(value): … … 73 76 74 77 # Calculation threads used by all data items 78 self.waitForEach = False 75 79 self.calc_thread = None 76 80 self.estimation_thread = None … … 90 94 self.model = QtGui.QStandardItemModel(self) 91 95 self.mapper = QtWidgets.QDataWidgetMapper(self) 96 97 self.grid_window = None 92 98 93 99 # Add validators … … 374 380 self.dmaxWindow.show() 375 381 382 def showBatchOutput(self, output_data): 383 if self.grid_window is None: 384 self.grid_window = BatchInversionOutputPanel( 385 parent=self, output_data=output_data) 386 self.grid_window.show() 387 376 388 ###################################################################### 377 389 # Response Actions … … 451 463 QtGui.QStandardItem("{:.4g}".format(pr.get_qmax()))) 452 464 self.model.setItem(WIDGETS.W_BACKGROUND_INPUT, 453 QtGui.QStandardItem("{:.3 f}".format(pr.background)))465 QtGui.QStandardItem("{:.3g}".format(pr.background))) 454 466 self.model.setItem(WIDGETS.W_BACKGROUND_OUTPUT, 455 467 QtGui.QStandardItem("{:.3g}".format(pr.background))) … … 511 523 # Thread Creators 512 524 def startThreadAll(self): 525 self.waitForEach = True 526 output = {} 513 527 for data_ref in self._data_list.keys(): 514 528 self.setCurrentData(data_ref) 515 529 self.startThread() 530 output[self.logic.data.filename] = self._calculator 531 self.waitForEach = False 532 self.showBatchOutput(output) 516 533 517 534 def startThread(self): … … 535 552 self.calc_thread.queue() 536 553 self.calc_thread.ready(2.5) 554 if self.waitForEach: 555 if self.calc_thread.isrunning(): 556 self.calc_thread.update() 537 557 538 558 def performEstimateNT(self): -
src/sas/qtgui/Utilities/GridPanel.py
r8b480d27 reffdd98 280 280 index += 1 281 281 282 283 class BatchInversionOutputPanel(BatchOutputPanel): 284 """ 285 Class for stateless grid-like printout of P(r) parameters for any number 286 of data sets 287 """ 288 def __init__(self, parent = None, output_data=None): 289 290 super(BatchInversionOutputPanel, self).__init__(parent, output_data) 291 292 def setupTable(self, data): 293 """ 294 Create tablewidget items and show them, based on params 295 """ 296 # headers 297 param_list = ['Filename', 'Rg', 'Chi^2/dof', 'I(Q=0)', 'Oscillations', 298 'Background', 'P+ Fraction', 'P+1-theta Fraction', 299 'Calculation Time'] 300 # P(r) keys 301 pr_keys = ['background', ] 302 303 keys = data.keys() 304 rows = len(keys) 305 columns = len(param_list) 306 self.tblParams.setColumnCount(columns) 307 self.tblParams.setRowCount(rows) 308 309 for i, param in enumerate(param_list): 310 self.tblParams.setHorizontalHeaderItem(i, QtWidgets.QTableWidgetItem(param)) 311 312 # first - Chi2 and data filename 313 for i_row, (filename, pr) in enumerate(data.items()): 314 out = pr.out 315 cov = pr.cov 316 self.tblParams.setItem(i_row, 0, QtWidgets.QTableWidgetItem( 317 GuiUtils.formatNumber(filename, high=True))) 318 self.tblParams.setItem(i_row, 2, QtWidgets.QTableWidgetItem( 319 "{:.3g}".format(pr.chi2[0]))) 320 self.tblParams.setItem(i_row, 5, QtWidgets.QTableWidgetItem( 321 "{:.3g}".format(pr.background))) 322 self.tblParams.setItem(i_row, 8, QtWidgets.QTableWidgetItem( 323 "{:.2g}".format(pr.elapsed))) 324 if out is not None: 325 self.tblParams.setItem(i_row, 1, QtWidgets.QTableWidgetItem( 326 "{:.3g}".format(pr.rg(out)))) 327 self.tblParams.setItem(i_row, 3, QtWidgets.QTableWidgetItem( 328 "{:.3g}".format(pr.iq0(out)))) 329 self.tblParams.setItem(i_row, 4, QtWidgets.QTableWidgetItem( 330 "{:.3g}".format(pr.oscillations(out)))) 331 self.tblParams.setItem(i_row, 6, QtWidgets.QTableWidgetItem( 332 "{:.3g}".format(pr.get_positive(out)))) 333 self.tblParams.setItem(i_row, 7, QtWidgets.QTableWidgetItem( 334 "{:.3g}".format(pr.get_pos_err(out, cov)))) 335 else: 336 self.tblParams.setItem(i_row, 1, QtWidgets.QTableWidgetItem( 337 "NaN")) 338 self.tblParams.setItem(i_row, 3, QtWidgets.QTableWidgetItem( 339 "NaN")) 340 self.tblParams.setItem(i_row, 4, QtWidgets.QTableWidgetItem( 341 "NaN")) 342 self.tblParams.setItem(i_row, 6, QtWidgets.QTableWidgetItem( 343 "NaN")) 344 self.tblParams.setItem(i_row, 7, QtWidgets.QTableWidgetItem( 345 "NaN")) 346 347 self.tblParams.resizeColumnsToContents()
Note: See TracChangeset
for help on using the changeset viewer.