Ignore:
Timestamp:
Apr 4, 2017 12:50:04 PM (7 years ago)
Author:
Ricardo Ferraz Leal <ricleal@…>
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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
f2940c4
Parents:
463e7ffc (diff), 1779e72 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

After merge conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/plottools/PlotPanel.py

    r463e7ffc r9c0f3c17  
    2929DEFAULT_CMAP = pylab.cm.jet 
    3030import copy 
    31 import numpy 
     31import numpy as np 
    3232 
    3333from sas.sasgui.guiframe.events import StatusEvent 
     
    14541454                if  self.zmin_2D <= 0  and len(output[output > 0]) > 0: 
    14551455                    zmin_temp = self.zmin_2D 
    1456                     output[output > 0] = numpy.log10(output[output > 0]) 
     1456                    output[output > 0] = np.log10(output[output > 0]) 
    14571457                    #In log scale Negative values are not correct in general 
    1458                     #output[output<=0] = math.log(numpy.min(output[output>0])) 
     1458                    #output[output<=0] = math.log(np.min(output[output>0])) 
    14591459                elif self.zmin_2D <= 0: 
    14601460                    zmin_temp = self.zmin_2D 
    1461                     output[output > 0] = numpy.zeros(len(output)) 
     1461                    output[output > 0] = np.zeros(len(output)) 
    14621462                    output[output <= 0] = -32 
    14631463                else: 
    14641464                    zmin_temp = self.zmin_2D 
    1465                     output[output > 0] = numpy.log10(output[output > 0]) 
     1465                    output[output > 0] = np.log10(output[output > 0]) 
    14661466                    #In log scale Negative values are not correct in general 
    1467                     #output[output<=0] = math.log(numpy.min(output[output>0])) 
     1467                    #output[output<=0] = math.log(np.min(output[output>0])) 
    14681468            except: 
    14691469                #Too many problems in 2D plot with scale 
     
    14941494            X = self.x_bins[0:-1] 
    14951495            Y = self.y_bins[0:-1] 
    1496             X, Y = numpy.meshgrid(X, Y) 
     1496            X, Y = np.meshgrid(X, Y) 
    14971497 
    14981498            try: 
     
    15571557        # 1d array to use for weighting the data point averaging 
    15581558        #when they fall into a same bin. 
    1559         weights_data = numpy.ones([self.data.size]) 
     1559        weights_data = np.ones([self.data.size]) 
    15601560        # get histogram of ones w/len(data); this will provide 
    15611561        #the weights of data on each bins 
    1562         weights, xedges, yedges = numpy.histogram2d(x=self.qy_data, 
     1562        weights, xedges, yedges = np.histogram2d(x=self.qy_data, 
    15631563                                                    y=self.qx_data, 
    15641564                                                    bins=[self.y_bins, self.x_bins], 
    15651565                                                    weights=weights_data) 
    15661566        # get histogram of data, all points into a bin in a way of summing 
    1567         image, xedges, yedges = numpy.histogram2d(x=self.qy_data, 
     1567        image, xedges, yedges = np.histogram2d(x=self.qy_data, 
    15681568                                                  y=self.qx_data, 
    15691569                                                  bins=[self.y_bins, self.x_bins], 
     
    15831583        # do while loop until all vacant bins are filled up up 
    15841584        #to loop = max_loop 
    1585         while not(numpy.isfinite(image[weights == 0])).all(): 
     1585        while not(np.isfinite(image[weights == 0])).all(): 
    15861586            if loop >= max_loop:  # this protects never-ending loop 
    15871587                break 
     
    16321632 
    16331633        # store x and y bin centers in q space 
    1634         x_bins = numpy.linspace(xmin, xmax, npix_x) 
    1635         y_bins = numpy.linspace(ymin, ymax, npix_y) 
     1634        x_bins = np.linspace(xmin, xmax, npix_x) 
     1635        y_bins = np.linspace(ymin, ymax, npix_y) 
    16361636 
    16371637        #set x_bins and y_bins 
     
    16521652        """ 
    16531653        # No image matrix given 
    1654         if image == None or numpy.ndim(image) != 2 \ 
    1655                 or numpy.isfinite(image).all() \ 
     1654        if image == None or np.ndim(image) != 2 \ 
     1655                or np.isfinite(image).all() \ 
    16561656                or weights == None: 
    16571657            return image 
     
    16591659        len_y = len(image) 
    16601660        len_x = len(image[1]) 
    1661         temp_image = numpy.zeros([len_y, len_x]) 
    1662         weit = numpy.zeros([len_y, len_x]) 
     1661        temp_image = np.zeros([len_y, len_x]) 
     1662        weit = np.zeros([len_y, len_x]) 
    16631663        # do for-loop for all pixels 
    16641664        for n_y in range(len(image)): 
    16651665            for n_x in range(len(image[1])): 
    16661666                # find only null pixels 
    1667                 if weights[n_y][n_x] > 0 or numpy.isfinite(image[n_y][n_x]): 
     1667                if weights[n_y][n_x] > 0 or np.isfinite(image[n_y][n_x]): 
    16681668                    continue 
    16691669                else: 
    16701670                    # find 4 nearest neighbors 
    16711671                    # check where or not it is at the corner 
    1672                     if n_y != 0 and numpy.isfinite(image[n_y - 1][n_x]): 
     1672                    if n_y != 0 and np.isfinite(image[n_y - 1][n_x]): 
    16731673                        temp_image[n_y][n_x] += image[n_y - 1][n_x] 
    16741674                        weit[n_y][n_x] += 1 
    1675                     if n_x != 0 and numpy.isfinite(image[n_y][n_x - 1]): 
     1675                    if n_x != 0 and np.isfinite(image[n_y][n_x - 1]): 
    16761676                        temp_image[n_y][n_x] += image[n_y][n_x - 1] 
    16771677                        weit[n_y][n_x] += 1 
    1678                     if n_y != len_y - 1 and numpy.isfinite(image[n_y + 1][n_x]): 
     1678                    if n_y != len_y - 1 and np.isfinite(image[n_y + 1][n_x]): 
    16791679                        temp_image[n_y][n_x] += image[n_y + 1][n_x] 
    16801680                        weit[n_y][n_x] += 1 
    1681                     if n_x != len_x - 1 and numpy.isfinite(image[n_y][n_x + 1]): 
     1681                    if n_x != len_x - 1 and np.isfinite(image[n_y][n_x + 1]): 
    16821682                        temp_image[n_y][n_x] += image[n_y][n_x + 1] 
    16831683                        weit[n_y][n_x] += 1 
    16841684                    # go 4 next nearest neighbors when no non-zero 
    16851685                    # neighbor exists 
    1686                     if n_y != 0 and n_x != 0 and\ 
    1687                          numpy.isfinite(image[n_y - 1][n_x - 1]): 
     1686                    if n_y != 0 and n_x != 0 and \ 
     1687                            np.isfinite(image[n_y - 1][n_x - 1]): 
    16881688                        temp_image[n_y][n_x] += image[n_y - 1][n_x - 1] 
    16891689                        weit[n_y][n_x] += 1 
    16901690                    if n_y != len_y - 1 and n_x != 0 and \ 
    1691                         numpy.isfinite(image[n_y + 1][n_x - 1]): 
     1691                            np.isfinite(image[n_y + 1][n_x - 1]): 
    16921692                        temp_image[n_y][n_x] += image[n_y + 1][n_x - 1] 
    16931693                        weit[n_y][n_x] += 1 
    16941694                    if n_y != len_y and n_x != len_x - 1 and \ 
    1695                         numpy.isfinite(image[n_y - 1][n_x + 1]): 
     1695                            np.isfinite(image[n_y - 1][n_x + 1]): 
    16961696                        temp_image[n_y][n_x] += image[n_y - 1][n_x + 1] 
    16971697                        weit[n_y][n_x] += 1 
    16981698                    if n_y != len_y - 1 and n_x != len_x - 1 and \ 
    1699                         numpy.isfinite(image[n_y + 1][n_x + 1]): 
     1699                            np.isfinite(image[n_y + 1][n_x + 1]): 
    17001700                        temp_image[n_y][n_x] += image[n_y + 1][n_x + 1] 
    17011701                        weit[n_y][n_x] += 1 
Note: See TracChangeset for help on using the changeset viewer.