Ignore:
Timestamp:
Aug 10, 2018 6:17:13 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
44777ee
Parents:
a2cc8b97
Message:

intermediate P(Q), S(Q) values are now saved in Data Explorer and are plottable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingLogic.py

    r87dfca4 r3ae9179  
    132132        self._data.ymax = ymax 
    133133 
    134     def new1DPlot(self, return_data, tab_id): 
    135         """ 
    136         Create a new 1D data instance based on fitting results 
    137         """ 
    138         # Unpack return data from Calc1D 
    139         x, y, page_id, state, weight,\ 
    140         fid, toggle_mode_on, \ 
    141         elapsed, index, model,\ 
    142         data, update_chisqr, source = return_data 
    143  
     134    def _create1DPlot(self, tab_id, x, y, model, data, component=None): 
     135        """ 
     136        For internal use: create a new 1D data instance based on fitting results 
     137        component is a string indicating the model component, e.g. "P(Q)" 
     138        """ 
    144139        # Create the new plot 
    145140        new_plot = Data1D(x=x, y=y) 
     
    150145 
    151146        new_plot.group_id = data.group_id 
    152         new_plot.id = str(tab_id) + " " + model.id 
    153  
    154         if data.filename: 
    155             new_plot.name = model.name + " [" + data.filename + "]" # data file 
    156         else: 
    157             new_plot.name = model.name + " [" + model.id + "]"  # theory 
     147        new_plot.id = str(tab_id) + " " + ("[" + component + "] " if component else "") + model.id 
     148 
     149        # use data.filename for data, use model.id for theory 
     150        id_str = data.filename if data.filename else model.id 
     151        new_plot.name = model.name + ((" " + component) if component else "") + " [" + id_str + "]" 
    158152 
    159153        new_plot.title = new_plot.name 
     
    162156 
    163157        return new_plot 
     158 
     159    def new1DPlot(self, return_data, tab_id): 
     160        """ 
     161        Create a new 1D data instance based on fitting results 
     162        """ 
     163        # Unpack return data from Calc1D 
     164        x, y, page_id, state, weight,\ 
     165        fid, toggle_mode_on, \ 
     166        elapsed, index, model, \ 
     167        data, update_chisqr, source, \ 
     168        unsmeared_output, unsmeared_data, unsmeared_error, \ 
     169        pq_values, sq_values = return_data 
     170 
     171        return self._create1DPlot(tab_id, x, y, model, data) 
    164172 
    165173    def new2DPlot(self, return_data): 
     
    205213        return new_plot 
    206214 
     215    def new1DProductPlots(self, return_data, tab_id): 
     216        """ 
     217        If return_data contains separated P(Q) and S(Q) data, create 1D plots for each and return as a tuple. 
     218        Returns (None, None) if this data is unavailable. 
     219        """ 
     220        # Unpack return data from Calc1D 
     221        x, y, page_id, state, weight, \ 
     222        fid, toggle_mode_on, \ 
     223        elapsed, index, model, \ 
     224        data, update_chisqr, source, \ 
     225        unsmeared_output, unsmeared_data, unsmeared_error, \ 
     226        pq_values, sq_values = return_data 
     227 
     228        if pq_values is not None and sq_values is not None: 
     229            pq_plot = self._create1DPlot(tab_id, x, pq_values, model, data, component="P(Q)") 
     230            sq_plot = self._create1DPlot(tab_id, x, sq_values, model, data, component="S(Q)") 
     231 
     232            return pq_plot, sq_plot 
     233        else: 
     234            return None, None 
     235 
    207236    def computeDataRange(self): 
    208237        """ 
Note: See TracChangeset for help on using the changeset viewer.