Changeset ca58654 in sasview


Ignore:
Timestamp:
Jan 19, 2012 2:47:10 PM (12 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:
e25d908
Parents:
4310dbb
Message:

set 2D z log scale from natural log to 10 log

File:
1 edited

Legend:

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

    r7434020 rca58654  
    117117    """ 
    118118    def __init__(self, parent, id=-1, xtransform=None, 
    119                   ytransform=None, scale='log',  
     119                  ytransform=None, scale='log_{10}',  
    120120                  color=None, dpi=None, **kwargs): 
    121121        """ 
     
    226226        # for 2D scale 
    227227        if scale != 'linear': 
    228             scale = 'log' 
     228            scale = 'log_{10}' 
    229229        self.scale = scale 
    230230        self.data = None 
     
    14021402        zmin_2D_temp = self.zmin_2D 
    14031403        zmax_2D_temp = self.zmax_2D 
    1404         if self.scale == 'log': 
     1404        if self.scale == 'log_{10}': 
    14051405            self.scale = 'linear' 
    14061406            if not self.zmin_2D is None: 
    1407                 zmin_2D_temp = math.exp(self.zmin_2D) 
     1407                zmin_2D_temp = math.pow(10, self.zmin_2D) 
    14081408            if not self.zmax_2D is None: 
    1409                 zmax_2D_temp = math.exp(self.zmax_2D) 
     1409                zmax_2D_temp = math.pow(10, self.zmax_2D) 
    14101410        else: 
    1411             self.scale = 'log' 
     1411            self.scale = 'log_{10}' 
    14121412            if not self.zmin_2D is None: 
    14131413                # min log value: no log(negative) 
     
    14151415                    zmin_2D_temp = -32 
    14161416                else: 
    1417                     zmin_2D_temp = math.log(self.zmin_2D) 
     1417                    zmin_2D_temp = math.log10(self.zmin_2D) 
    14181418            if not self.zmax_2D is None: 
    1419                 zmax_2D_temp = math.log(self.zmax_2D) 
     1419                zmax_2D_temp = math.log10(self.zmax_2D) 
    14201420                  
    14211421        self.image(data=self.data, qx_data=self.qx_data,  
     
    14501450            output = copy.deepcopy(self.data) 
    14511451        # check scale 
    1452         if self.scale == 'log': 
     1452        if self.scale == 'log_{10}': 
    14531453            try: 
    14541454                if  self.zmin_2D  <= 0  and  len(output[output > 0]) > 0: 
    14551455                    zmin_temp = self.zmin_2D  
    1456                     output[output>0] = numpy.log(output[output>0]) 
     1456                    output[output>0] = numpy.log10(output[output>0]) 
    14571457                    #In log scale Negative values are not correct in general 
    14581458                    #output[output<=0] = math.log(numpy.min(output[output>0])) 
     
    14631463                else:  
    14641464                    zmin_temp = self.zmin_2D 
    1465                     output[output>0] = numpy.log(output[output>0]) 
     1465                    output[output>0] = numpy.log10(output[output>0]) 
    14661466                    #In log scale Negative values are not correct in general 
    14671467                    #output[output<=0] = math.log(numpy.min(output[output>0])) 
     
    14791479            im = self.subplot.imshow(output, interpolation='nearest',  
    14801480                                     origin='lower', 
    1481                                      vmin=zmin_temp, vmax=self.zmax_2D, 
    1482                                      cmap=self.cmap,  
    1483                                      extent=(self.xmin_2D, self.xmax_2D, 
    1484                                                 self.ymin_2D, self.ymax_2D)) 
     1481                                     #vmin=zmin_temp, vmax=self.zmax_2D, 
     1482                                     cmap=self.cmap)#,  
     1483                                     #extent=(self.xmin_2D, self.xmax_2D, 
     1484                                     #           self.ymin_2D, self.ymax_2D)) 
    14851485            cbax = self.subplot.figure.add_axes([0.84,0.2,0.02,0.7]) 
    14861486        else: 
     
    15131513            cb =self.subplot.figure.colorbar(im, cax=cbax) 
    15141514        cb.update_bruteforce(im) 
    1515         cb.set_label(self.scale) 
     1515        cb.set_label('$' + self.scale + '$') 
    15161516         
    15171517        #if self.dimension != 3: 
Note: See TracChangeset for help on using the changeset viewer.