Changeset 98485fe in sasview for src/sas/qtgui/Perspectives
- Timestamp:
- Apr 17, 2018 7:42:12 AM (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:
- ae34d30
- Parents:
- 318b353e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
r318b353e r98485fe 78 78 79 79 # Calculation threads used by all data items 80 self. waitForEach = False80 self.isBatch = False 81 81 self.calc_thread = None 82 82 self.estimation_thread = None … … 97 97 self.mapper = QtWidgets.QDataWidgetMapper(self) 98 98 99 # Batch fitting results 99 100 self.grid_window = None 101 self.batchResults = {} 102 self.batchComplete = [] 100 103 101 104 # Add validators … … 376 379 self.dmaxWindow.show() 377 380 378 def showBatchOutput(self , output_data):381 def showBatchOutput(self): 379 382 """ 380 383 Display the batch output in tabular form … … 383 386 if self.grid_window is None: 384 387 self.grid_window = BatchInversionOutputPanel( 385 parent=self, output_data= output_data)388 parent=self, output_data=self.batchResults) 386 389 else: 387 self.grid_window.setupTable( output_data)390 self.grid_window.setupTable(self.batchResults) 388 391 self.grid_window.show() 389 392 … … 427 430 DICT_KEYS[2]: self.data_plot 428 431 } 432 # Update batch results window when finished 433 self.batchResults[self.logic.data.filename] = self._calculator 434 if self.grid_window is not None: 435 self.showBatchOutput() 429 436 430 437 def getNFunc(self): … … 494 501 "{:.3g}".format( 495 502 pr.get_pos_err(out, cov)))) 503 if self.pr_plot is not None: 504 title = self.pr_plot.name 505 GuiUtils.updateModelItemWithPlot(self._data, self.pr_plot, title) 506 self.communicate.plotRequestedSignal.emit([self.pr_plot]) 507 if self.data_plot is not None: 508 title = self.data_plot.name 509 GuiUtils.updateModelItemWithPlot(self._data, self.data_plot, title) 510 self.communicate.plotRequestedSignal.emit( 511 [self.data_plot, self.logic.data]) 496 512 self.enableButtons() 497 513 … … 501 517 self.dmaxWindow.close() 502 518 self.dmaxWindow = None 519 if self.grid_window is not None: 520 self.grid_window.close() 503 521 if not data_list: 504 522 data_list = [self._data] … … 529 547 ###################################################################### 530 548 # Thread Creators 549 531 550 def startThreadAll(self): 532 self.waitForEach = True 533 output = {} 534 for data_ref in self._data_list.keys(): 535 self.setCurrentData(data_ref) 551 self.batchComplete = [] 552 self.isBatch = True 553 self.performEstimate() 554 self.showBatchOutput() 555 556 def startNextBatchItem(self): 557 self.isBatch = False 558 for index in range(len(self._data_list)): 559 if index not in self.batchComplete: 560 self.dataList.setCurrentIndex(index) 561 self.isBatch = True 562 break 563 # If none left, end 564 if self.isBatch: 536 565 self.performEstimate() 537 self.performEstimateNT()538 self.acceptAlpha()539 self.acceptNoTerms()540 self.startThread()541 output[self.logic.data.filename] = self._calculator542 self.waitForEach = False543 self.showBatchOutput(output)544 566 545 567 def startThread(self): … … 563 585 self.calc_thread.queue() 564 586 self.calc_thread.ready(2.5) 565 if self.waitForEach:566 if self.calc_thread.isrunning():567 self.calc_thread.update()568 587 569 588 def performEstimateNT(self): … … 592 611 self.estimation_thread_nt.queue() 593 612 self.estimation_thread_nt.ready(2.5) 594 if self.waitForEach:595 if self.estimation_thread_nt.isrunning():596 self.estimation_thread_nt.update()597 613 598 614 def performEstimate(self): … … 613 629 self.estimation_thread.queue() 614 630 self.estimation_thread.ready(2.5) 615 if self.waitForEach:616 if self.estimation_thread.isrunning():617 self.estimation_thread.update()618 631 619 632 ###################################################################### … … 635 648 if message: 636 649 logging.info(message) 637 if not self.waitForEach: 638 self.performEstimateNT() 650 self.performEstimateNT() 639 651 640 652 def _estimateNTCompleted(self, nterms, alpha, message, elapsed): … … 659 671 if message: 660 672 logging.info(message) 673 if self.isBatch: 674 self.acceptAlpha() 675 self.acceptNoTerms() 676 self.startThread() 661 677 662 678 def _calculateCompleted(self, out, cov, pr, elapsed): … … 686 702 self.pr_plot = self.logic.newPRPlot(out, self._calculator, cov) 687 703 self.pr_plot.filename = self.logic.data.filename 688 title = self.pr_plot.name689 GuiUtils.updateModelItemWithPlot(self._data, self.pr_plot, title)690 self.communicate.plotRequestedSignal.emit([self.pr_plot])691 704 self.data_plot = self.logic.new1DPlot(out, self._calculator) 692 705 self.data_plot.filename = self.logic.data.filename 693 title = self.data_plot.name694 GuiUtils.updateModelItemWithPlot(self._data, self.data_plot, title)695 self.communicate.plotRequestedSignal.emit([self.data_plot])696 706 697 707 # Udpate internals and GUI 698 708 self.updateDataList(self._data) 699 709 self.updateGuiValues() 710 if self.isBatch: 711 self.batchComplete.append(self.dataList.currentIndex()) 712 self.startNextBatchItem() 700 713 701 714 def _threadError(self, error):
Note: See TracChangeset
for help on using the changeset viewer.