Changeset dfb58f8 in sasview


Ignore:
Timestamp:
May 23, 2008 10:56:21 AM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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
Message:

Add a couple of figures of merit (GUI)

Location:
prview/perspectives/pr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/inversion_panel.py

    r119a11d rdfb58f8  
    105105     
    106106    # Figure of merit parameters [default] 
     107     
     108    ## Oscillation parameters (sin function = 1.1) 
    107109    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 
    108116     
    109117    def __init__(self, parent, id = -1, plots = None, **kwargs): 
     
    127135        self.qmin_ctl = None 
    128136        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  
    129143         
    130144        ## Estimates 
     
    156170        elif name=='oscillation': 
    157171            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) 
    158176        elif name=='alpha_estimate': 
    159177            self.alpha_estimate_ctl.SetToolTipString("Click to accept value.") 
     
    189207        elif name=='oscillation': 
    190208            self.osc_ctl.GetValue() 
     209        elif name=='pos': 
     210            self.pos_ctl.GetValue() 
     211        elif name=='pos_err': 
     212            self.pos_err_ctl.GetValue() 
    191213        elif name=='alpha_estimate': 
    192214            self.alpha_estimate_ctl.GetValue() 
     
    330352        label_chi2 = wx.StaticText(self, -1, "Chi2/dof") 
    331353        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") 
    332356         
    333357        self.time_ctl = wx.TextCtrl(self, -1, size=(60,20)) 
     
    339363        self.chi2_ctl.SetToolTipString("Chi^2 over degrees of freedom.") 
    340364         
     365        # Oscillation parameter 
    341366        self.osc_ctl = wx.TextCtrl(self, -1, size=(60,20)) 
    342367        self.osc_ctl.SetEditable(False) 
    343368        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) 
    344383         
    345384        sizer_res = wx.GridBagSizer(5,5) 
     
    355394        sizer_res.Add(label_osc, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15) 
    356395        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) 
    357404 
    358405        ressizer.Add(sizer_res, 0) 
  • prview/perspectives/pr/pr.py

    r119a11d rdfb58f8  
    218218 
    219219        sum = 0.0 
     220        cov2 = numpy.ascontiguousarray(cov) 
     221         
    220222        for i in range(len(x)): 
    221             if cov==None: 
     223            if cov2==None: 
    222224                value = pr.pr(out, x[i]) 
    223225            else: 
    224                 (value, dy[i]) = pr.pr_err(out, cov, x[i]) 
     226                (value, dy[i]) = pr.pr_err(out, cov2, x[i]) 
    225227            sum += value 
    226228            y[i] = value 
     
    229231        dy = dy/sum*pr.d_max/len(x) 
    230232         
    231         if cov==None: 
     233        if cov2==None: 
    232234            new_plot = Theory1D(x, y) 
    233235        else: 
     
    337339            @param elapsed: time spent computing 
    338340        """ 
     341        from copy import deepcopy 
    339342        # Save useful info 
    340343        self.elapsed = elapsed 
    341344        message = "Computation completed in %g seconds [chi2=%g]" % (elapsed, pr.chi2) 
    342345        wx.PostEvent(self.parent, StatusEvent(status=message)) 
     346 
     347        cov = numpy.ascontiguousarray(cov) 
    343348 
    344349        # Show result on control panel 
     
    347352        self.control_panel.oscillation = pr.oscillations(out) 
    348353        #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) 
    350357         
    351358        for i in range(len(out)): 
     
    367374         
    368375        # 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 
    370377         
    371378        # Popup result panel 
  • prview/perspectives/pr/requirements.txt

    r119a11d rdfb58f8  
    222218. Clean up 
    232319. Replace help dialog text with a nice image. Mention how to choose alpha and what the suggested alpha means. 
     2420. If a figure of merit is clearly bad, put its background red 
Note: See TracChangeset for help on using the changeset viewer.