Changeset b7f7d3f in sasview for src/sas/qtgui/Perspectives/Fitting
- Timestamp:
- Aug 22, 2018 7:02:41 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:
- 54492dc
- Parents:
- f7d39c9 (diff), 0fe7e5b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
recfe6b6 r0fe7e5b 977 977 if category == CATEGORY_STRUCTURE: 978 978 model = None 979 980 # Reset parameters to fit 981 self.parameters_to_fit = None 982 self.has_error_column = False 983 self.has_poly_error_column = False 984 979 985 self.respondToModelStructure(model=model, structure_factor=structure) 980 986 … … 1650 1656 Take func and throw it inside the magnet model row loop 1651 1657 """ 1652 for row_i in range(self._m odel_model.rowCount()):1658 for row_i in range(self._magnet_model.rowCount()): 1653 1659 func(row_i) 1654 1660 … … 1662 1668 if self._magnet_model.rowCount() == 0: 1663 1669 return 1664 1665 def iterateOverMagnetModel(func):1666 """1667 Take func and throw it inside the magnet model row loop1668 """1669 for row_i in range(self._magnet_model.rowCount()):1670 func(row_i)1671 1670 1672 1671 def updateFittedValues(row): … … 2228 2227 """ 2229 2228 fitted_data = self.logic.new1DPlot(return_data, self.tab_id) 2230 self.calculateResiduals(fitted_data)2229 residuals = self.calculateResiduals(fitted_data) 2231 2230 self.model_data = fitted_data 2231 2232 new_plots = [fitted_data, residuals] 2232 2233 2233 2234 # Create plots for intermediate product data … … 2236 2237 pq_data.symbol = "Line" 2237 2238 self.createNewIndex(pq_data) 2239 new_plots.append(pq_data) 2238 2240 if sq_data is not None: 2239 2241 sq_data.symbol = "Line" 2240 2242 self.createNewIndex(sq_data) 2243 new_plots.append(sq_data) 2244 2245 if self.data_is_loaded: 2246 GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots) 2241 2247 2242 2248 def complete2D(self, return_data): … … 2274 2280 residuals_plot.id = "Residual " + residuals_plot.id 2275 2281 self.createNewIndex(residuals_plot) 2282 return residuals_plot 2276 2283 2277 2284 def onCategoriesChanged(self): -
src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
raed0532 rf7d39c9 146 146 """ 147 147 widget = self.widgetFromOption(option) 148 new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 149 else float(widget.text()) 150 self.config.values[self.current_fitter_id][option] = new_value 148 if widget is None: 149 return 150 try: 151 new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 152 else float(widget.text()) 153 self.config.values[self.current_fitter_id][option] = new_value 154 except ValueError: 155 # Don't update bumps if widget has bad data 156 self.reject 151 157 152 158 # Update the BUMPS singleton -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r04972ea rf7d39c9 335 335 gn = reference_data.y 336 336 en = dy[index][0] 337 338 # x values 339 x_current = current_data.x 340 x_reference = reference_data.x 341 337 342 # build residuals 338 343 residuals = Data1D() … … 340 345 y = (fn - gn)/en 341 346 residuals.y = -y 347 elif len(fn) > len(gn): 348 residuals.y = (fn - gn[1:len(fn)])/en 342 349 else: 343 # TODO: fix case where applying new data from file on top of existing model data344 350 try: 345 y = (fn - gn[index][0]) / en 351 y = numpy.zeros(len(current_data.y)) 352 begin = 0 353 for i, x_value in enumerate(x_reference): 354 if x_value in x_current: 355 begin = i 356 break 357 end = len(x_reference) 358 endl = 0 359 for i, x_value in enumerate(list(x_reference)[::-1]): 360 if x_value in x_current: 361 endl = i 362 break 363 # make sure we have correct lengths 364 assert len(x_current) == len(x_reference[begin:end-endl]) 365 366 y = (fn - gn[begin:end-endl])/en 346 367 residuals.y = y 347 368 except ValueError:
Note: See TracChangeset
for help on using the changeset viewer.