- Timestamp:
- Oct 29, 2017 12:55:14 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:
- 4cac8a47
- Parents:
- c00a28ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
rc00a28ff r570a2f73 21 21 22 22 def is_float(value): 23 """Converts text input values to floats. Empty strings throw ValueError""" 23 24 try: 24 25 return float(value) … … 26 27 return 0.0 27 28 29 30 # TODO: Remove data 31 # TODO: Modify plot references, don't just send new 32 # TODO: Explorer button - link to PR from AW 33 # TODO: Update help with batch capabilities 34 # TODO: Window should not be fixed size 35 # TODO: Easy way to scroll through results - no tabs in window(?) - 'spreadsheet' 36 # TODO: Method to export results in some meaningful way 28 37 class InversionWindow(QtGui.QTabWidget, Ui_PrInversion): 29 38 """ … … 71 80 self._data_list[datum] = self._calculator.clone() 72 81 73 # plots 82 # plots for current data 74 83 self.pr_plot = None 75 84 self.data_plot = None 85 # plot references for all data in perspective 86 self.pr_plot_list = {} 87 self.data_plot_list = {} 76 88 77 89 self.model = QtGui.QStandardItemModel(self) … … 299 311 self.close() 300 312 InversionWindow.__init__(self.parent(), self._data_list.keys()) 301 return 313 exit(0) 314 # TODO: Only send plot first time - otherwise, update in complete 302 315 if self.pr_plot is not None: 303 316 title = self.pr_plot.name … … 356 369 357 370 for data in data_item: 358 self.setCurrentData(data) 371 # Create initial internal mappings 372 self._data_list[data] = self._calculator.clone() 373 self._data_set = GuiUtils.dataFromItem(data) 374 self.data_plot_list[data] = self.data_plot 375 self.pr_plot_list[data] = self.pr_plot 359 376 ref_var = QtCore.QVariant(data) 360 377 self.populateDataComboBox(self._data_set.filename, ref_var) 378 self.setCurrentData(data) 379 380 # Estimate initial values from data 381 self.performEstimate() 382 self.logic = InversionLogic(self._data_set) 383 384 # Estimate q range 385 qmin, qmax = self.logic.computeDataRange() 386 self.model.setItem(WIDGETS.W_QMIN, QtGui.QStandardItem( 387 "{:.4g}".format(qmin))) 388 self.model.setItem(WIDGETS.W_QMAX, QtGui.QStandardItem( 389 "{:.4g}".format(qmax))) 390 391 self.enableButtons() 361 392 362 393 def setCurrentData(self, data_ref): 363 """ Set the selected data set to be the current data"""394 """Get the current data and display as necessary""" 364 395 365 396 if not isinstance(data_ref, QtGui.QStandardItem): … … 370 401 self._data = data_ref 371 402 self._data_set = GuiUtils.dataFromItem(data_ref) 372 self._data_list[self._data] = self._calculator 373 374 # Estimate initial values from data 375 self.performEstimate() 376 self.logic = InversionLogic(self._data_set) 377 378 # Estimate q range 379 qmin, qmax = self.logic.computeDataRange() 380 self.model.setItem(WIDGETS.W_QMIN, QtGui.QStandardItem( 381 "{:.4g}".format(qmin))) 382 self.model.setItem(WIDGETS.W_QMAX, QtGui.QStandardItem( 383 "{:.4g}".format(qmax))) 384 385 self.enableButtons() 403 self._calculator = self._data_list[data_ref] 404 self.pr_plot = self.pr_plot_list[data_ref] 405 self.data_plot = self.data_plot_list[data_ref] 386 406 387 407 ###################################################################### … … 524 544 # Show result on control panel 525 545 526 # TODO: Connect self._calculator to GUI 546 # TODO: Connect self._calculator to GUI - two-to-one connection possible? 527 547 self.model.setItem(WIDGETS.W_RG, QtGui.QStandardItem(str(pr.rg(out)))) 528 548 self.model.setItem(WIDGETS.W_I_ZERO, … … 550 570 self._data_list[self._data] = self._calculator.clone() 551 571 552 # FIXME: Update plots if exist 553 # TODO: Keep plot references so they can be updated. 554 # TODO: On data change, update current reference to this->plot 555 572 # Create new P(r) and fit plots 556 573 if self.pr_plot is None: 557 574 self.pr_plot = self.logic.newPRPlot(out, self._calculator, cov) 575 self.pr_plot_list[self._data] = self.pr_plot 576 else: 577 # FIXME: this should update the existing plot, not create a new one 578 self.pr_plot = self.logic.newPRPlot(out, self._calculator, cov) 579 self.pr_plot_list[self._data] = self.pr_plot 558 580 if self.data_plot is None: 559 581 self.data_plot = self.logic.new1DPlot(out, self._calculator) 582 self.data_plot_list[self._data] = self.data_plot 583 else: 584 # FIXME: this should update the existing plot, not create a new one 585 self.data_plot = self.logic.new1DPlot(out, self._calculator) 586 self.data_plot_list[self._data] = self.data_plot 560 587 561 588 def _threadError(self, error):
Note: See TracChangeset
for help on using the changeset viewer.