Changeset 9258c43c in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- Jun 3, 2018 6:33:35 AM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- 316b9c1
- Parents:
- de43192 (diff), 8b89396 (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. - git-author:
- Paul Butler <butlerpd@…> (06/03/18 06:33:35)
- git-committer:
- GitHub <noreply@…> (06/03/18 06:33:35)
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r47ace50 r9258c43c 180 180 *checked*\ . 181 181 182 Also note that the 'Fit Parameters' have been split into two sections: those183 which can be polydisperse (shape and orientation parameters) and those which are184 not (eg, scattering length densities).185 186 182 A model file generated by this option can be viewed and further modified using 187 183 the :ref:`Advanced_Plugin_Editor` . 188 184 189 **SasView version 4.2** made it possible to specify whether a plugin created with 190 the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor 191 S(Q). To do this, simply add one or other of the following lines under the *import* 192 statements. 185 Note that the New Plugin Model Feature currently does not allow for parameters 186 to be polydisperse. However they can be edited in the Advanced Editor. 187 188 189 **SasView version 4.2** made it possible to specify whether a plugin created 190 with the *New Plugin Model* dialog is actually a form factor P(Q) or a structure 191 factor S(Q). To do this, simply add one or other of the following lines under 192 the *import* statements. 193 193 194 194 For a form factor:: … … 200 200 structure_factor = True 201 201 202 If the plugin is a structure factor it is *also* necessary to add two variables to203 t he parameter list::202 If the plugin is a structure factor it is *also* necessary to add two variables 203 to the parameter list:: 204 204 205 205 parameters = [ -
src/sas/sasgui/perspectives/fitting/basepage.py
r1f4d708 rc192960 641 641 # get the strings for report 642 642 report_str, text_str = self.state.report(fig_urls=refs) 643 644 643 # Show the dialog 645 644 report_list = [report_str, text_str, images] 646 dialog = ReportDialog(report_list, None, wx.ID_ANY, "")645 dialog = ReportDialog(report_list, imgRAM, refs, None, wx.ID_ANY, "") 647 646 dialog.Show() 648 647 … … 677 676 refs.append('memory:' + name) 678 677 imgRAM.AddFile(name, canvas.bitmap, wx.BITMAP_TYPE_PNG) 679 680 678 # append figs 681 679 images.append(fig) … … 1472 1470 # we need to check here ourselves. 1473 1471 if not is_modified: 1474 is_modified = (self._check_value_enter(self.fittable_param) 1475 or self._check_value_enter(self.fixed_param) 1476 or self._check_value_enter(self.parameters)) 1472 is_modified = self._check_value_enter(self.fittable_param) 1473 is_modified = self._check_value_enter( 1474 self.fixed_param) or is_modified 1475 is_modified = self._check_value_enter( 1476 self.parameters) or is_modified 1477 1477 1478 1478 # Here we should check whether the boundaries have been modified. … … 1536 1536 data=[self.data]) 1537 1537 # Check the values 1538 is_modified = (self._check_value_enter(self.fittable_param)1539 or self._check_value_enter(self.fixed_param)1540 or self._check_value_enter(self.parameters))1538 is_modified = self._check_value_enter(self.fittable_param) 1539 is_modified = self._check_value_enter(self.fixed_param) or is_modified 1540 is_modified = self._check_value_enter(self.parameters) or is_modified 1541 1541 1542 1542 # If qmin and qmax have been modified, update qmin and qmax and … … 2324 2324 2325 2325 # Update value in model if it has changed 2326 if value != self.model.getParam(name): 2326 if (value != self.model.getParam(name) or 2327 (np.isnan(value) and np.isnan(self.model.getParam(name)))): 2327 2328 self.model.setParam(name, value) 2328 2329 is_modified = True -
src/sas/sasgui/perspectives/fitting/fitpage.py
rbfeb823 ra7c6f38 365 365 # StaticText for chi2, N(for fitting), Npts + Log/linear spacing 366 366 self.tcChi = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0) 367 self.tcChi.SetToolTipString("Chi2/ Npts(Fit)")367 self.tcChi.SetToolTipString("Chi2/DOF (DOF=Npts-Npar fitted)") 368 368 self.Npts_fit = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0) 369 369 self.Npts_fit.SetToolTipString( … … 391 391 self.points_sizer.Add(self.pointsbox) 392 392 393 box_description_1 = wx.StaticText(self, wx.ID_ANY, ' Chi2/Npts')393 box_description_1 = wx.StaticText(self, wx.ID_ANY, 'Reduced Chi2') 394 394 box_description_2 = wx.StaticText(self, wx.ID_ANY, 'Npts(Fit)') 395 395 -
src/sas/sasgui/perspectives/fitting/media/residuals_help.rst
r99ded31 r84ac3f1 27 27 28 28 $\chi^2$ is a statistical parameter that quantifies the differences between 29 an observed data set and an expected dataset (or 'theory'). 30 31 When showing the a model with the data, *SasView* displays this parameter 32 normalized to the number of data points, $N_\mathrm{pts}$ such that 29 an observed data set and an expected dataset (or 'theory') calculated as 33 30 34 31 .. math:: 35 32 36 \chi^2 _N37 = \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_\mathrm{pts}33 \chi^2 34 = \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] 38 35 39 When performing a fit, *SasView* instead displays the reduced $\chi^2_R$, 40 which takes into account the number of fitting parameters $N_\mathrm{par}$ 41 (to calculate the number of 'degrees of freedom'). This is computed as 36 Fitting typically minimizes the value of $\chi^2$. For assessing the quality of 37 the model and its "fit" however, *SasView* displays the traditional reduced 38 $\chi^2_R$ which normalizes this parameter by dividing it by the number of 39 degrees of freedom (or DOF). The DOF is the number of data points being 40 considered, $N_\mathrm{pts}$, reduced by the number of free (i.e. fitted) 41 parameters, $N_\mathrm{par}$. Note that model parameters that are kept fixed do 42 *not* contribute to the DOF (they are not "free"). This reduced value is then 43 given as 42 44 43 45 .. math:: … … 47 49 / [N_\mathrm{pts} - N_\mathrm{par}] 48 50 49 The normalized $\chi^2_N$ and the reduced $\chi^2_R$ are very close to each 50 other when $N_\mathrm{pts} \gg N_\mathrm{par}$. 51 Note that this means the displayed value will vary depending on the number of 52 parameters used in the fit. In particular, when doing a calculation without a 53 fit (e.g. manually changing a parameter) the DOF will now equal $N_\mathrm{pts}$ 54 and the $\chi^2_R$ will be the smallest possible for that combination of model, 55 data set, and set of parameter values. 56 57 When $N_\mathrm{pts} \gg N_\mathrm{par}$ as it should for proper fitting, the 58 value of the reduced $\chi^2_R$ will not change very much. 51 59 52 60 For a good fit, $\chi^2_R$ tends to 1. … … 90 98 | 2015-06-08 Steve King 91 99 | 2017-09-28 Paul Kienzle 100 | 2018-03-04 Paul Butler
Note: See TracChangeset
for help on using the changeset viewer.