- Timestamp:
- Sep 13, 2018 9:59:29 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 9f2f713
- Parents:
- eeea6a3 (diff), 855e7ad (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
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r33b3e4d r855e7ad 574 574 new_plots = [] 575 575 for item, plot in plots.items(): 576 if self.updatePlot(plot) or filename not in plot.name: 576 if self.updatePlot(plot): 577 # Don't create plots which are already displayed 577 578 continue 578 579 # Don't plot intermediate results, e.g. P(Q), S(Q) … … 582 583 continue 583 584 # Don't include plots from different fitpages, but always include the original data 584 if fitpage_name in plot.name or filename == plot.name:585 if fitpage_name in plot.name or filename in plot.name or filename == plot.filename: 585 586 # Residuals get their own plot 586 587 if plot.plot_role == Data1D.ROLE_RESIDUAL: -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r6889ba2 r557fc498 1377 1377 self.communicate.statusBarUpdateSignal.emit('Fitting started...') 1378 1378 self.fit_started = True 1379 1379 1380 # Disable some elements 1380 self. setFittingStarted()1381 self.disableInteractiveElements() 1381 1382 1382 1383 def stopFit(self): … … 1387 1388 return 1388 1389 self.calc_fit.stop() 1389 #self.fit_started=False1390 1390 #re-enable the Fit button 1391 self. setFittingStopped()1391 self.enableInteractiveElements() 1392 1392 1393 1393 msg = "Fitting cancelled." … … 1403 1403 """ 1404 1404 """ 1405 self. setFittingStopped()1405 self.enableInteractiveElements() 1406 1406 msg = "Fitting failed with: "+ str(reason) 1407 1407 self.communicate.statusBarUpdateSignal.emit(msg) … … 1420 1420 """ 1421 1421 #re-enable the Fit button 1422 self. setFittingStopped()1422 self.enableInteractiveElements() 1423 1423 1424 1424 if len(result) == 0: … … 1492 1492 """ 1493 1493 #re-enable the Fit button 1494 self. setFittingStopped()1494 self.enableInteractiveElements() 1495 1495 1496 1496 if len(result) == 0: … … 2363 2363 weight = FittingUtilities.getWeight(data=data, is2d=self.is2D, flag=self.weighting) 2364 2364 2365 # Disable buttons/table 2366 self.disableInteractiveElements() 2365 2367 # Awful API to a backend method. 2366 2368 calc_thread = self.methodCalculateForData()(data=data, … … 2404 2406 Thread returned error 2405 2407 """ 2408 # Bring the GUI to normal state 2409 self.enableInteractiveElements() 2406 2410 print("Calculate Data failed with ", reason) 2407 2411 … … 2416 2420 Plot the current 1D data 2417 2421 """ 2422 # Bring the GUI to normal state 2423 self.enableInteractiveElements() 2424 2418 2425 fitted_data = self.logic.new1DPlot(return_data, self.tab_id) 2419 2426 residuals = self.calculateResiduals(fitted_data) … … 2445 2452 Plot the current 2D data 2446 2453 """ 2454 # Bring the GUI to normal state 2455 self.enableInteractiveElements() 2456 2447 2457 fitted_data = self.logic.new2DPlot(return_data) 2448 2458 residuals = self.calculateResiduals(fitted_data) … … 2515 2525 Thread threw an exception. 2516 2526 """ 2527 # Bring the GUI to normal state 2528 self.enableInteractiveElements() 2517 2529 # TODO: remimplement thread cancellation 2518 2530 logger.error("".join(traceback.format_exception(etype, value, tb))) … … 2892 2904 self.setMagneticModel() 2893 2905 2894 def setFittingStarted(self): 2895 """ 2896 Set buttion caption on fitting start 2906 def setInteractiveElements(self, enabled=True): 2907 """ 2908 Switch interactive GUI elements on/off 2909 """ 2910 assert isinstance(enabled, bool) 2911 2912 self.lstParams.setEnabled(enabled) 2913 self.lstPoly.setEnabled(enabled) 2914 self.lstMagnetic.setEnabled(enabled) 2915 2916 self.cbCategory.setEnabled(enabled) 2917 self.cbModel.setEnabled(enabled) 2918 self.cbStructureFactor.setEnabled(enabled) 2919 2920 self.chkPolydispersity.setEnabled(enabled) 2921 self.chkMagnetism.setEnabled(enabled) 2922 self.chk2DView.setEnabled(enabled) 2923 2924 def enableInteractiveElements(self): 2925 """ 2926 Set buttion caption on fitting/calculate finish 2927 Enable the param table(s) 2928 """ 2929 # Notify the user that fitting is available 2930 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 2931 self.cmdFit.setText("Fit") 2932 self.fit_started = False 2933 self.setInteractiveElements(True) 2934 2935 def disableInteractiveElements(self): 2936 """ 2937 Set buttion caption on fitting/calculate start 2938 Disable the param table(s) 2897 2939 """ 2898 2940 # Notify the user that fitting is being run … … 2900 2942 self.cmdFit.setStyleSheet('QPushButton {color: red;}') 2901 2943 self.cmdFit.setText('Stop fit') 2902 2903 def setFittingStopped(self): 2904 """ 2905 Set button caption on fitting stop 2906 """ 2907 # Notify the user that fitting is available 2908 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 2909 self.cmdFit.setText("Fit") 2910 self.fit_started = False 2944 self.setInteractiveElements(False) 2911 2945 2912 2946 def readFitPage(self, fp): -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
reeea6a3 r4b7d322 14 14 # pr inversion calculation elements 15 15 from sas.sascalc.pr.invertor import Invertor 16 from sas.qtgui.Plotting.PlotterData import Data1D 16 17 # Batch calculation display 17 18 from sas.qtgui.Utilities.GridPanel import BatchInversionOutputPanel … … 559 560 if self.prPlot is not None: 560 561 title = self.prPlot.name 562 self.prPlot.plot_role = Data1D.ROLE_RESIDUAL 561 563 GuiUtils.updateModelItemWithPlot(self._data, self.prPlot, title) 562 self.communicate.plotRequestedSignal.emit([self.prPlot], None)563 564 if self.dataPlot is not None: 564 565 title = self.dataPlot.name 566 self.dataPlot.plot_role = Data1D.ROLE_DEFAULT 565 567 GuiUtils.updateModelItemWithPlot(self._data, self.dataPlot, title) 566 self.communicate.plotRequestedSignal.emit([self.dataPlot], None) 568 if self.dataPlot is not None or self.prPlot is not None: 569 self.communicate.plotRequestedSignal.emit([self.logic.data], None) 567 570 self.enableButtons() 568 571 -
src/sas/qtgui/Perspectives/Inversion/DMaxExplorerWidget.py
rb0ba43e re908916 42 42 self.parent = parent 43 43 44 self.setWindowTitle("D ââExplorer")44 self.setWindowTitle("Dmax Explorer") 45 45 46 46 self.pr_state = pr_state … … 116 116 bck = [] 117 117 chi2 = [] 118 118 plotable_xs = [] #Introducing this to make sure size of x and y for plotting is the same.8 119 119 try: 120 120 dmin = float(self.model.item(W.DMIN).text()) … … 128 128 129 129 original = self.pr_state.d_max 130 130 131 for x in xs: 131 132 self.pr_state.d_max = x … … 140 141 bck.append(self.pr_state.background) 141 142 chi2.append(self.pr_state.chi2) 143 plotable_xs.append(x) 142 144 except Exception as ex: 143 145 # This inversion failed, skip this D_max value … … 188 190 y_unit = "a.u." 189 191 190 data = Data1D( xs, ys)192 data = Data1D(plotable_xs, ys) 191 193 if self.hasPlot: 192 194 self.plot.removePlot(None) -
src/sas/sascalc/pr/invertor.py
rb8080e1 reeea6a3 71 71 A[j][i] = (Fourier transformed base function for point j) 72 72 73 We the mchoose a number of r-points, n_r, to evaluate the second73 We then choose a number of r-points, n_r, to evaluate the second 74 74 derivative of P(r) at. This is used as our regularization term. 75 75 For a vector r of length n_r, the following n_r rows are set to :: … … 144 144 x, y, err, d_max, q_min, q_max and alpha 145 145 """ 146 if 146 if name == 'x': 147 147 if 0.0 in value: 148 148 msg = "Invertor: one of your q-values is zero. " … … 227 227 return None 228 228 229 def add_errors(self, yvalues): 230 """ 231 Adds errors to data set is they are not avaialble 232 :return: 233 """ 234 stats_errors = np.zeros(len(yvalues)) 235 for i in range(len(yvalues)): 236 # Scale the error so that we can fit over several decades of Q 237 scale = 0.05 * np.sqrt(yvalues[i]) 238 min_err = 0.01 * yvalues[i] 239 stats_errors[i] = scale * np.sqrt(np.fabs(yvalues[i])) + min_err 240 logger.warning("Simulated errors have been added to the data set\n") 241 return stats_errors 242 229 243 def clone(self): 230 244 """ … … 268 282 A[i][j] = (Fourier transformed base function for point j) 269 283 270 We the mchoose a number of r-points, n_r, to evaluate the second284 We then choose a number of r-points, n_r, to evaluate the second 271 285 derivative of P(r) at. This is used as our regularization term. 272 286 For a vector r of length n_r, the following n_r rows are set to ::
Note: See TracChangeset
for help on using the changeset viewer.