- Timestamp:
- Sep 19, 2018 1:55:07 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:
- 42d79fc
- Parents:
- 68dc2873 (diff), fc5d2d7f (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:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
r144fe21 r9ce69ec 81 81 self.assertEqual(self.widget.ui.editMolecularFormula.styleSheet(), '') 82 82 self.assertEqual(self.widget.model.columnCount(), 1) 83 self.assertEqual(self.widget.model.rowCount(), 1 2)83 self.assertEqual(self.widget.model.rowCount(), 11) 84 84 self.assertEqual(self.widget.sizePolicy().Policy(), QtWidgets.QSizePolicy.Fixed) 85 85 86 86 def testSimpleEntry(self): 87 87 ''' Default compound calculations ''' 88 89 self.widget.show()90 88 91 89 self.widget.ui.editMassDensity.clear() … … 102 100 103 101 # Change mass density 104 self.widget.ui.edit Wavelength.clear()105 self.widget.ui.edit Wavelength.setText("666.0")102 self.widget.ui.editNeutronWavelength.clear() 103 self.widget.ui.editNeutronWavelength.setText("666.0") 106 104 107 105 # Send shift-tab to update the molar volume field … … 130 128 131 129 # Assure the mass density field is set 132 self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '43.4') 130 #self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '43.4') 131 self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '2.89') 133 132 134 133 # Reset the widget 135 134 self.widget.modelReset() 136 135 137 136 self.assertEqual(self.widget.ui.editMolecularFormula.text(), "H2O") 138 137 self.assertEqual(self.widget.ui.editMassDensity.text(), "1") -
src/sas/qtgui/MainWindow/DataExplorer.py
r855e7ad r9ce69ec 598 598 Forces display of charts for the given data set 599 599 """ 600 plot_to_show = data_list[0] 601 # passed plot is used ONLY to figure out its title, 602 # so all the charts related by it can be pulled from 603 # the data explorer indices. 604 filename = plot_to_show.filename 605 self.displayFile(filename=filename, is_data=plot_to_show.is_data, id=id) 600 # data_list = [QStandardItem, Data1D/Data2D] 601 plot_to_show = data_list[1] 602 plot_item = data_list[0] 603 604 # plots to show 605 new_plots = [] 606 607 # Check if this is merely a plot update 608 if self.updatePlot(plot_to_show): 609 return 610 611 # Residuals get their own plot 612 if plot_to_show.plot_role == Data1D.ROLE_RESIDUAL: 613 plot_to_show.yscale='linear' 614 self.plotData([(plot_item, plot_to_show)]) 615 elif plot_to_show.plot_role == Data1D.ROLE_DELETABLE: 616 # No plot 617 return 618 else: 619 # Plots with main data points on the same chart 620 # Get the main data plot 621 main_data = GuiUtils.dataFromItem(plot_item.parent()) 622 if main_data is None: 623 # Try the current item 624 main_data = GuiUtils.dataFromItem(plot_item) 625 if main_data is not None: 626 new_plots.append((plot_item, main_data)) 627 new_plots.append((plot_item, plot_to_show)) 628 629 if new_plots: 630 self.plotData(new_plots) 606 631 607 632 def addDataPlot2D(self, plot_set, item): … … 701 726 # old plot data 702 727 plot_id = str(self.cbgraph.currentText()) 703 704 assert plot_id in PlotHelper.currentPlots(), "No such plot: %s"%(plot_id) 728 try: 729 assert plot_id in PlotHelper.currentPlots(), "No such plot: %s"%(plot_id) 730 except: 731 return 705 732 706 733 old_plot = PlotHelper.plotById(plot_id) -
src/sas/qtgui/MainWindow/GuiManager.py
r768387e0 rfc5d2d7f 12 12 from twisted.internet import reactor 13 13 # General SAS imports 14 from sas import get_local_config, get_custom_config 14 15 from sas.qtgui.Utilities.ConnectionProxy import ConnectionProxy 15 16 from sas.qtgui.Utilities.SasviewLogger import setup_qt_logging … … 136 137 self.aboutWidget = AboutBox() 137 138 self.categoryManagerWidget = CategoryManager(self._parent, manager=self) 138 self.welcomePanel = WelcomePanel()139 139 self.grid_window = None 140 140 self._workspace.toolBar.setVisible(LocalConfig.TOOLBAR_SHOW) … … 241 241 perspective_width = perspective_size.width() 242 242 self._current_perspective.resize(perspective_width, workspace_height-10) 243 # Resize the mdi area to match the widget within244 subwindow.resize(subwindow.minimumSizeHint())245 243 246 244 self._current_perspective.show() … … 388 386 self.communicate.statusBarUpdateSignal.emit(msg) 389 387 390 def showWelcomeMessage(self):388 def actionWelcome(self): 391 389 """ Show the Welcome panel """ 390 self.welcomePanel = WelcomePanel() 392 391 self._workspace.workspace.addSubWindow(self.welcomePanel) 393 392 self.welcomePanel.show() 393 394 def showWelcomeMessage(self): 395 """ Show the Welcome panel, when required """ 396 # Assure the welcome screen is requested 397 show_welcome_widget = True 398 custom_config = get_custom_config() 399 if hasattr(custom_config, "WELCOME_PANEL_SHOW"): 400 if isinstance(custom_config.WELCOME_PANEL_SHOW, bool): 401 show_welcome_widget = custom_config.WELCOME_PANEL_SHOW 402 else: 403 logging.warning("WELCOME_PANEL_SHOW has invalid value in custom_config.py") 404 if show_welcome_widget: 405 self.actionWelcome() 394 406 395 407 def addCallbacks(self): … … 478 490 self._workspace.actionAcknowledge.triggered.connect(self.actionAcknowledge) 479 491 self._workspace.actionAbout.triggered.connect(self.actionAbout) 492 self._workspace.actionWelcomeWidget.triggered.connect(self.actionWelcome) 480 493 self._workspace.actionCheck_for_update.triggered.connect(self.actionCheck_for_update) 481 494 -
src/sas/qtgui/MainWindow/UI/MainWindowUI.ui
r768387e0 rfc5d2d7f 148 148 <addaction name="separator"/> 149 149 <addaction name="actionAbout"/> 150 <addaction name="actionWelcomeWidget"/> 151 <addaction name="separator"/> 150 152 <addaction name="actionCheck_for_update"/> 151 153 </widget> … … 558 560 </property> 559 561 </action> 562 <action name="actionWelcomeWidget"> 563 <property name="text"> 564 <string>Welcome to SasView</string> 565 </property> 566 </action> 560 567 </widget> 561 568 <resources/> -
src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py
raed0532 r305114c 13 13 import webbrowser 14 14 15 from sas.qtgui.Perspectives.Fitting import FittingUtilities 15 16 import sas.qtgui.Utilities.GuiUtils as GuiUtils 16 17 ALLOWED_OPERATORS = ['=','<','>','>=','<='] … … 32 33 self.operator = '=' 33 34 35 self.warning = self.lblWarning.text() 34 36 self.setupData() 37 self.setupSignals() 35 38 self.setupWidgets() 36 self.setupSignals()37 39 self.setupTooltip() 38 39 self.setFixedSize(self.minimumSizeHint())40 40 41 41 # Default focus is on OK … … 101 101 # Find out the signal source 102 102 source = self.sender().objectName() 103 param1 = self.cbParam1.currentText() 104 param2 = self.cbParam2.currentText() 103 105 if source == "cbParam1": 104 self.txtParam.setText(self.tab_names[0] + ":" + self.cbParam1.currentText())106 self.txtParam.setText(self.tab_names[0] + ":" + param1) 105 107 else: 106 self.txtConstraint.setText(self.tab_names[1] + "." + self.cbParam2.currentText()) 108 self.txtConstraint.setText(self.tab_names[1] + "." + param2) 109 # Check if any of the parameters are polydisperse 110 params_list = [param1, param2] 111 all_pars = [tab.model_parameters for tab in self.tabs] 112 is2Ds = [tab.is2D for tab in self.tabs] 113 txt = "" 114 for pars, is2D in zip(all_pars, is2Ds): 115 if any([FittingUtilities.isParamPolydisperse(p, pars, is2D) for p in params_list]): 116 # no parameters are pd - reset the text to not show the warning 117 txt = self.warning 118 self.lblWarning.setText(txt) 119 107 120 108 121 def onOperatorChange(self, index): -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r1a15ada r305114c 781 781 782 782 return output_string 783 784 def isParamPolydisperse(param_name, kernel_params, is2D=False): 785 """ 786 Simple lookup for polydispersity for the given param name 787 """ 788 parameters = kernel_params.form_volume_parameters 789 if is2D: 790 parameters += kernel_params.orientation_parameters 791 has_poly = False 792 for param in parameters: 793 if param.name==param_name and param.polydisperse: 794 has_poly = True 795 break 796 return has_poly 797 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r86d3207 r9ce69ec 649 649 # Create and display the widget for param1 and param2 650 650 mc_widget = MultiConstraint(self, params=params_list) 651 # Check if any of the parameters are polydisperse 652 if not np.any([FittingUtilities.isParamPolydisperse(p, self.model_parameters, is2D=self.is2D) for p in params_list]): 653 # no parameters are pd - reset the text to not show the warning 654 mc_widget.lblWarning.setText("") 651 655 if mc_widget.exec_() != QtWidgets.QDialog.Accepted: 652 656 return … … 1845 1849 # Show the chart if ready 1846 1850 data_to_show = self.data if self.data_is_loaded else self.model_data 1847 if data_to_show is not None: 1848 self.communicate.plotRequestedSignal.emit([data_to_show], self.tab_id) 1851 # Any models for this page 1852 current_index = self.all_data[self.data_index] 1853 plots = GuiUtils.plotsFromFilename(self.data.filename, current_index.model()) 1854 fitpage_name = "" if id is None else "M"+str(self.tab_id) 1855 # Has the fitted data been shown? 1856 data_shown = False 1857 #for plot in plots: 1858 for item, plot in plots.items(): 1859 if fitpage_name in plot.name: 1860 data_shown = True 1861 self.communicate.plotRequestedSignal.emit([item, plot], self.tab_id) 1862 if not data_shown: 1863 # fit+data has not been shown - show just data 1864 self.communicate.plotRequestedSignal.emit([item, data_to_show], self.tab_id) 1849 1865 1850 1866 def onOptionsUpdate(self): … … 2076 2092 self.kernel_module = self.models[model_name]() 2077 2093 2094 # Change the model name to a monicker 2095 self.kernel_module.name = self.modelName() 2096 2078 2097 # Explicitly add scale and background with default values 2079 2098 temp_undo_state = self.undo_supported … … 2108 2127 # Structure factor is the only selected model; build it and show all its params 2109 2128 self.kernel_module = self.models[structure_factor]() 2129 self.kernel_module.name = self.modelName() 2110 2130 s_params = self.kernel_module._model_info.parameters 2111 2131 s_params_orig = s_params … … 2118 2138 2119 2139 self.kernel_module = MultiplicationModel(p_kernel, s_kernel) 2140 # Modify the name to correspond to shown items 2141 self.kernel_module.name = self.modelName() 2120 2142 all_params = self.kernel_module._model_info.parameters.kernel_parameters 2121 2143 all_param_names = [param.name for param in all_params] … … 2423 2445 # Bring the GUI to normal state 2424 2446 self.enableInteractiveElements() 2425 2447 if return_data is None: 2448 self.calculateDataFailed("Results not available.") 2449 return 2426 2450 fitted_data = self.logic.new1DPlot(return_data, self.tab_id) 2427 2451 residuals = self.calculateResiduals(fitted_data) -
src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py
raed0532 r305114c 28 28 29 29 self.setupUi(self) 30 self.setFixedSize(self.minimumSizeHint())31 30 self.setModal(True) 32 31 self.params = params -
src/sas/qtgui/Perspectives/Fitting/UI/ComplexConstraintUI.ui
ra90c9c5 r1738173 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 406</width>10 <height>1 67</height>9 <width>367</width> 10 <height>199</height> 11 11 </rect> 12 12 </property> … … 21 21 </property> 22 22 <layout class="QGridLayout" name="gridLayout"> 23 <item row="1" column="0"> 24 <layout class="QHBoxLayout" name="horizontalLayout_2"> 25 <item> 26 <widget class="QLabel" name="txtParam"> 27 <property name="sizePolicy"> 28 <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> 29 <horstretch>0</horstretch> 30 <verstretch>0</verstretch> 31 </sizepolicy> 32 </property> 33 <property name="text"> 34 <string>param1</string> 35 </property> 36 </widget> 37 </item> 38 <item> 39 <widget class="QLabel" name="txtOperator"> 40 <property name="text"> 41 <string>=</string> 42 </property> 43 </widget> 44 </item> 45 <item> 46 <widget class="QLineEdit" name="txtConstraint"> 47 <property name="text"> 48 <string/> 49 </property> 50 </widget> 51 </item> 52 </layout> 53 </item> 23 54 <item row="0" column="0"> 24 55 <layout class="QHBoxLayout" name="horizontalLayout"> … … 98 129 </layout> 99 130 </item> 100 <item row="1" column="0">101 <spacer name="verticalSpacer">102 <property name="orientation">103 <enum>Qt::Vertical</enum>104 </property>105 <property name="sizeHint" stdset="0">106 <size>107 <width>20</width>108 <height>25</height>109 </size>110 </property>111 </spacer>112 </item>113 <item row="2" column="0">114 <layout class="QHBoxLayout" name="horizontalLayout_2">115 <item>116 <widget class="QLabel" name="txtParam">117 <property name="sizePolicy">118 <sizepolicy hsizetype="Minimum" vsizetype="Preferred">119 <horstretch>0</horstretch>120 <verstretch>0</verstretch>121 </sizepolicy>122 </property>123 <property name="text">124 <string>param1</string>125 </property>126 </widget>127 </item>128 <item>129 <widget class="QLabel" name="txtOperator">130 <property name="text">131 <string>=</string>132 </property>133 </widget>134 </item>135 <item>136 <widget class="QLineEdit" name="txtConstraint">137 <property name="text">138 <string/>139 </property>140 </widget>141 </item>142 </layout>143 </item>144 131 </layout> 145 132 </widget> 146 133 </item> 147 134 <item row="1" column="0"> 135 <widget class="QLabel" name="lblWarning"> 136 <property name="text"> 137 <string><html><head/><body><p><span style=" color:#ff0000;">Warning! Polydisperse parameter selected.<br/></span>Constraints involving polydisperse parameters only apply to<br/>starting values and are not re-applied during size or angle polydispersity<br/>integrations. To do so requires creating a custom model.</p></body></html></string> 138 </property> 139 </widget> 140 </item> 141 <item row="2" column="0"> 142 <spacer name="verticalSpacer_2"> 143 <property name="orientation"> 144 <enum>Qt::Vertical</enum> 145 </property> 146 <property name="sizeHint" stdset="0"> 147 <size> 148 <width>20</width> 149 <height>9</height> 150 </size> 151 </property> 152 </spacer> 153 </item> 154 <item row="3" column="0"> 148 155 <layout class="QHBoxLayout" name="horizontalLayout_3"> 149 156 <item> -
src/sas/qtgui/Perspectives/Fitting/UI/FittingWidgetUI.ui
rd686ff1 rfc5d2d7f 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 566</width>9 <width>651</width> 10 10 <height>646</height> 11 11 </rect> -
src/sas/qtgui/Perspectives/Fitting/UI/MultiConstraintUI.ui
ra90c9c5 r1738173 10 10 <x>0</x> 11 11 <y>0</y> 12 <width> 426</width>13 <height> 162</height>12 <width>369</width> 13 <height>201</height> 14 14 </rect> 15 15 </property> 16 16 <property name="sizePolicy"> 17 <sizepolicy hsizetype="Minimum" vsizetype="Minimum ">17 <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> 18 18 <horstretch>0</horstretch> 19 19 <verstretch>0</verstretch> … … 119 119 </item> 120 120 <item row="2" column="0"> 121 <widget class="QLabel" name="lblWarning"> 122 <property name="text"> 123 <string><html><head/><body><p><span style=" color:#ff0000;">Warning! Polydisperse parameter selected.<br/></span>Constraints involving polydisperse parameters only apply to<br/>starting values and are not re-applied during size or angle polydispersity<br/>integrations. To do so requires creating a custom model.</p></body></html></string> 124 </property> 125 </widget> 126 </item> 127 <item row="3" column="0"> 121 128 <spacer name="verticalSpacer"> 122 129 <property name="orientation"> … … 131 138 </spacer> 132 139 </item> 133 <item row=" 3" column="0">140 <item row="4" column="0"> 134 141 <layout class="QHBoxLayout" name="horizontalLayout_2"> 135 142 <item> -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
raed0532 r9ce69ec 233 233 234 234 plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) 235 #self.communicate.plotRequestedSignal.emit([item, plot], self.tab_id) 235 236 236 237 self._manager.filesWidget.plotData(plot_data) … … 347 348 extrapolated_data.name = title 348 349 extrapolated_data.title = title 350 extrapolated_data.style = "Line" 351 extrapolated_data.has_errors = False 352 extrapolated_data.plot_role = Data1D.ROLE_DEFAULT 349 353 350 354 # copy labels and units of axes for plotting … … 378 382 high_out_data.name = title 379 383 high_out_data.title = title 384 high_out_data.style = "Line" 385 high_out_data.has_errors = False 386 high_out_data.plot_role = Data1D.ROLE_DEFAULT 380 387 381 388 # copy labels and units of axes for plotting -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
r68dc2873 rd7adf97 572 572 self.prPlot.plot_role = Data1D.ROLE_RESIDUAL 573 573 GuiUtils.updateModelItemWithPlot(self._data, self.prPlot, title) 574 self.communicate.plotRequestedSignal.emit([self._data,self.prPlot], None) 574 575 if self.dataPlot is not None: 575 576 title = self.dataPlot.name 576 577 self.dataPlot.plot_role = Data1D.ROLE_DEFAULT 578 self.dataPlot.symbol = "Line" 579 self.dataPlot.show_errors = False 577 580 GuiUtils.updateModelItemWithPlot(self._data, self.dataPlot, title) 578 if self.dataPlot is not None or self.prPlot is not None: 579 self.communicate.plotRequestedSignal.emit([self.logic.data], None) 581 self.communicate.plotRequestedSignal.emit([self._data,self.dataPlot], None) 580 582 self.enableButtons() 581 583 -
src/sas/qtgui/Utilities/GuiUtils.py
ra54bbf2b r9ce69ec 567 567 The assumption - data stored in SasView standard, in child 0 568 568 """ 569 return item.child(0).data() 569 try: 570 data = item.child(0).data() 571 except AttributeError: 572 data = None 573 return data 570 574 571 575 def openLink(url): -
src/sas/qtgui/Perspectives/Inversion/DMaxExplorerWidget.py
rb0ba43e r9f2f713 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 … … 155 157 logger.error(msg) 156 158 157 plotter = self.model.item(W.VARIABLE).text() 158 y_label = y_unit = "" 159 plotter = self.dependentVariable.currentText() 159 160 x_label = "D_{max}" 160 161 x_unit = "A" … … 188 189 y_unit = "a.u." 189 190 190 data = Data1D( xs, ys)191 data = Data1D(plotable_xs, ys) 191 192 if self.hasPlot: 192 self.plot.removePlot( None)193 self.plot.removePlot(data.name) 193 194 self.hasPlot = True 194 195 data.title = plotter -
src/sas/qtgui/Perspectives/Inversion/InversionLogic.py
r6da860a r3c4f02e 111 111 new_plot.title = title 112 112 113 new_plot.symbol = 'Line' 114 new_plot.hide_error = True 115 113 116 return new_plot 114 117 -
src/sas/qtgui/Perspectives/Inversion/UI/DMaxExplorer.ui
r8f83719f rcfd61f2 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 394</width>10 <height> 426</height>9 <width>586</width> 10 <height>538</height> 11 11 </rect> 12 12 </property> … … 21 21 <property name="orientation"> 22 22 <enum>Qt::Vertical</enum> 23 </property>24 <property name="sizeHint" stdset="0">25 <size>26 <width>20</width>27 <height>305</height>28 </size>29 23 </property> 30 24 </spacer> -
src/sas/qtgui/Perspectives/Inversion/UI/TabbedInversionUI.ui
r72ecbdf2 r68dc2873 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 390</width>10 <height>4 09</height>9 <width>446</width> 10 <height>480</height> 11 11 </rect> 12 12 </property> … … 740 740 <widget class="QPushButton" name="calculateAllButton"> 741 741 <property name="enabled"> 742 <bool> true</bool>742 <bool>false</bool> 743 743 </property> 744 744 <property name="sizePolicy"> -
src/sas/qtgui/Plotting/Plotter.py
r5b144c6 rd0952de 84 84 if self.data.ytransform is None: 85 85 self.data.ytransform = 'log10(y)' 86 86 #Added condition to Dmax explorer from P(r) perspective 87 if self.data._xaxis == 'D_{max}': 88 self.xscale = 'linear' 87 89 # Transform data if required. 88 90 if transform and (self.data.xtransform is not None or self.data.ytransform is not None): -
src/sas/qtgui/Utilities/GridPanel.py
r3c6ecd9 r4fbf0db 54 54 # Fill in the table from input data 55 55 self.setupTable(widget=self.tblParams, data=output_data) 56 #TODO: This is not what was inteded to be. 56 57 if output_data is not None: 57 58 # Set a table tooltip describing the model 58 model_name = output_data[0][0].model.id59 model_name = list(output_data.keys())[0] 59 60 self.tabWidget.setTabToolTip(0, model_name) 60 61 … … 418 419 def __init__(self, parent = None, output_data=None): 419 420 420 super(BatchInversionOutputPanel, self).__init__(parent , output_data)421 super(BatchInversionOutputPanel, self).__init__(parent._parent, output_data) 421 422 _translate = QtCore.QCoreApplication.translate 422 423 self.setWindowTitle(_translate("GridPanelUI", "Batch P(r) Results")) 423 424 424 def setupTable(self, data):425 def setupTable(self, widget=None, data=None): 425 426 """ 426 427 Create tablewidget items and show them, based on params … … 433 434 'Calc. Time [sec]'] 434 435 436 if data is None: 437 return 435 438 keys = data.keys() 436 439 rows = len(keys) -
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.