Changes in / [33d5956:30bed93] in sasview
- Location:
- src/sas/qtgui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r9ce69ec r9ce69ec 579 579 # Don't plot intermediate results, e.g. P(Q), S(Q) 580 580 match = GuiUtils.theory_plot_ID_pattern.match(plot.id) 581 # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 581 # 2nd match group contains the identifier for the intermediate 582 # result, if present (e.g. "[P(Q)]") 582 583 if match and match.groups()[1] != None: 583 584 continue 584 # Don't include plots from different fitpages, but always include the original data 585 if fitpage_name in plot.name or filename in plot.name or filename == plot.filename: 585 # Don't include plots from different fitpages, 586 # but always include the original data 587 if (fitpage_name in plot.name 588 or filename in plot.name 589 or filename == plot.filename): 586 590 # Residuals get their own plot 587 591 if plot.plot_role == Data1D.ROLE_RESIDUAL: -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r8faac15 r44deced 570 570 return residuals 571 571 572 def plotPolydispersities(model): 573 plots = [] 574 if model is None: 575 return plots 576 # test for model being a sasmodels.sasview_model.SasviewModel? 577 for name in model.dispersion.keys(): 578 xarr, yarr = model.get_weights(name) 579 if len(xarr) <= 1: # param name not found or no polydisp. 580 continue 581 # create Data1D as in residualsData1D() and fill x/y members 582 # similar to FittingLogic._create1DPlot() but different data/axes 583 data1d = Data1D(x=xarr, y=yarr) 584 xunit = model.details[name][0] 585 data1d.xaxis(r'\rm{{{}}}'.format(name.replace('_', '\_')), xunit) 586 data1d.yaxis(r'\rm{weight}', 'normalized') 587 data1d.scale = 'linear' 588 data1d.symbol = 'Line' 589 data1d.name = "{} polydispersity".format(name) 590 data1d.id = data1d.name # placeholder, has to be completed later 591 data1d.plot_role = Data1D.ROLE_RESIDUAL 592 plots.append(data1d) 593 return plots 594 572 595 def binary_encode(i, digits): 573 596 return [i >> d & 1 for d in range(digits)] -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r33d5956 rd8d81ea 58 58 DEFAULT_POLYDISP_FUNCTION = 'gaussian' 59 59 60 # CRUFT: remove when new release of sasmodels is available 61 # https://github.com/SasView/sasview/pull/181#discussion_r218135162 62 from sasmodels.sasview_model import SasviewModel 63 if not hasattr(SasviewModel, 'get_weights'): 64 def get_weights(self, name): 65 """ 66 Returns the polydispersity distribution for parameter *name* as *value* and *weight* arrays. 67 """ 68 # type: (str) -> Tuple(np.ndarray, np.ndarray) 69 _, x, w = self._get_weights(self._model_info.parameters[name]) 70 return x, w 71 72 SasviewModel.get_weights = get_weights 60 73 61 74 logger = logging.getLogger(__name__) … … 2488 2501 2489 2502 if self.data_is_loaded: 2490 # delete any plots associated with the data that were not updated (e.g. to remove beta(Q), S_eff(Q)) 2503 # delete any plots associated with the data that were not updated 2504 # (e.g. to remove beta(Q), S_eff(Q)) 2491 2505 GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots) 2492 2506 pass 2493 2507 else: 2494 # delete theory items for the model, in order to get rid of any redundant items, e.g. beta(Q), S_eff(Q) 2508 # delete theory items for the model, in order to get rid of any 2509 # redundant items, e.g. beta(Q), S_eff(Q) 2495 2510 self.communicate.deleteIntermediateTheoryPlotsSignal.emit(self.kernel_module.id) 2511 2512 # Create plots for parameters with enabled polydispersity 2513 for plot in FittingUtilities.plotPolydispersities(return_data.get('model', None)): 2514 data_id = fitted_data.id.split() 2515 plot.id = "{} [{}] {}".format(data_id[0], plot.name, " ".join(data_id[1:])) 2516 data_name = fitted_data.name.split() 2517 plot.name = " ".join([data_name[0], plot.name] + data_name[1:]) 2518 self.createNewIndex(plot) 2519 new_plots.append(plot) 2496 2520 2497 2521 # Create plots for intermediate product data
Note: See TracChangeset
for help on using the changeset viewer.