Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py

    r9a5097c r463e7ffc  
    77import sys 
    88import os 
    9 import numpy as np 
     9import numpy 
    1010#import math 
    1111import wx.aui as aui 
     
    3838from sas.sasgui.guiframe.events import NewPlotEvent 
    3939from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     40 
     41logger = logging.getLogger(__name__) 
    4042 
    4143_BOX_WIDTH = 76 
     
    699701                ax = Axes3D(panel.figure) 
    700702            except: 
    701                 logging.error("PlotPanel could not import Axes3D") 
     703                logger.error("PlotPanel could not import Axes3D") 
    702704                raise 
    703705        panel.dimension = 3 
     
    741743            marker = 'o' 
    742744            m_size = 3.5 
    743         sld_tot = (np.fabs(sld_mx) + np.fabs(sld_my) + \ 
    744                    np.fabs(sld_mz) + np.fabs(output.sld_n)) 
     745        sld_tot = (numpy.fabs(sld_mx) + numpy.fabs(sld_my) + \ 
     746                   numpy.fabs(sld_mz) + numpy.fabs(output.sld_n)) 
    745747        is_nonzero = sld_tot > 0.0 
    746748        is_zero = sld_tot == 0.0 
     
    757759            pix_symbol = output.pix_symbol[is_nonzero] 
    758760        # II. Plot selective points in color 
    759         other_color = np.ones(len(pix_symbol), dtype='bool') 
     761        other_color = numpy.ones(len(pix_symbol), dtype='bool') 
    760762        for key in color_dic.keys(): 
    761763            chosen_color = pix_symbol == key 
    762             if np.any(chosen_color): 
     764            if numpy.any(chosen_color): 
    763765                other_color = other_color & (chosen_color != True) 
    764766                color = color_dic[key] 
     
    767769                        markeredgecolor=color, markersize=m_size, label=key) 
    768770        # III. Plot All others         
    769         if np.any(other_color): 
     771        if numpy.any(other_color): 
    770772            a_name = '' 
    771773            if output.pix_type == 'atom': 
     
    795797                draw magnetic vectors w/arrow 
    796798                """ 
    797                 max_mx = max(np.fabs(sld_mx)) 
    798                 max_my = max(np.fabs(sld_my)) 
    799                 max_mz = max(np.fabs(sld_mz)) 
     799                max_mx = max(numpy.fabs(sld_mx)) 
     800                max_my = max(numpy.fabs(sld_my)) 
     801                max_mz = max(numpy.fabs(sld_mz)) 
    800802                max_m = max(max_mx, max_my, max_mz) 
    801803                try: 
     
    812814                        unit_z2 = sld_mz / max_m 
    813815                        # 0.8 is for avoiding the color becomes white=(1,1,1)) 
    814                         color_x = np.fabs(unit_x2 * 0.8) 
    815                         color_y = np.fabs(unit_y2 * 0.8) 
    816                         color_z = np.fabs(unit_z2 * 0.8) 
     816                        color_x = numpy.fabs(unit_x2 * 0.8) 
     817                        color_y = numpy.fabs(unit_y2 * 0.8) 
     818                        color_z = numpy.fabs(unit_z2 * 0.8) 
    817819                        x2 = pos_x + unit_x2 * max_step 
    818820                        y2 = pos_y + unit_y2 * max_step 
    819821                        z2 = pos_z + unit_z2 * max_step 
    820                         x_arrow = np.column_stack((pos_x, x2)) 
    821                         y_arrow = np.column_stack((pos_y, y2)) 
    822                         z_arrow = np.column_stack((pos_z, z2)) 
    823                         colors = np.column_stack((color_x, color_y, color_z)) 
     822                        x_arrow = numpy.column_stack((pos_x, x2)) 
     823                        y_arrow = numpy.column_stack((pos_y, y2)) 
     824                        z_arrow = numpy.column_stack((pos_z, z2)) 
     825                        colors = numpy.column_stack((color_x, color_y, color_z)) 
    824826                        arrows = Arrow3D(panel, x_arrow, z_arrow, y_arrow, 
    825827                                        colors, mutation_scale=10, lw=1, 
     
    880882            if self.is_avg or self.is_avg == None: 
    881883                self._create_default_1d_data() 
    882                 i_out = np.zeros(len(self.data.y)) 
     884                i_out = numpy.zeros(len(self.data.y)) 
    883885                inputs = [self.data.x, [], i_out] 
    884886            else: 
    885887                self._create_default_2d_data() 
    886                 i_out = np.zeros(len(self.data.data)) 
     888                i_out = numpy.zeros(len(self.data.data)) 
    887889                inputs = [self.data.qx_data, self.data.qy_data, i_out] 
    888890 
     
    989991        :Param input: input list [qx_data, qy_data, i_out] 
    990992        """ 
    991         out = np.empty(0) 
     993        out = numpy.empty(0) 
    992994        #s = time.time() 
    993995        for ind in range(len(input[0])): 
     
    9981000                inputi = [input[0][ind:ind + 1], [], input[2][ind:ind + 1]] 
    9991001                outi = self.model.run(inputi) 
    1000                 out = np.append(out, outi) 
     1002                out = numpy.append(out, outi) 
    10011003            else: 
    10021004                if ind % 50 == 0  and update != None: 
     
    10061008                          input[2][ind:ind + 1]] 
    10071009                outi = self.model.runXY(inputi) 
    1008                 out = np.append(out, outi) 
     1010                out = numpy.append(out, outi) 
    10091011        #print time.time() - s 
    10101012        if self.is_avg or self.is_avg == None: 
     
    10271029        self.npts_x = int(float(self.npt_ctl.GetValue())) 
    10281030        self.data = Data2D() 
    1029         qmax = self.qmax_x #/ np.sqrt(2) 
     1031        qmax = self.qmax_x #/ numpy.sqrt(2) 
    10301032        self.data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 
    10311033        self.data.yaxis('\\rm{Q_{y}}', '\AA^{-1}') 
     
    10481050        qstep = self.npts_x 
    10491051 
    1050         x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    1051         y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
     1052        x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
     1053        y = numpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
    10521054        ## use data info instead 
    1053         new_x = np.tile(x, (len(y), 1)) 
    1054         new_y = np.tile(y, (len(x), 1)) 
     1055        new_x = numpy.tile(x, (len(y), 1)) 
     1056        new_y = numpy.tile(y, (len(x), 1)) 
    10551057        new_y = new_y.swapaxes(0, 1) 
    10561058        # all data reuire now in 1d array 
    10571059        qx_data = new_x.flatten() 
    10581060        qy_data = new_y.flatten() 
    1059         q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 
     1061        q_data = numpy.sqrt(qx_data * qx_data + qy_data * qy_data) 
    10601062        # set all True (standing for unmasked) as default 
    1061         mask = np.ones(len(qx_data), dtype=bool) 
     1063        mask = numpy.ones(len(qx_data), dtype=bool) 
    10621064        # store x and y bin centers in q space 
    10631065        x_bins = x 
    10641066        y_bins = y 
    10651067        self.data.source = Source() 
    1066         self.data.data = np.ones(len(mask)) 
    1067         self.data.err_data = np.ones(len(mask)) 
     1068        self.data.data = numpy.ones(len(mask)) 
     1069        self.data.err_data = numpy.ones(len(mask)) 
    10681070        self.data.qx_data = qx_data 
    10691071        self.data.qy_data = qy_data 
     
    10841086        :warning: This data is never plotted. 
    10851087                    residuals.x = data_copy.x[index] 
    1086             residuals.dy = np.ones(len(residuals.y)) 
     1088            residuals.dy = numpy.ones(len(residuals.y)) 
    10871089            residuals.dx = None 
    10881090            residuals.dxl = None 
     
    10911093        self.qmax_x = float(self.qmax_ctl.GetValue()) 
    10921094        self.npts_x = int(float(self.npt_ctl.GetValue())) 
    1093         qmax = self.qmax_x #/ np.sqrt(2) 
     1095        qmax = self.qmax_x #/ numpy.sqrt(2) 
    10941096        ## Default values 
    10951097        xmax = qmax 
    10961098        xmin = qmax * _Q1D_MIN 
    10971099        qstep = self.npts_x 
    1098         x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
     1100        x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    10991101        # store x and y bin centers in q space 
    11001102        #self.data.source = Source() 
    1101         y = np.ones(len(x)) 
    1102         dy = np.zeros(len(x)) 
    1103         dx = np.zeros(len(x)) 
     1103        y = numpy.ones(len(x)) 
     1104        dy = numpy.zeros(len(x)) 
     1105        dx = numpy.zeros(len(x)) 
    11041106        self.data = Data1D(x=x, y=y) 
    11051107        self.data.dx = dx 
     
    11711173        state = None 
    11721174 
    1173         np.nan_to_num(image) 
     1175        numpy.nan_to_num(image) 
    11741176        new_plot = Data2D(image=image, err_image=data.err_data) 
    11751177        new_plot.name = model.name + '2d' 
     
    13441346            msg = "OMF Panel: %s" % sys.exc_value 
    13451347            infor = 'Error' 
    1346             #logging.error(msg) 
     1348            #logger.error(msg) 
    13471349            if self.parent.parent != None: 
    13481350                # inform msg to wx 
     
    16401642            for key in sld_list.keys(): 
    16411643                if ctr_list[0] == key: 
    1642                     min_val = np.min(sld_list[key]) 
    1643                     max_val = np.max(sld_list[key]) 
    1644                     mean_val = np.mean(sld_list[key]) 
     1644                    min_val = numpy.min(sld_list[key]) 
     1645                    max_val = numpy.max(sld_list[key]) 
     1646                    mean_val = numpy.mean(sld_list[key]) 
    16451647                    enable = (min_val == max_val) and \ 
    16461648                             sld_data.pix_type == 'pixel' 
     
    16961698                msg = "%s cannot write %s\n" % ('Generic Scattering', str(path)) 
    16971699                infor = 'Error' 
    1698                 #logging.error(msg) 
     1700                #logger.error(msg) 
    16991701                if self.parent.parent != None: 
    17001702                    # inform msg to wx 
     
    17331735                    npts = -1 
    17341736                    break 
    1735                 if np.isfinite(n_val): 
     1737                if numpy.isfinite(n_val): 
    17361738                    npts *= int(n_val) 
    17371739            if npts > 0: 
     
    17701772                        ctl.Refresh() 
    17711773                        return 
    1772                     if np.isfinite(s_val): 
     1774                    if numpy.isfinite(s_val): 
    17731775                        s_size *= s_val 
    17741776                self.sld_data.set_pixel_volumes(s_size) 
     
    17871789        try: 
    17881790            sld_data = self.parent.get_sld_from_omf() 
    1789             #nop = (nop * np.pi) / 6 
     1791            #nop = (nop * numpy.pi) / 6 
    17901792            nop = len(sld_data.sld_n) 
    17911793        except: 
Note: See TracChangeset for help on using the changeset viewer.