Ignore:
Timestamp:
Mar 26, 2017 9:33:16 PM (7 years ago)
Author:
andyfaff
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:
ed2276f
Parents:
9146ed9
Message:

MAINT: import numpy as np

File:
1 edited

Legend:

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

    r0f7c930 r9a5097c  
    77import sys 
    88import os 
    9 import numpy 
     9import numpy as np 
    1010#import math 
    1111import wx.aui as aui 
     
    741741            marker = 'o' 
    742742            m_size = 3.5 
    743         sld_tot = (numpy.fabs(sld_mx) + numpy.fabs(sld_my) + \ 
    744                    numpy.fabs(sld_mz) + numpy.fabs(output.sld_n)) 
     743        sld_tot = (np.fabs(sld_mx) + np.fabs(sld_my) + \ 
     744                   np.fabs(sld_mz) + np.fabs(output.sld_n)) 
    745745        is_nonzero = sld_tot > 0.0 
    746746        is_zero = sld_tot == 0.0 
     
    757757            pix_symbol = output.pix_symbol[is_nonzero] 
    758758        # II. Plot selective points in color 
    759         other_color = numpy.ones(len(pix_symbol), dtype='bool') 
     759        other_color = np.ones(len(pix_symbol), dtype='bool') 
    760760        for key in color_dic.keys(): 
    761761            chosen_color = pix_symbol == key 
    762             if numpy.any(chosen_color): 
     762            if np.any(chosen_color): 
    763763                other_color = other_color & (chosen_color != True) 
    764764                color = color_dic[key] 
     
    767767                        markeredgecolor=color, markersize=m_size, label=key) 
    768768        # III. Plot All others         
    769         if numpy.any(other_color): 
     769        if np.any(other_color): 
    770770            a_name = '' 
    771771            if output.pix_type == 'atom': 
     
    795795                draw magnetic vectors w/arrow 
    796796                """ 
    797                 max_mx = max(numpy.fabs(sld_mx)) 
    798                 max_my = max(numpy.fabs(sld_my)) 
    799                 max_mz = max(numpy.fabs(sld_mz)) 
     797                max_mx = max(np.fabs(sld_mx)) 
     798                max_my = max(np.fabs(sld_my)) 
     799                max_mz = max(np.fabs(sld_mz)) 
    800800                max_m = max(max_mx, max_my, max_mz) 
    801801                try: 
     
    812812                        unit_z2 = sld_mz / max_m 
    813813                        # 0.8 is for avoiding the color becomes white=(1,1,1)) 
    814                         color_x = numpy.fabs(unit_x2 * 0.8) 
    815                         color_y = numpy.fabs(unit_y2 * 0.8) 
    816                         color_z = numpy.fabs(unit_z2 * 0.8) 
     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) 
    817817                        x2 = pos_x + unit_x2 * max_step 
    818818                        y2 = pos_y + unit_y2 * max_step 
    819819                        z2 = pos_z + unit_z2 * max_step 
    820                         x_arrow = numpy.column_stack((pos_x, x2)) 
    821                         y_arrow = numpy.column_stack((pos_y, y2)) 
    822                         z_arrow = numpy.column_stack((pos_z, z2)) 
    823                         colors = numpy.column_stack((color_x, color_y, color_z)) 
     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)) 
    824824                        arrows = Arrow3D(panel, x_arrow, z_arrow, y_arrow, 
    825825                                        colors, mutation_scale=10, lw=1, 
     
    880880            if self.is_avg or self.is_avg == None: 
    881881                self._create_default_1d_data() 
    882                 i_out = numpy.zeros(len(self.data.y)) 
     882                i_out = np.zeros(len(self.data.y)) 
    883883                inputs = [self.data.x, [], i_out] 
    884884            else: 
    885885                self._create_default_2d_data() 
    886                 i_out = numpy.zeros(len(self.data.data)) 
     886                i_out = np.zeros(len(self.data.data)) 
    887887                inputs = [self.data.qx_data, self.data.qy_data, i_out] 
    888888 
     
    989989        :Param input: input list [qx_data, qy_data, i_out] 
    990990        """ 
    991         out = numpy.empty(0) 
     991        out = np.empty(0) 
    992992        #s = time.time() 
    993993        for ind in range(len(input[0])): 
     
    998998                inputi = [input[0][ind:ind + 1], [], input[2][ind:ind + 1]] 
    999999                outi = self.model.run(inputi) 
    1000                 out = numpy.append(out, outi) 
     1000                out = np.append(out, outi) 
    10011001            else: 
    10021002                if ind % 50 == 0  and update != None: 
     
    10061006                          input[2][ind:ind + 1]] 
    10071007                outi = self.model.runXY(inputi) 
    1008                 out = numpy.append(out, outi) 
     1008                out = np.append(out, outi) 
    10091009        #print time.time() - s 
    10101010        if self.is_avg or self.is_avg == None: 
     
    10271027        self.npts_x = int(float(self.npt_ctl.GetValue())) 
    10281028        self.data = Data2D() 
    1029         qmax = self.qmax_x #/ numpy.sqrt(2) 
     1029        qmax = self.qmax_x #/ np.sqrt(2) 
    10301030        self.data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 
    10311031        self.data.yaxis('\\rm{Q_{y}}', '\AA^{-1}') 
     
    10481048        qstep = self.npts_x 
    10491049 
    1050         x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    1051         y = numpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
     1050        x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
     1051        y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
    10521052        ## use data info instead 
    1053         new_x = numpy.tile(x, (len(y), 1)) 
    1054         new_y = numpy.tile(y, (len(x), 1)) 
     1053        new_x = np.tile(x, (len(y), 1)) 
     1054        new_y = np.tile(y, (len(x), 1)) 
    10551055        new_y = new_y.swapaxes(0, 1) 
    10561056        # all data reuire now in 1d array 
    10571057        qx_data = new_x.flatten() 
    10581058        qy_data = new_y.flatten() 
    1059         q_data = numpy.sqrt(qx_data * qx_data + qy_data * qy_data) 
     1059        q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 
    10601060        # set all True (standing for unmasked) as default 
    1061         mask = numpy.ones(len(qx_data), dtype=bool) 
     1061        mask = np.ones(len(qx_data), dtype=bool) 
    10621062        # store x and y bin centers in q space 
    10631063        x_bins = x 
    10641064        y_bins = y 
    10651065        self.data.source = Source() 
    1066         self.data.data = numpy.ones(len(mask)) 
    1067         self.data.err_data = numpy.ones(len(mask)) 
     1066        self.data.data = np.ones(len(mask)) 
     1067        self.data.err_data = np.ones(len(mask)) 
    10681068        self.data.qx_data = qx_data 
    10691069        self.data.qy_data = qy_data 
     
    10841084        :warning: This data is never plotted. 
    10851085                    residuals.x = data_copy.x[index] 
    1086             residuals.dy = numpy.ones(len(residuals.y)) 
     1086            residuals.dy = np.ones(len(residuals.y)) 
    10871087            residuals.dx = None 
    10881088            residuals.dxl = None 
     
    10911091        self.qmax_x = float(self.qmax_ctl.GetValue()) 
    10921092        self.npts_x = int(float(self.npt_ctl.GetValue())) 
    1093         qmax = self.qmax_x #/ numpy.sqrt(2) 
     1093        qmax = self.qmax_x #/ np.sqrt(2) 
    10941094        ## Default values 
    10951095        xmax = qmax 
    10961096        xmin = qmax * _Q1D_MIN 
    10971097        qstep = self.npts_x 
    1098         x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
     1098        x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    10991099        # store x and y bin centers in q space 
    11001100        #self.data.source = Source() 
    1101         y = numpy.ones(len(x)) 
    1102         dy = numpy.zeros(len(x)) 
    1103         dx = numpy.zeros(len(x)) 
     1101        y = np.ones(len(x)) 
     1102        dy = np.zeros(len(x)) 
     1103        dx = np.zeros(len(x)) 
    11041104        self.data = Data1D(x=x, y=y) 
    11051105        self.data.dx = dx 
     
    11711171        state = None 
    11721172 
    1173         numpy.nan_to_num(image) 
     1173        np.nan_to_num(image) 
    11741174        new_plot = Data2D(image=image, err_image=data.err_data) 
    11751175        new_plot.name = model.name + '2d' 
     
    16401640            for key in sld_list.keys(): 
    16411641                if ctr_list[0] == key: 
    1642                     min_val = numpy.min(sld_list[key]) 
    1643                     max_val = numpy.max(sld_list[key]) 
    1644                     mean_val = numpy.mean(sld_list[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]) 
    16451645                    enable = (min_val == max_val) and \ 
    16461646                             sld_data.pix_type == 'pixel' 
     
    17331733                    npts = -1 
    17341734                    break 
    1735                 if numpy.isfinite(n_val): 
     1735                if np.isfinite(n_val): 
    17361736                    npts *= int(n_val) 
    17371737            if npts > 0: 
     
    17701770                        ctl.Refresh() 
    17711771                        return 
    1772                     if numpy.isfinite(s_val): 
     1772                    if np.isfinite(s_val): 
    17731773                        s_size *= s_val 
    17741774                self.sld_data.set_pixel_volumes(s_size) 
     
    17871787        try: 
    17881788            sld_data = self.parent.get_sld_from_omf() 
    1789             #nop = (nop * numpy.pi) / 6 
     1789            #nop = (nop * np.pi) / 6 
    17901790            nop = len(sld_data.sld_n) 
    17911791        except: 
Note: See TracChangeset for help on using the changeset viewer.