Changeset 3ae9179 in sasview
- Timestamp:
- Aug 10, 2018 6:17:13 AM (6 years ago)
- 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
- Location:
- src/sas/qtgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
rebfe223 r3ae9179 4 4 import time 5 5 import logging 6 import re 6 7 7 8 from PyQt5 import QtCore … … 36 37 # The controller which is responsible for managing signal slots connections 37 38 # for the gui and providing an interface to the data model. 39 theory_plot_ID_pattern = re.compile(r"^([0-9]+)\s+(\[(.*)\]\s+)?(.*)$") 38 40 39 41 def __init__(self, parent=None, guimanager=None, manager=None): … … 504 506 self.active_plots[plot_id].replacePlot(plot_id, plot) 505 507 else: 508 # Don't plot intermediate data e.g. P(Q), S(Q) 509 match = self.theory_plot_ID_pattern.match(plot_id) 510 if match and match.groups()[1] != None: 511 continue 506 512 # 'sophisticated' test to generate standalone plot for residuals 507 513 if 'esiduals' in plot.title: -
src/sas/qtgui/Perspectives/Fitting/FittingLogic.py
r87dfca4 r3ae9179 132 132 self._data.ymax = ymax 133 133 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 """ 144 139 # Create the new plot 145 140 new_plot = Data1D(x=x, y=y) … … 150 145 151 146 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 + "]" 158 152 159 153 new_plot.title = new_plot.name … … 162 156 163 157 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) 164 172 165 173 def new2DPlot(self, return_data): … … 205 213 return new_plot 206 214 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 207 236 def computeDataRange(self): 208 237 """ -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
ra2cc8b97 r3ae9179 2113 2113 self.updateModelIndex(fitted_data) 2114 2114 else: 2115 name = self.nameForFittedData(self.kernel_module.id) 2115 if not fitted_data.name: 2116 name = self.nameForFittedData(self.kernel_module.id) 2117 else: 2118 name = fitted_data.name 2116 2119 fitted_data.title = name 2117 fitted_data.name = name2118 2120 fitted_data.filename = name 2119 2121 fitted_data.symbol = "Line" … … 2229 2231 self.model_data = fitted_data 2230 2232 2233 # Create plots for intermediate product data 2234 pq_data, sq_data = self.logic.new1DProductPlots(return_data, self.tab_id) 2235 if pq_data is not None and sq_data is not None: 2236 self.createNewIndex(pq_data) 2237 self.createNewIndex(sq_data) 2238 2231 2239 def complete2D(self, return_data): 2232 2240 """ -
src/sas/qtgui/Perspectives/Fitting/ModelThread.py
rd4dac80 r3ae9179 222 222 s_model = self.model.s_model 223 223 p_model = self.model.p_model 224 elif hasattr(self.model, "get_composition_models"): 225 p_model, s_model = self.model.get_composition_models() 226 227 if p_model is not None and s_model is not None: 228 sq_values = numpy.zeros((len(self.data.x))) 229 pq_values = numpy.zeros((len(self.data.x))) 230 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 231 pq_values[index] = p_model.evalDistribution(self.data.x[index]) 224 elif hasattr(self.model, "calc_composition_models"): 225 results = self.model.calc_composition_models(self.data.x[index]) 226 if results is not None: 227 pq_values, sq_values = results 228 229 if pq_values is None or sq_values is None: 230 if p_model is not None and s_model is not None: 231 sq_values = numpy.zeros((len(self.data.x))) 232 pq_values = numpy.zeros((len(self.data.x))) 233 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 234 pq_values[index] = p_model.evalDistribution(self.data.x[index]) 232 235 233 236 elapsed = time.time() - self.starttime … … 243 246 self.data, 244 247 self.update_chisqr, 245 self.source) 248 self.source, 249 unsmeared_output, unsmeared_data, unsmeared_error, 250 pq_values, sq_values) 246 251 else: 247 252 self.complete(x=self.data.x[index], y=output[index],
Note: See TracChangeset
for help on using the changeset viewer.