Changeset 8e44d51 in sasview


Ignore:
Timestamp:
Apr 16, 2008 10:22:24 AM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
35891ce
Parents:
3aa7074
Message:

one more bug fixed

Location:
guitools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • guitools/PlotPanel.py

    rdfca3de r8e44d51  
    389389                self.graph.yaxis("%s%s" % (yname,xname),  "%s^{-1}%s^{-1}" % (yunits,xunits)) 
    390390                 
    391             if ( self.yscales =="ln(y*x^(2)"): 
    392                 item.transform_y( transform.toYX2 ,transform.ToYX2 ) 
     391            if ( self.yscales =="ln(y*x^(2))"): 
     392                item.transform_y( transform.toYX2 ,transform.errToLogYX2 ) 
    393393                self.set_yscale("linear") 
    394394                yname, yunits = item.get_yaxis() 
  • guitools/fitDialog.py

    r3aa7074 r8e44d51  
    4343        self.btClose =wx.Button(panel, wx.ID_CANCEL,'Close',size=(90, 30) ) 
    4444        self.static_line_1 = wx.StaticLine(panel, -1) 
     45         
    4546        ix = 0 
    4647        iy = 1 
    47          
    4848        sizer.Add(wx.StaticText(panel, -1, 'y = Ax +B'),(iy, ix),(1,1),\ 
    4949                   wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    50          
    5150        iy+=1 
    5251        sizer.Add(wx.StaticText(panel, -1, 'Param A'),(iy, ix),\ 
     
    5857        ix += 1 
    5958        sizer.Add(self.tcErrA, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    60         
    6159        iy += 1 
    6260        ix = 0 
     
    108106                  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    109107         
    110         
    111108        panel.SetSizer(sizer) 
    112109        self.SetSizer(vbox) 
    113110        self.Centre() 
     111         
    114112        # Receives the type of model for the fitting 
    115113        from LineModel import LineModel 
    116114        self.model  = LineModel() 
    117            
    118115           
    119116        #Display the fittings values 
     
    139136            self.PXmin.Disable() 
    140137            self.PXmax.Disable() 
    141         
    142          
     138     
    143139        # new data for the fit  
    144140        self.file_data1 = Theory1D(x=[], y=[], dy=None) 
     
    158154        #Check if the field of Fit Dialog contain values and use the x max and min of the user 
    159155        xmin,xmax = self._checkVal(self.FXmin.GetValue(),self.FXmax.GetValue()) 
    160         
    161156        #store the values of View in x,y, dx,dy 
    162157        x,y,dx,dy=self.plottable.returnValuesOfView() 
     
    167162        # makes transformation for y as a line to fit 
    168163        if x != []:  
    169              
    170164            xminView=self.floatTransform(xmin) 
    171165            xmaxView=self.floatTransform(xmax) 
     
    190184                    
    191185            #Find the fitting parameters 
    192             print "X", tempx 
    193             print "Y", tempy 
    194186            chisqr, out, cov = fittings.sansfit(self.model,  
    195187                            [self.cstA, self.cstB],tempx, tempy,tempdy,xminView,xmaxView) 
     
    211203            self.model.setParam('A', float(cstA)) 
    212204            self.model.setParam('B', float(cstB)) 
    213             print "this is constant A:",float(cstA) 
     205             
    214206            tempx = [] 
    215207            tempy = [] 
     
    241233            else:  
    242234                tempy.append(y_model) 
    243                  
    244              
    245             print "this max",xmax 
    246             print "this view xmax", xmaxView 
     235           
    247236            # Create new data plottable with result 
    248237            self.file_data1.x =[]  
     
    252241            self.file_data1.dx=None 
    253242            self.file_data1.dy=None 
    254             print "this is the min of data1",min(self.file_data1.x ) 
    255             print "this is the max of data1",max(self.file_data1.x ) 
    256243            #Load the view with the new values 
    257244            self.file_data1.reset_view() 
  • guitools/plottables.py

    r831149e r8e44d51  
    4040 
    4141# Support for ancient python versions 
     42import copy 
     43import numpy 
     44 
    4245if 'any' not in dir(__builtins__): 
    4346    def any(L): 
     
    434437                @param errfunc: function to apply to errors 
    435438            """ 
    436             import copy 
    437             import numpy 
     439             
    438440             
    439441            # Sanity check 
     
    483485                @param errfunc: function to apply to errors dy 
    484486            """ 
    485             import copy 
    486             import numpy 
    487487            # Sanity check 
    488488            has_x = False 
     
    589589    def changed(self): 
    590590        return False 
     591     
    591592    @classmethod 
    592593    def labels(cls, collection): 
     
    598599        return map 
    599600    
    600  
    601  
     601    
    602602class Fit1D(Plottable): 
    603603    """Fit plottable: composed of a data line plus a theory line.  This 
  • guitools/transform.py

    r831149e r8e44d51  
    8383    else: 
    8484        return math.log(x*y) 
    85 def errToLogYX4(x,y=None,dx=None,dy=None): 
    86     """ 
    87         error for ln(y*x^(4)) 
    88         @param x: float value 
    89     """ 
    90     if dx==None: 
    91         dx=0 
    92     if dy==None: 
    93         dy=0 
    94     err =math.sqrt((4*dx/x)**2 +(dy/y)**2) 
    95     if err >= math.fabs(x): 
    96         err =0.9*x 
    97     return err  
     85 
    9886def fromLogXY(self,x): 
    9987    """ 
     
    204192        if (dy == None): 
    205193            dy = 0 
    206         err = 4*(dx**2)/(x**2) + (dy**2)/(y**2) 
     194        err = (2*dx/x)**2 + (dy/y)**2 
    207195        if math.fabs(err) >= math.fabs(x): 
    208196            err =0.9*x 
     
    241229     
    242230    return math.fabs(err) 
     231def errToLogYX4(x,y=None,dx=None,dy=None): 
     232    """ 
     233        error for ln(y*x^(4)) 
     234        @param x: float value 
     235    """ 
     236    if dx==None: 
     237        dx=0 
     238    if dy==None: 
     239        dy=0 
     240    err =math.sqrt((4*dx/x)**2 +(dy/y)**2) 
     241    if err >= math.fabs(x): 
     242        err =0.9*x 
     243    return err  
    243244 
    244245            
Note: See TracChangeset for help on using the changeset viewer.