Changeset dfb58f8 in sasview
- Timestamp:
- May 23, 2008 8:56:21 AM (17 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f24b8f4
- Parents:
- 43c0a8e
- Location:
- prview/perspectives/pr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/inversion_panel.py
r119a11d rdfb58f8 105 105 106 106 # Figure of merit parameters [default] 107 108 ## Oscillation parameters (sin function = 1.1) 107 109 oscillation_max = 1.5 110 111 ## Fraction of P(r) that is positive 112 positive = 1.0 113 114 ## Fraction of P(r) that is greater than zero by more than 1 sigma 115 pos_err = 1.0 108 116 109 117 def __init__(self, parent, id = -1, plots = None, **kwargs): … … 127 135 self.qmin_ctl = None 128 136 self.qmax_ctl = None 137 138 # TextCtrl for fraction of positive P(r) 139 self.pos_ctl = None 140 141 # TextCtrl for fraction of 1 sigma positive P(r) 142 self.pos_err_ctl = None 129 143 130 144 ## Estimates … … 156 170 elif name=='oscillation': 157 171 self.osc_ctl.SetValue("%-5.2g" % value) 172 elif name=='positive': 173 self.pos_ctl.SetValue("%-5.2g" % value) 174 elif name=='pos_err': 175 self.pos_err_ctl.SetValue("%-5.2g" % value) 158 176 elif name=='alpha_estimate': 159 177 self.alpha_estimate_ctl.SetToolTipString("Click to accept value.") … … 189 207 elif name=='oscillation': 190 208 self.osc_ctl.GetValue() 209 elif name=='pos': 210 self.pos_ctl.GetValue() 211 elif name=='pos_err': 212 self.pos_err_ctl.GetValue() 191 213 elif name=='alpha_estimate': 192 214 self.alpha_estimate_ctl.GetValue() … … 330 352 label_chi2 = wx.StaticText(self, -1, "Chi2/dof") 331 353 label_osc = wx.StaticText(self, -1, "Oscillations") 354 label_pos = wx.StaticText(self, -1, "Positive fraction") 355 label_pos_err = wx.StaticText(self, -1, "1-sigma positive fraction") 332 356 333 357 self.time_ctl = wx.TextCtrl(self, -1, size=(60,20)) … … 339 363 self.chi2_ctl.SetToolTipString("Chi^2 over degrees of freedom.") 340 364 365 # Oscillation parameter 341 366 self.osc_ctl = wx.TextCtrl(self, -1, size=(60,20)) 342 367 self.osc_ctl.SetEditable(False) 343 368 self.osc_ctl.SetToolTipString("Oscillation parameter. P(r) for a sphere has an oscillation parameter of 1.1.") 369 370 # Positive fraction figure of merit 371 self.pos_ctl = wx.TextCtrl(self, -1, size=(60,20)) 372 self.pos_ctl.SetEditable(False) 373 self.pos_ctl.SetToolTipString("Fraction of P(r) that is positive. Theoretically, P(r) is defined positive.") 374 375 # 1-simga positive fraction figure of merit 376 self.pos_err_ctl = wx.TextCtrl(self, -1, size=(60,20)) 377 self.pos_err_ctl.SetEditable(False) 378 message = "Fraction of P(r) that is at least 1 standard deviation greater than zero.\n" 379 message += "This figure of merit tells you about the size of the P(r) errors.\n" 380 message += "If it is close to 1 and the other figures of merit are bad, consider changing " 381 message += "the maximum distance." 382 self.pos_err_ctl.SetToolTipString(message) 344 383 345 384 sizer_res = wx.GridBagSizer(5,5) … … 355 394 sizer_res.Add(label_osc, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15) 356 395 sizer_res.Add(self.osc_ctl, (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15) 396 397 iy += 1 398 sizer_res.Add(label_pos, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15) 399 sizer_res.Add(self.pos_ctl, (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15) 400 401 iy += 1 402 sizer_res.Add(label_pos_err, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15) 403 sizer_res.Add(self.pos_err_ctl, (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15) 357 404 358 405 ressizer.Add(sizer_res, 0) -
prview/perspectives/pr/pr.py
r119a11d rdfb58f8 218 218 219 219 sum = 0.0 220 cov2 = numpy.ascontiguousarray(cov) 221 220 222 for i in range(len(x)): 221 if cov ==None:223 if cov2==None: 222 224 value = pr.pr(out, x[i]) 223 225 else: 224 (value, dy[i]) = pr.pr_err(out, cov , x[i])226 (value, dy[i]) = pr.pr_err(out, cov2, x[i]) 225 227 sum += value 226 228 y[i] = value … … 229 231 dy = dy/sum*pr.d_max/len(x) 230 232 231 if cov ==None:233 if cov2==None: 232 234 new_plot = Theory1D(x, y) 233 235 else: … … 337 339 @param elapsed: time spent computing 338 340 """ 341 from copy import deepcopy 339 342 # Save useful info 340 343 self.elapsed = elapsed 341 344 message = "Computation completed in %g seconds [chi2=%g]" % (elapsed, pr.chi2) 342 345 wx.PostEvent(self.parent, StatusEvent(status=message)) 346 347 cov = numpy.ascontiguousarray(cov) 343 348 344 349 # Show result on control panel … … 347 352 self.control_panel.oscillation = pr.oscillations(out) 348 353 #print "OSCILL", pr.oscillations(out) 349 print "PEAKS:", pr.get_peaks(out) 354 print "PEAKS:", pr.get_peaks(out) 355 self.control_panel.positive = pr.get_positive(out) 356 self.control_panel.pos_err = pr.get_pos_err(out, cov) 350 357 351 358 for i in range(len(out)): … … 367 374 368 375 # Show P(r) fit 369 x_values, x_range = self.show_pr(out, self.pr )376 x_values, x_range = self.show_pr(out, self.pr, cov) 370 377 371 378 # Popup result panel -
prview/perspectives/pr/requirements.txt
r119a11d rdfb58f8 22 22 18. Clean up 23 23 19. Replace help dialog text with a nice image. Mention how to choose alpha and what the suggested alpha means. 24 20. If a figure of merit is clearly bad, put its background red
Note: See TracChangeset
for help on using the changeset viewer.