Changeset ed2276f in sasview for src/sas/sasgui/perspectives


Ignore:
Timestamp:
Apr 4, 2017 10:00:18 AM (7 years ago)
Author:
GitHub <noreply@…>
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:
7b15990
Parents:
9a5097c (diff), 571bf4b (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.
git-author:
Andrew Jackson <andrew.jackson@…> (04/04/17 10:00:18)
git-committer:
GitHub <noreply@…> (04/04/17 10:00:18)
Message:

Merge branch 'master' into numpy_import

Location:
src/sas/sasgui/perspectives
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r9a5097c red2276f  
    14491449                self.state_change = True 
    14501450                self._draw_model() 
    1451                 # Time delay has been introduced to prevent _handle error 
    1452                 # on Windows 
    1453                 # This part of code is executed when model is selected and 
    1454                 # it's parameters are changed (with respect to previously 
    1455                 # selected model). There are two Iq evaluations occuring one 
    1456                 # after another and therefore there may be compilation error 
    1457                 # if model is calculated for the first time. 
    1458                 # This seems to be Windows only issue - haven't tested on Linux 
    1459                 # though.The proper solution (other than time delay) requires 
    1460                 # more fundemental code refatoring 
    1461                 # Wojtek P. Nov 7, 2016 
    1462                 if not ON_MAC: 
    1463                     time.sleep(0.1) 
    14641451                self.Refresh() 
    14651452 
     
    26092596            Layout is called after fitting. 
    26102597        """ 
    2611         self._sleep4sec() 
    26122598        self.Layout() 
    26132599        return 
    2614  
    2615     def _sleep4sec(self): 
    2616         """ 
    2617             sleep for 1 sec only applied on Mac 
    2618             Note: This 1sec helps for Mac not to crash on self. 
    2619             Layout after self._draw_model 
    2620         """ 
    2621         if ON_MAC: 
    2622             time.sleep(1) 
    26232600 
    26242601    def _find_polyfunc_selection(self, disp_func=None): 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r9a5097c red2276f  
    18091809            self.onSmear(None) 
    18101810 
    1811     def _mac_sleep(self, sec=0.2): 
    1812         """ 
    1813         Give sleep to MAC 
    1814         """ 
    1815         if self.is_mac: 
    1816             time.sleep(sec) 
    1817  
    18181811    def get_view_mode(self): 
    18191812        """ 
     
    21882181        self.save_current_state() 
    21892182 
    2190         if not self.is_mac: 
    2191             self.Layout() 
    2192             self.Refresh() 
    2193         self._mac_sleep(0.1) 
    21942183        # plot model ( when drawing, do not update chisqr value again) 
    21952184        self._draw_model(update_chisqr=False, source='fit') 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r9a5097c red2276f  
    876876                qmin=qmin, qmax=qmax, weight=weight) 
    877877 
    878     def _mac_sleep(self, sec=0.2): 
    879         """ 
    880         Give sleep to MAC 
    881         """ 
    882         if ON_MAC: 
    883             time.sleep(sec) 
    884  
    885878    def draw_model(self, model, page_id, data=None, smearer=None, 
    886879                   enable1D=True, enable2D=False, 
     
    10301023                                manager=self, 
    10311024                                improvement_delta=0.1) 
    1032         self._mac_sleep(0.2) 
    10331025 
    10341026        # batch fit 
     
    12701262        :param elapsed: time spent at the fitting level 
    12711263        """ 
    1272         self._mac_sleep(0.2) 
    12731264        uid = page_id[0] 
    12741265        if uid in self.fit_thread_list.keys(): 
     
    15201511            page_id = [] 
    15211512        ## fit more than 1 model at the same time 
    1522         self._mac_sleep(0.2) 
    15231513        try: 
    15241514            index = 0 
     
    17551745                                          data_id="Data  " + data.name + " unsmeared", 
    17561746                                          dy=unsmeared_error) 
    1757                  
    1758             if sq_model is not None and pq_model is not None: 
    1759                 self.create_theory_1D(x, sq_model, page_id, model, data, state, 
    1760                                       data_description=model.name + " S(q)", 
    1761                                       data_id=str(page_id) + " " + data.name + " S(q)") 
    1762                 self.create_theory_1D(x, pq_model, page_id, model, data, state, 
    1763                                       data_description=model.name + " P(q)", 
    1764                                       data_id=str(page_id) + " " + data.name + " P(q)") 
    1765  
     1747            # Comment this out until we can get P*S models with correctly populated parameters 
     1748            #if sq_model is not None and pq_model is not None: 
     1749            #    self.create_theory_1D(x, sq_model, page_id, model, data, state, 
     1750            #                          data_description=model.name + " S(q)", 
     1751            #                          data_id=str(page_id) + " " + data.name + " S(q)") 
     1752            #    self.create_theory_1D(x, pq_model, page_id, model, data, state, 
     1753            #                          data_description=model.name + " P(q)", 
     1754            #                          data_id=str(page_id) + " " + data.name + " P(q)") 
    17661755 
    17671756            current_pg = self.fit_panel.get_page_by_id(page_id) 
  • src/sas/sasgui/perspectives/fitting/pagestate.py

    r9a5097c red2276f  
    819819 
    820820        attr = newdoc.createAttribute("version") 
    821         import sasview 
     821        from sas import sasview 
    822822        attr.nodeValue = sasview.__version__ 
    823823        # attr.nodeValue = '1.0' 
  • src/sas/sasgui/perspectives/calculator/data_operator.py

    r61780e3 r9a5097c  
    55import sys 
    66import time 
    7 import numpy 
     7import numpy as np 
    88from sas.sascalc.dataloader.data_info import Data1D 
    99from sas.sasgui.plottools.PlotPanel import PlotPanel 
     
    541541                    theory, _ = theory_list.values()[0] 
    542542                    dnames.append(theory.name) 
    543         ind = numpy.argsort(dnames) 
     543        ind = np.argsort(dnames) 
    544544        if len(ind) > 0: 
    545             val_list = numpy.array(self._data.values())[ind] 
     545            val_list = np.array(self._data.values())[ind] 
    546546            for datastate in val_list: 
    547547                data = datastate.data 
  • 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: 
  • src/sas/sasgui/perspectives/fitting/model_thread.py

    rc1c9929 r9a5097c  
    44 
    55import time 
    6 import numpy 
     6import numpy as np 
    77import math 
    88from sas.sascalc.data_util.calcthread import CalcThread 
     
    6868 
    6969        # Define matrix where data will be plotted 
    70         radius = numpy.sqrt((self.data.qx_data * self.data.qx_data) + \ 
     70        radius = np.sqrt((self.data.qx_data * self.data.qx_data) + \ 
    7171                    (self.data.qy_data * self.data.qy_data)) 
    7272 
     
    7575        index_model = (self.qmin <= radius) & (radius <= self.qmax) 
    7676        index_model = index_model & self.data.mask 
    77         index_model = index_model & numpy.isfinite(self.data.data) 
     77        index_model = index_model & np.isfinite(self.data.data) 
    7878 
    7979        if self.smearer is not None: 
     
    9191                self.data.qy_data[index_model] 
    9292            ]) 
    93         output = numpy.zeros(len(self.data.qx_data)) 
     93        output = np.zeros(len(self.data.qx_data)) 
    9494        # output default is None 
    9595        # This method is to distinguish between masked 
     
    163163        """ 
    164164        self.starttime = time.time() 
    165         output = numpy.zeros((len(self.data.x))) 
     165        output = np.zeros((len(self.data.x))) 
    166166        index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax) 
    167167 
     
    175175                                                             self.qmax) 
    176176            mask = self.data.x[first_bin:last_bin+1] 
    177             unsmeared_output = numpy.zeros((len(self.data.x))) 
     177            unsmeared_output = np.zeros((len(self.data.x))) 
    178178            unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 
    179179            self.smearer.model = self.model 
     
    183183            # Check that the arrays are compatible. If we only have a model but no data, 
    184184            # the length of data.y will be zero. 
    185             if isinstance(self.data.y, numpy.ndarray) and output.shape == self.data.y.shape: 
    186                 unsmeared_data = numpy.zeros((len(self.data.x))) 
    187                 unsmeared_error = numpy.zeros((len(self.data.x))) 
     185            if isinstance(self.data.y, np.ndarray) and output.shape == self.data.y.shape: 
     186                unsmeared_data = np.zeros((len(self.data.x))) 
     187                unsmeared_error = np.zeros((len(self.data.x))) 
    188188                unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\ 
    189189                                                        * unsmeared_output[first_bin:last_bin+1]\ 
     
    209209 
    210210        if p_model is not None and s_model is not None: 
    211             sq_values = numpy.zeros((len(self.data.x))) 
    212             pq_values = numpy.zeros((len(self.data.x))) 
     211            sq_values = np.zeros((len(self.data.x))) 
     212            pq_values = np.zeros((len(self.data.x))) 
    213213            sq_values[index] = s_model.evalDistribution(self.data.x[index]) 
    214214            pq_values[index] = p_model.evalDistribution(self.data.x[index]) 
  • src/sas/sasgui/perspectives/fitting/utils.py

    rd85c194 r9a5097c  
    22Module contains functions frequently used in this package 
    33""" 
    4 import numpy 
     4import numpy as np 
    55 
    66 
     
    1919        data = data.y 
    2020    if flag == 0: 
    21         weight = numpy.ones_like(data) 
     21        weight = np.ones_like(data) 
    2222    elif flag == 1: 
    2323        weight = dy_data 
    2424    elif flag == 2: 
    25         weight = numpy.sqrt(numpy.abs(data)) 
     25        weight = np.sqrt(np.abs(data)) 
    2626    elif flag == 3: 
    27         weight = numpy.abs(data) 
     27        weight = np.abs(data) 
    2828    return weight 
  • src/sas/sasgui/perspectives/pr/explore_dialog.py

    rd85c194 r9a5097c  
    1919 
    2020import wx 
    21 import numpy 
     21import numpy as np 
    2222import logging 
    2323import sys 
     
    6565 
    6666        step = (self.max - self.min) / (self.npts - 1) 
    67         self.x = numpy.arange(self.min, self.max + step * 0.01, step) 
    68         dx = numpy.zeros(len(self.x)) 
    69         y = numpy.ones(len(self.x)) 
    70         dy = numpy.zeros(len(self.x)) 
     67        self.x = np.arange(self.min, self.max + step * 0.01, step) 
     68        dx = np.zeros(len(self.x)) 
     69        y = np.ones(len(self.x)) 
     70        dy = np.zeros(len(self.x)) 
    7171 
    7272        # Plot area 
  • src/sas/sasgui/perspectives/pr/pr.py

    ra69a967 r9a5097c  
    2121import time 
    2222import math 
    23 import numpy 
     23import numpy as np 
    2424import pylab 
    2525from sas.sasgui.guiframe.gui_manager import MDIFrame 
     
    207207        r = pylab.arange(0.01, d_max, d_max / 51.0) 
    208208        M = len(r) 
    209         y = numpy.zeros(M) 
    210         pr_err = numpy.zeros(M) 
     209        y = np.zeros(M) 
     210        pr_err = np.zeros(M) 
    211211 
    212212        total = 0.0 
     
    253253        """ 
    254254        # Show P(r) 
    255         y_true = numpy.zeros(len(x)) 
     255        y_true = np.zeros(len(x)) 
    256256 
    257257        sum_true = 0.0 
     
    307307 
    308308        x = pylab.arange(minq, maxq, maxq / 301.0) 
    309         y = numpy.zeros(len(x)) 
    310         err = numpy.zeros(len(x)) 
     309        y = np.zeros(len(x)) 
     310        err = np.zeros(len(x)) 
    311311        for i in range(len(x)): 
    312312            value = pr.iq(out, x[i]) 
     
    337337        if pr.slit_width > 0 or pr.slit_height > 0: 
    338338            x = pylab.arange(minq, maxq, maxq / 301.0) 
    339             y = numpy.zeros(len(x)) 
    340             err = numpy.zeros(len(x)) 
     339            y = np.zeros(len(x)) 
     340            err = np.zeros(len(x)) 
    341341            for i in range(len(x)): 
    342342                value = pr.iq_smeared(out, x[i]) 
     
    382382        x = pylab.arange(0.0, pr.d_max, pr.d_max / self._pr_npts) 
    383383 
    384         y = numpy.zeros(len(x)) 
    385         dy = numpy.zeros(len(x)) 
    386         y_true = numpy.zeros(len(x)) 
     384        y = np.zeros(len(x)) 
     385        dy = np.zeros(len(x)) 
     386        y_true = np.zeros(len(x)) 
    387387 
    388388        total = 0.0 
    389389        pmax = 0.0 
    390         cov2 = numpy.ascontiguousarray(cov) 
     390        cov2 = np.ascontiguousarray(cov) 
    391391 
    392392        for i in range(len(x)): 
     
    480480        """ 
    481481        # Read the data from the data file 
    482         data_x = numpy.zeros(0) 
    483         data_y = numpy.zeros(0) 
    484         data_err = numpy.zeros(0) 
     482        data_x = np.zeros(0) 
     483        data_y = np.zeros(0) 
     484        data_err = np.zeros(0) 
    485485        scale = None 
    486486        min_err = 0.0 
     
    504504                        #err = 0 
    505505 
    506                     data_x = numpy.append(data_x, x) 
    507                     data_y = numpy.append(data_y, y) 
    508                     data_err = numpy.append(data_err, err) 
     506                    data_x = np.append(data_x, x) 
     507                    data_y = np.append(data_y, y) 
     508                    data_err = np.append(data_err, err) 
    509509                except: 
    510510                    logging.error(sys.exc_value) 
     
    528528        """ 
    529529        # Read the data from the data file 
    530         data_x = numpy.zeros(0) 
    531         data_y = numpy.zeros(0) 
    532         data_err = numpy.zeros(0) 
     530        data_x = np.zeros(0) 
     531        data_y = np.zeros(0) 
     532        data_err = np.zeros(0) 
    533533        scale = None 
    534534        min_err = 0.0 
     
    555555                            #err = 0 
    556556 
    557                         data_x = numpy.append(data_x, x) 
    558                         data_y = numpy.append(data_y, y) 
    559                         data_err = numpy.append(data_err, err) 
     557                        data_x = np.append(data_x, x) 
     558                        data_y = np.append(data_y, y) 
     559                        data_err = np.append(data_err, err) 
    560560                    except: 
    561561                        logging.error(sys.exc_value) 
     
    640640        # Now replot the original added data 
    641641        for plot in self._added_plots: 
    642             self._added_plots[plot].y = numpy.copy(self._default_Iq[plot]) 
     642            self._added_plots[plot].y = np.copy(self._default_Iq[plot]) 
    643643            wx.PostEvent(self.parent, 
    644644                         NewPlotEvent(plot=self._added_plots[plot], 
     
    664664        # Now scale the added plots too 
    665665        for plot in self._added_plots: 
    666             total = numpy.sum(self._added_plots[plot].y) 
     666            total = np.sum(self._added_plots[plot].y) 
    667667            npts = len(self._added_plots[plot].x) 
    668668            total *= self._added_plots[plot].x[npts - 1] / npts 
     
    814814        # Save Pr invertor 
    815815        self.pr = pr 
    816         cov = numpy.ascontiguousarray(cov) 
     816        cov = np.ascontiguousarray(cov) 
    817817 
    818818        # Show result on control panel 
     
    982982        all_zeros = True 
    983983        if err == None: 
    984             err = numpy.zeros(len(pr.y)) 
     984            err = np.zeros(len(pr.y)) 
    985985        else: 
    986986            for i in range(len(err)): 
     
    10881088        # If we have not errors, add statistical errors 
    10891089        if y is not None: 
    1090             if err == None or numpy.all(err) == 0: 
    1091                 err = numpy.zeros(len(y)) 
     1090            if err == None or np.all(err) == 0: 
     1091                err = np.zeros(len(y)) 
    10921092                scale = None 
    10931093                min_err = 0.0 
  • src/sas/sasgui/perspectives/simulation/simulation.py

    rd85c194 r9a5097c  
    1010import wx 
    1111import os 
    12 import numpy 
     12import numpy as np 
    1313import time 
    1414import logging 
     
    4646    def compute(self): 
    4747        x = self.x 
    48         output = numpy.zeros(len(x)) 
    49         error = numpy.zeros(len(x)) 
     48        output = np.zeros(len(x)) 
     49        error = np.zeros(len(x)) 
    5050         
    5151        self.starttime = time.time() 
     
    123123        # Q-values for plotting simulated I(Q) 
    124124        step = (self.q_max-self.q_min)/(self.q_npts-1) 
    125         self.x = numpy.arange(self.q_min, self.q_max+step*0.01, step)         
     125        self.x = np.arange(self.q_min, self.q_max+step*0.01, step) 
    126126         
    127127        # Set the list of panels that are part of the simulation perspective 
     
    187187        # Q-values for plotting simulated I(Q) 
    188188        step = (self.q_max-self.q_min)/(self.q_npts-1) 
    189         self.x = numpy.arange(self.q_min, self.q_max+step*0.01, step)     
     189        self.x = np.arange(self.q_min, self.q_max+step*0.01, step) 
    190190          
    191191        # Compute the simulated I(Q) 
Note: See TracChangeset for help on using the changeset viewer.