Changeset 2365c0b in sasview for plottools


Ignore:
Timestamp:
Dec 29, 2011 4:57:07 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
176fbf1
Parents:
aba60f4
Message:

added x4 scale and fixed a problem in plotting with scaled

Location:
plottools/src/danse/common/plottools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plottools/src/danse/common/plottools/PlotPanel.py

    r2371363 r2365c0b  
    16001600                xunits = convertUnit(2,xunits)  
    16011601                self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits) 
     1602            if(self.xLabel == "x^(4)"): 
     1603                item.transformX(transform.toX4, transform.errToX4) 
     1604                xunits = convertUnit(4,xunits)  
     1605                self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits) 
    16021606            if(self.xLabel == "ln(x)"): 
    16031607                item.transformX(transform.toLogX,transform.errToLogX) 
  • plottools/src/danse/common/plottools/PropertyDialog.py

    r82a54b8 r2365c0b  
    5959        self.xvalue.Insert("x", 0) 
    6060        self.xvalue.Insert("x^(2)", 1) 
    61         self.xvalue.Insert("ln(x)", 2) 
    62         self.xvalue.Insert("log10(x)", 3) 
     61        self.xvalue.Insert("x^(4)", 2) 
     62        self.xvalue.Insert("ln(x)", 3) 
     63        self.xvalue.Insert("log10(x)", 4) 
    6364         
    6465        # scale value for y 
  • plottools/src/danse/common/plottools/transform.py

    r82a54b8 r2365c0b  
    4949    else: 
    5050        return math.sqrt(x) 
    51       
     51 
     52def toX4(x, y=None): 
     53    """ 
     54    This function is used to load value on Plottable.View 
     55     
     56    Calculate x^(4) 
     57     
     58    :param x: float value 
     59     
     60    """ 
     61    return x * x * x * x 
     62 
     63def fromX4(x, y=None): 
     64    """ 
     65    This function is used to load value on Plottable.View 
     66    Calculate square root of x 
     67      
     68    :param x: float value 
     69      
     70    """ 
     71    if not x >= 0 : 
     72        raise ValueError, "double square root of a negative value " 
     73    else: 
     74        return math.sqrt(math.sqrt(x)) 
     75          
    5276def toLogX(x, y=None): 
    5377    """ 
     
    163187        msg = "transform.errFromX2: can't compute error of negative x" 
    164188        raise ValueError, msg 
    165      
     189 
     190def errToX4(x, y=None, dx=None, dy=None): 
     191    """ 
     192    calculate error of x**4 
     193     
     194    :param x: float value 
     195    :param dx: float value 
     196     
     197    """ 
     198    if  dx != None: 
     199        err = 4 * math.pow(x, 3) * dx 
     200        return math.fabs(err) 
     201    else: 
     202        return 0.0 
     203     
     204def errFromX4(x, y=None, dx=None, dy=None): 
     205    """ 
     206    calculate error of x^1/4 
     207     
     208    :param x: float value 
     209    :param dx: float value 
     210     
     211    """ 
     212    if (x > 0): 
     213        if(dx != None): 
     214            err = dx/(4 * math.pow(x, 3/4)) 
     215        else: 
     216            err = 0 
     217        return math.fabs(err) 
     218    else: 
     219        msg = "transform.errFromX4: can't compute error of negative x" 
     220        raise ValueError, msg 
     221  
    166222def errToLog10X(x, y=None, dx=None, dy=None): 
    167223    """ 
Note: See TracChangeset for help on using the changeset viewer.