Changeset 57be490 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- May 17, 2018 2:50:09 AM (6 years ago)
- Branches:
- ESS_GUI, 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:
- 085e3c9d
- Parents:
- 976978b
- git-author:
- Piotr Rozyczko <rozyczko@…> (04/13/18 07:34:43)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (05/17/18 02:50:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
raed0532 r57be490 1 1 import json 2 2 import os 3 import copy 3 4 from collections import defaultdict 4 5 … … 21 22 22 23 from sas.sascalc.fit.BumpsFitting import BumpsFit as Fit 24 from sas.sascalc.fit.pagestate import PageState 23 25 24 26 import sas.qtgui.Utilities.GuiUtils as GuiUtils … … 45 47 from sas.qtgui.Perspectives.Fitting.Constraint import Constraint 46 48 from sas.qtgui.Perspectives.Fitting.MultiConstraint import MultiConstraint 49 from sas.qtgui.Perspectives.Fitting.ReportPageLogic import ReportPageLogic 50 47 51 48 52 … … 506 510 # Signals from other widgets 507 511 self.communicate.customModelDirectoryChanged.connect(self.onCustomModelChange) 512 self.communicate.saveAnalysisSignal.connect(self.savePageState) 513 #self.communicate.saveReportSignal.connect(self.saveReport) 508 514 509 515 def modelName(self): … … 2633 2639 self.page_stack.pop() 2634 2640 2641 def getReport(self): 2642 """ 2643 Create and return HTML report with parameters and charts 2644 """ 2645 index = None 2646 if self.all_data: 2647 index = self.all_data[self.data_index] 2648 report_logic = ReportPageLogic(self, 2649 kernel_module=self.kernel_module, 2650 data=self.data, 2651 index=index, 2652 model=self._model_model) 2653 2654 return report_logic.reportList() 2655 2656 def savePageState(self): 2657 """ 2658 Create and serialize local PageState 2659 """ 2660 from sas.sascalc.fit.pagestate import Reader 2661 model = self.kernel_module 2662 2663 # Old style PageState object 2664 state = PageState(model=model, data=self.data) 2665 2666 # Add parameter data to the state 2667 self.getCurrentFitState(state) 2668 2669 # Create the filewriter, aptly named 'Reader' 2670 state_reader = Reader(self.loadPageStateCallback) 2671 filepath = self.saveAsAnalysisFile() 2672 if filepath is None: 2673 return 2674 state_reader.write(filename=filepath, fitstate=state) 2675 pass 2676 2677 def saveAsAnalysisFile(self): 2678 """ 2679 Show the save as... dialog and return the chosen filepath 2680 """ 2681 default_name = "FitPage"+str(self.tab_id)+".fitv" 2682 2683 wildcard = "fitv files (*.fitv)" 2684 kwargs = { 2685 'caption' : 'Save As', 2686 'directory' : default_name, 2687 'filter' : wildcard, 2688 'parent' : None, 2689 } 2690 # Query user for filename. 2691 filename_tuple = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 2692 filename = filename_tuple[0] 2693 return filename 2694 2695 def loadPageStateCallback(self,state=None, datainfo=None, format=None): 2696 """ 2697 This is a callback method called from the CANSAS reader. 2698 We need the instance of this reader only for writing out a file, 2699 so there's nothing here. 2700 Until Load Analysis is implemented, that is. 2701 """ 2702 pass 2703 2704 def loadPageState(self, pagestate=None): 2705 """ 2706 Load the PageState object and update the current widget 2707 """ 2708 pass 2709 2710 def getCurrentFitState(self, state=None): 2711 """ 2712 Store current state for fit_page 2713 """ 2714 # save model option 2715 #if self.model is not None: 2716 # self.disp_list = self.getDispParamList() 2717 # state.disp_list = copy.deepcopy(self.disp_list) 2718 # #state.model = self.model.clone() 2719 2720 # Comboboxes 2721 state.categorycombobox = self.cbCategory.currentText() 2722 state.formfactorcombobox = self.cbModel.currentText() 2723 if self.cbStructureFactor.isEnabled(): 2724 state.structureCombobox = self.cbStructureFactor.currentText() 2725 state.tcChi = self.chi2 2726 2727 state.enable2D = self.is2D 2728 2729 #state.weights = copy.deepcopy(self.weights) 2730 # save data 2731 state.data = copy.deepcopy(self.data) 2732 2733 # save plotting range 2734 state.qmin = self.q_range_min 2735 state.qmax = self.q_range_max 2736 state.npts = self.npts 2737 2738 # self.state.enable_disp = self.enable_disp.GetValue() 2739 # self.state.disable_disp = self.disable_disp.GetValue() 2740 2741 # self.state.enable_smearer = \ 2742 # copy.deepcopy(self.enable_smearer.GetValue()) 2743 # self.state.disable_smearer = \ 2744 # copy.deepcopy(self.disable_smearer.GetValue()) 2745 2746 #self.state.pinhole_smearer = \ 2747 # copy.deepcopy(self.pinhole_smearer.GetValue()) 2748 #self.state.slit_smearer = copy.deepcopy(self.slit_smearer.GetValue()) 2749 #self.state.dI_noweight = copy.deepcopy(self.dI_noweight.GetValue()) 2750 #self.state.dI_didata = copy.deepcopy(self.dI_didata.GetValue()) 2751 #self.state.dI_sqrdata = copy.deepcopy(self.dI_sqrdata.GetValue()) 2752 #self.state.dI_idata = copy.deepcopy(self.dI_idata.GetValue()) 2753 2754 p = self.model_parameters 2755 # save checkbutton state and txtcrtl values 2756 state.parameters = FittingUtilities.getStandardParam() 2757 state.orientation_params_disp = FittingUtilities.getOrientationParam() 2758 2759 #self._copy_parameters_state(self.orientation_params_disp, self.state.orientation_params_disp) 2760 #self._copy_parameters_state(self.parameters, self.state.parameters) 2761 #self._copy_parameters_state(self.fittable_param, self.state.fittable_param) 2762 #self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 2763 2764
Note: See TracChangeset
for help on using the changeset viewer.