Changeset 0d8ee36 in sasview for src/sas/sasgui


Ignore:
Timestamp:
Apr 5, 2017 9:42:20 AM (7 years ago)
Author:
krzywon
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:
3444492
Parents:
b697396b (diff), a2e980b (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:

Merge branch 'master' into batch_slicer

Location:
src/sas/sasgui
Files:
2 added
1 deleted
22 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/aboutbox.py

    r49e000b r1779e72  
    118118        self.bitmap_button_ansto = wx.BitmapButton(self, -1, wx.NullBitmap) 
    119119        self.bitmap_button_tudelft = wx.BitmapButton(self, -1, wx.NullBitmap) 
     120        self.bitmap_button_dls = wx.BitmapButton(self, -1, wx.NullBitmap) 
    120121         
    121122        self.static_line_3 = wx.StaticLine(self, -1) 
     
    137138        self.Bind(wx.EVT_BUTTON, self.onAnstoLogo, self.bitmap_button_ansto) 
    138139        self.Bind(wx.EVT_BUTTON, self.onTudelftLogo, self.bitmap_button_tudelft) 
     140        self.Bind(wx.EVT_BUTTON, self.onDlsLogo, self.bitmap_button_dls) 
    139141        # end wxGlade 
    140142        # fill in acknowledgements 
     
    229231        logo = wx.Bitmap(image) 
    230232        self.bitmap_button_tudelft.SetBitmapLabel(logo) 
     233         
     234        image = file_dir + "/images/dls_logo.png" 
     235        if os.path.isfile(config._dls_logo): 
     236            image = config._dls_logo 
     237        logo = wx.Bitmap(image) 
     238        self.bitmap_button_dls.SetBitmapLabel(logo) 
    231239                 
    232240        # resize dialog window to fit version number nicely 
     
    260268        self.bitmap_button_ansto.SetSize(self.bitmap_button_ansto.GetBestSize()) 
    261269        self.bitmap_button_tudelft.SetSize(self.bitmap_button_tudelft.GetBestSize()) 
     270        self.bitmap_button_dls.SetSize(self.bitmap_button_dls.GetBestSize()) 
    262271        # end wxGlade 
    263272 
     
    325334        sizer_logos.Add(self.bitmap_button_tudelft, 0,  
    326335                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     336        sizer_logos.Add(self.bitmap_button_dls, 0,  
     337                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    327338                 
    328339        sizer_logos.Add((10, 50), 0, wx.ADJUST_MINSIZE, 0) 
     
    423434        event.Skip() 
    424435 
     436    def onDlsLogo(self, event): 
     437        """ 
     438        """  
     439        # wxGlade: DialogAbout.<event_handler> 
     440        launchBrowser(config._dls_url) 
     441        event.Skip() 
     442 
    425443# end of class DialogAbout 
    426444 
  • src/sas/sasgui/guiframe/config.py

    rf9d1f60 r1779e72  
    4646 
    4747_acknowledgement =  \ 
    48 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO and TU Delft and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: https://github.com/orgs/SasView/people 
     48'''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: https://github.com/orgs/SasView/people 
    4949''' 
    5050 
     
    8383_ansto_url = "http://www.ansto.gov.au/" 
    8484_tudelft_url = "http://www.tnw.tudelft.nl/en/cooperation/facilities/reactor-instituut-delft/" 
     85_dls_url = "http://www.diamond.ac.uk/" 
    8586_danse_url = "http://www.cacr.caltech.edu/projects/danse/release/index.html" 
    8687_inst_url = "http://www.utk.edu" 
    8788_corner_image = os.path.join(icon_path, "angles_flat.png") 
    8889_welcome_image = os.path.join(icon_path, "SVwelcome.png") 
    89 _copyright = "(c) 2009 - 2017, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO and TU Delft" 
     90_copyright = "(c) 2009 - 2017, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, and DLS" 
    9091marketplace_url = "http://marketplace.sasview.org/" 
    9192 
  • src/sas/sasgui/guiframe/dataFitting.py

    r68adf86 r9a5097c  
    33""" 
    44import copy 
    5 import numpy 
     5import numpy as np 
    66import math 
    77from sas.sascalc.data_util.uncertainty import Uncertainty 
     
    8181            result.dxw = None 
    8282        else: 
    83             result.dxw = numpy.zeros(len(self.x)) 
     83            result.dxw = np.zeros(len(self.x)) 
    8484        if self.dxl == None: 
    8585            result.dxl = None 
    8686        else: 
    87             result.dxl = numpy.zeros(len(self.x)) 
     87            result.dxl = np.zeros(len(self.x)) 
    8888 
    8989        for i in range(len(self.x)): 
     
    128128            result.dlam = None 
    129129        else: 
    130             result.dlam = numpy.zeros(tot_length) 
     130            result.dlam = np.zeros(tot_length) 
    131131        if self.dy == None or other.dy is None: 
    132132            result.dy = None 
    133133        else: 
    134             result.dy = numpy.zeros(tot_length) 
     134            result.dy = np.zeros(tot_length) 
    135135        if self.dx == None or other.dx is None: 
    136136            result.dx = None 
    137137        else: 
    138             result.dx = numpy.zeros(tot_length) 
     138            result.dx = np.zeros(tot_length) 
    139139        if self.dxw == None or other.dxw is None: 
    140140            result.dxw = None 
    141141        else: 
    142             result.dxw = numpy.zeros(tot_length) 
     142            result.dxw = np.zeros(tot_length) 
    143143        if self.dxl == None or other.dxl is None: 
    144144            result.dxl = None 
    145145        else: 
    146             result.dxl = numpy.zeros(tot_length) 
    147  
    148         result.x = numpy.append(self.x, other.x) 
     146            result.dxl = np.zeros(tot_length) 
     147 
     148        result.x = np.append(self.x, other.x) 
    149149        #argsorting 
    150         ind = numpy.argsort(result.x) 
     150        ind = np.argsort(result.x) 
    151151        result.x = result.x[ind] 
    152         result.y = numpy.append(self.y, other.y) 
     152        result.y = np.append(self.y, other.y) 
    153153        result.y = result.y[ind] 
    154         result.lam = numpy.append(self.lam, other.lam) 
     154        result.lam = np.append(self.lam, other.lam) 
    155155        result.lam = result.lam[ind] 
    156156        if result.dlam != None: 
    157             result.dlam = numpy.append(self.dlam, other.dlam) 
     157            result.dlam = np.append(self.dlam, other.dlam) 
    158158            result.dlam = result.dlam[ind] 
    159159        if result.dy != None: 
    160             result.dy = numpy.append(self.dy, other.dy) 
     160            result.dy = np.append(self.dy, other.dy) 
    161161            result.dy = result.dy[ind] 
    162162        if result.dx is not None: 
    163             result.dx = numpy.append(self.dx, other.dx) 
     163            result.dx = np.append(self.dx, other.dx) 
    164164            result.dx = result.dx[ind] 
    165165        if result.dxw is not None: 
    166             result.dxw = numpy.append(self.dxw, other.dxw) 
     166            result.dxw = np.append(self.dxw, other.dxw) 
    167167            result.dxw = result.dxw[ind] 
    168168        if result.dxl is not None: 
    169             result.dxl = numpy.append(self.dxl, other.dxl) 
     169            result.dxl = np.append(self.dxl, other.dxl) 
    170170            result.dxl = result.dxl[ind] 
    171171        return result 
     
    230230            result.dxw = None 
    231231        else: 
    232             result.dxw = numpy.zeros(len(self.x)) 
     232            result.dxw = np.zeros(len(self.x)) 
    233233        if self.dxl == None: 
    234234            result.dxl = None 
    235235        else: 
    236             result.dxl = numpy.zeros(len(self.x)) 
    237  
    238         for i in range(numpy.size(self.x)): 
     236            result.dxl = np.zeros(len(self.x)) 
     237 
     238        for i in range(np.size(self.x)): 
    239239            result.x[i] = self.x[i] 
    240240            if self.dx is not None and len(self.x) == len(self.dx): 
     
    282282            result.dlam = None 
    283283        else: 
    284             result.dlam = numpy.zeros(tot_length) 
     284            result.dlam = np.zeros(tot_length) 
    285285        if self.dy == None or other.dy is None: 
    286286            result.dy = None 
    287287        else: 
    288             result.dy = numpy.zeros(tot_length) 
     288            result.dy = np.zeros(tot_length) 
    289289        if self.dx == None or other.dx is None: 
    290290            result.dx = None 
    291291        else: 
    292             result.dx = numpy.zeros(tot_length) 
     292            result.dx = np.zeros(tot_length) 
    293293        if self.dxw == None or other.dxw is None: 
    294294            result.dxw = None 
    295295        else: 
    296             result.dxw = numpy.zeros(tot_length) 
     296            result.dxw = np.zeros(tot_length) 
    297297        if self.dxl == None or other.dxl is None: 
    298298            result.dxl = None 
    299299        else: 
    300             result.dxl = numpy.zeros(tot_length) 
    301         result.x = numpy.append(self.x, other.x) 
     300            result.dxl = np.zeros(tot_length) 
     301        result.x = np.append(self.x, other.x) 
    302302        #argsorting 
    303         ind = numpy.argsort(result.x) 
     303        ind = np.argsort(result.x) 
    304304        result.x = result.x[ind] 
    305         result.y = numpy.append(self.y, other.y) 
     305        result.y = np.append(self.y, other.y) 
    306306        result.y = result.y[ind] 
    307         result.lam = numpy.append(self.lam, other.lam) 
     307        result.lam = np.append(self.lam, other.lam) 
    308308        result.lam = result.lam[ind] 
    309309        if result.dy != None: 
    310             result.dy = numpy.append(self.dy, other.dy) 
     310            result.dy = np.append(self.dy, other.dy) 
    311311            result.dy = result.dy[ind] 
    312312        if result.dx is not None: 
    313             result.dx = numpy.append(self.dx, other.dx) 
     313            result.dx = np.append(self.dx, other.dx) 
    314314            result.dx = result.dx[ind] 
    315315        if result.dxw is not None: 
    316             result.dxw = numpy.append(self.dxw, other.dxw) 
     316            result.dxw = np.append(self.dxw, other.dxw) 
    317317            result.dxw = result.dxw[ind] 
    318318        if result.dxl is not None: 
    319             result.dxl = numpy.append(self.dxl, other.dxl) 
     319            result.dxl = np.append(self.dxl, other.dxl) 
    320320            result.dxl = result.dxl[ind] 
    321321        return result 
     
    409409            result.dqy_data = None 
    410410        else: 
    411             result.dqx_data = numpy.zeros(len(self.data)) 
    412             result.dqy_data = numpy.zeros(len(self.data)) 
    413         for i in range(numpy.size(self.data)): 
     411            result.dqx_data = np.zeros(len(self.data)) 
     412            result.dqy_data = np.zeros(len(self.data)) 
     413        for i in range(np.size(self.data)): 
    414414            result.data[i] = self.data[i] 
    415415            if self.err_data is not None and \ 
    416                 numpy.size(self.data) == numpy.size(self.err_data): 
     416                            np.size(self.data) == np.size(self.err_data): 
    417417                result.err_data[i] = self.err_data[i]     
    418418            if self.dqx_data is not None: 
     
    473473            result.dqy_data = None 
    474474        else: 
    475             result.dqx_data = numpy.zeros(len(self.data) + \ 
    476                                          numpy.size(other.data)) 
    477             result.dqy_data = numpy.zeros(len(self.data) + \ 
    478                                          numpy.size(other.data)) 
    479          
    480         result.data = numpy.append(self.data, other.data) 
    481         result.qx_data = numpy.append(self.qx_data, other.qx_data) 
    482         result.qy_data = numpy.append(self.qy_data, other.qy_data) 
    483         result.q_data = numpy.append(self.q_data, other.q_data) 
    484         result.mask = numpy.append(self.mask, other.mask) 
     475            result.dqx_data = np.zeros(len(self.data) + \ 
     476                                       np.size(other.data)) 
     477            result.dqy_data = np.zeros(len(self.data) + \ 
     478                                       np.size(other.data)) 
     479         
     480        result.data = np.append(self.data, other.data) 
     481        result.qx_data = np.append(self.qx_data, other.qx_data) 
     482        result.qy_data = np.append(self.qy_data, other.qy_data) 
     483        result.q_data = np.append(self.q_data, other.q_data) 
     484        result.mask = np.append(self.mask, other.mask) 
    485485        if result.err_data is not None: 
    486             result.err_data = numpy.append(self.err_data, other.err_data)  
     486            result.err_data = np.append(self.err_data, other.err_data) 
    487487        if self.dqx_data is not None: 
    488             result.dqx_data = numpy.append(self.dqx_data, other.dqx_data) 
     488            result.dqx_data = np.append(self.dqx_data, other.dqx_data) 
    489489        if self.dqy_data is not None: 
    490             result.dqy_data = numpy.append(self.dqy_data, other.dqy_data) 
     490            result.dqy_data = np.append(self.dqy_data, other.dqy_data) 
    491491 
    492492        return result 
  • src/sas/sasgui/guiframe/data_processor.py

    r468c253 r9a5097c  
    10911091            # When inputs are from an external file 
    10921092            return inputs, outputs 
    1093         inds = numpy.lexsort((to_be_sort, to_be_sort)) 
     1093        inds = np.lexsort((to_be_sort, to_be_sort)) 
    10941094        for key in outputs.keys(): 
    10951095            key_list = outputs[key] 
     
    13791379            return 
    13801380        if dy == None: 
    1381             dy = numpy.zeros(len(y)) 
     1381            dy = np.zeros(len(y)) 
    13821382        #plotting 
    13831383        new_plot = Data1D(x=x, y=y, dy=dy) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r29e872e r9a5097c  
    1414import sys 
    1515import math 
    16 import numpy 
     16import numpy as np 
    1717import logging 
    1818from sas.sasgui.plottools.PlotPanel import PlotPanel 
     
    288288        :Param value: float 
    289289        """ 
    290         idx = (numpy.abs(array - value)).argmin() 
     290        idx = (np.abs(array - value)).argmin() 
    291291        return int(idx)  # array.flat[idx] 
    292292 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py

    rdfa1579 r0d8ee36  
    1414import sys 
    1515import math 
    16 import numpy 
     16import numpy as np 
    1717import logging 
    1818from sas.sasgui.plottools.PlotPanel import PlotPanel 
     
    568568        """ 
    569569        # Find the best number of bins 
    570         npt = math.sqrt(len(self.data2D.data[numpy.isfinite(self.data2D.data)])) 
     570        npt = math.sqrt(len(self.data2D.data[np.isfinite(self.data2D.data)])) 
    571571        npt = math.floor(npt) 
    572572        from sas.sascalc.dataloader.manipulations import CircularAverage 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py

    rd85c194 r9a5097c  
    11import wx 
    22import math 
    3 import numpy 
     3import numpy as np 
    44from sas.sasgui.guiframe.events import NewPlotEvent 
    55from sas.sasgui.guiframe.events import StatusEvent 
     
    358358        # # Reset x, y- coordinates if send as parameters 
    359359        if x != None: 
    360             self.x = numpy.sign(self.x) * math.fabs(x) 
     360            self.x = np.sign(self.x) * math.fabs(x) 
    361361        if y != None: 
    362             self.y = numpy.sign(self.y) * math.fabs(y) 
     362            self.y = np.sign(self.y) * math.fabs(y) 
    363363        # # Draw lines and markers 
    364364        self.inner_marker.set(xdata=[0], ydata=[self.y]) 
     
    465465        # # reset x, y -coordinates if given as parameters 
    466466        if x != None: 
    467             self.x = numpy.sign(self.x) * math.fabs(x) 
     467            self.x = np.sign(self.x) * math.fabs(x) 
    468468        if y != None: 
    469             self.y = numpy.sign(self.y) * math.fabs(y) 
     469            self.y = np.sign(self.y) * math.fabs(y) 
    470470        # # draw lines and markers 
    471471        self.inner_marker.set(xdata=[self.x], ydata=[0]) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py

    rd85c194 r9a5097c  
    2424import math 
    2525import copy 
    26 import numpy 
     26import numpy as np 
    2727from sas.sasgui.plottools.PlotPanel import PlotPanel 
    2828from sas.sasgui.plottools.plottables import Graph 
     
    298298        self.subplot.set_ylim(self.data.ymin, self.data.ymax) 
    299299        self.subplot.set_xlim(self.data.xmin, self.data.xmax) 
    300         mask = numpy.ones(len(self.data.mask), dtype=bool) 
     300        mask = np.ones(len(self.data.mask), dtype=bool) 
    301301        self.data.mask = mask 
    302302        # update mask plot 
     
    343343            self.mask = mask 
    344344        # make temperary data to plot 
    345         temp_mask = numpy.zeros(len(mask)) 
     345        temp_mask = np.zeros(len(mask)) 
    346346        temp_data = copy.deepcopy(self.data) 
    347347        # temp_data default is None 
  • 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/basepage.py

    rb301db9 red2276f  
    55import os 
    66import wx 
    7 import numpy 
     7import numpy as np 
    88import time 
    99import copy 
     
    100100        self.graph_id = None 
    101101        # Q range for data set 
    102         self.qmin_data_set = numpy.inf 
     102        self.qmin_data_set = np.inf 
    103103        self.qmax_data_set = None 
    104104        self.npts_data_set = 0 
     
    278278 
    279279        """ 
    280         x = numpy.linspace(start=self.qmin_x, stop=self.qmax_x, 
     280        x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 
    281281                           num=self.npts_x, endpoint=True) 
    282282        self.data = Data1D(x=x) 
     
    295295        """ 
    296296        if self.qmin_x >= 1.e-10: 
    297             qmin = numpy.log10(self.qmin_x) 
     297            qmin = np.log10(self.qmin_x) 
    298298        else: 
    299299            qmin = -10. 
    300300 
    301301        if self.qmax_x <= 1.e10: 
    302             qmax = numpy.log10(self.qmax_x) 
     302            qmax = np.log10(self.qmax_x) 
    303303        else: 
    304304            qmax = 10. 
    305305 
    306         x = numpy.logspace(start=qmin, stop=qmax, 
     306        x = np.logspace(start=qmin, stop=qmax, 
    307307                           num=self.npts_x, endpoint=True, base=10.0) 
    308308        self.data = Data1D(x=x) 
     
    341341        qstep = self.npts_x 
    342342 
    343         x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    344         y = numpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
     343        x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
     344        y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
    345345        # use data info instead 
    346         new_x = numpy.tile(x, (len(y), 1)) 
    347         new_y = numpy.tile(y, (len(x), 1)) 
     346        new_x = np.tile(x, (len(y), 1)) 
     347        new_y = np.tile(y, (len(x), 1)) 
    348348        new_y = new_y.swapaxes(0, 1) 
    349349        # all data reuire now in 1d array 
    350350        qx_data = new_x.flatten() 
    351351        qy_data = new_y.flatten() 
    352         q_data = numpy.sqrt(qx_data * qx_data + qy_data * qy_data) 
     352        q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 
    353353        # set all True (standing for unmasked) as default 
    354         mask = numpy.ones(len(qx_data), dtype=bool) 
     354        mask = np.ones(len(qx_data), dtype=bool) 
    355355        # store x and y bin centers in q space 
    356356        x_bins = x 
     
    358358 
    359359        self.data.source = Source() 
    360         self.data.data = numpy.ones(len(mask)) 
    361         self.data.err_data = numpy.ones(len(mask)) 
     360        self.data.data = np.ones(len(mask)) 
     361        self.data.err_data = np.ones(len(mask)) 
    362362        self.data.qx_data = qx_data 
    363363        self.data.qy_data = qy_data 
     
    783783                    # Skip non-data lines 
    784784                    logging.error(traceback.format_exc()) 
    785             return numpy.array(angles), numpy.array(weights) 
     785            return np.array(angles), np.array(weights) 
    786786        except: 
    787787            raise 
     
    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 
     
    21202107        for data in self.data_list: 
    21212108            # q value from qx and qy 
    2122             radius = numpy.sqrt(data.qx_data * data.qx_data + 
     2109            radius = np.sqrt(data.qx_data * data.qx_data + 
    21232110                                data.qy_data * data.qy_data) 
    21242111            # get unmasked index 
     
    21262113                         (radius <= float(self.qmax.GetValue())) 
    21272114            index_data = (index_data) & (data.mask) 
    2128             index_data = (index_data) & (numpy.isfinite(data.data)) 
     2115            index_data = (index_data) & (np.isfinite(data.data)) 
    21292116 
    21302117            if len(index_data[index_data]) < 10: 
     
    21612148            index_data = (float(self.qmin.GetValue()) <= radius) & \ 
    21622149                         (radius <= float(self.qmax.GetValue())) 
    2163             index_data = (index_data) & (numpy.isfinite(data.y)) 
     2150            index_data = (index_data) & (np.isfinite(data.y)) 
    21642151 
    21652152            if len(index_data[index_data]) < 5: 
     
    22332220 
    22342221                # Check that min is less than max 
    2235                 low = -numpy.inf if min_str == "" else float(min_str) 
    2236                 high = numpy.inf if max_str == "" else float(max_str) 
     2222                low = -np.inf if min_str == "" else float(min_str) 
     2223                high = np.inf if max_str == "" else float(max_str) 
    22372224                if high < low: 
    22382225                    min_ctrl.SetBackgroundColour("pink") 
     
    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): 
     
    26542631            self.qmin_x = data_min 
    26552632            self.qmax_x = math.sqrt(x * x + y * y) 
    2656             # self.data.mask = numpy.ones(len(self.data.data),dtype=bool) 
     2633            # self.data.mask = np.ones(len(self.data.data),dtype=bool) 
    26572634            # check smearing 
    26582635            if not self.disable_smearer.GetValue(): 
     
    33663343 
    33673344            if value[1] == 'array': 
    3368                 pd_vals = numpy.array(value[2]) 
    3369                 pd_weights = numpy.array(value[3]) 
     3345                pd_vals = np.array(value[2]) 
     3346                pd_weights = np.array(value[3]) 
    33703347                if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 
    33713348                    msg = ("bad array distribution parameters for %s" 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    rd85f1d8a red2276f  
    66import wx 
    77import wx.lib.newevent 
    8 import numpy 
     8import numpy as np 
    99import copy 
    1010import math 
     
    11151115            if item.GetValue(): 
    11161116                if button_list.index(item) == 0: 
    1117                     flag = 0  # dy = numpy.ones_like(dy_data) 
     1117                    flag = 0  # dy = np.ones_like(dy_data) 
    11181118                elif button_list.index(item) == 1: 
    11191119                    flag = 1  # dy = dy_data 
    11201120                elif button_list.index(item) == 2: 
    1121                     flag = 2  # dy = numpy.sqrt(numpy.abs(data)) 
     1121                    flag = 2  # dy = np.sqrt(np.abs(data)) 
    11221122                elif button_list.index(item) == 3: 
    1123                     flag = 3  # dy = numpy.abs(data) 
     1123                    flag = 3  # dy = np.abs(data) 
    11241124                break 
    11251125        return flag 
     
    14221422        key = event.GetKeyCode() 
    14231423        length = len(self.data.x) 
    1424         indx = (numpy.abs(self.data.x - x_data)).argmin() 
     1424        indx = (np.abs(self.data.x - x_data)).argmin() 
    14251425        # return array.flat[idx] 
    14261426        if key == wx.WXK_PAGEUP or key == wx.WXK_NUMPAD_PAGEUP: 
     
    14771477                    self.enable2D: 
    14781478                # set mask 
    1479                 radius = numpy.sqrt(self.data.qx_data * self.data.qx_data + 
     1479                radius = np.sqrt(self.data.qx_data * self.data.qx_data + 
    14801480                                    self.data.qy_data * self.data.qy_data) 
    14811481                index_data = ((self.qmin_x <= radius) & (radius <= self.qmax_x)) 
    14821482                index_data = (index_data) & (self.data.mask) 
    1483                 index_data = (index_data) & (numpy.isfinite(self.data.data)) 
     1483                index_data = (index_data) & (np.isfinite(self.data.data)) 
    14841484                if len(index_data[index_data]) < 10: 
    14851485                    msg = "Cannot Plot :No or too little npts in" 
     
    15981598                and data.dqx_data.any() != 0: 
    15991599                self.smear_type = "Pinhole2d" 
    1600                 self.dq_l = format_number(numpy.average(data.dqx_data)) 
    1601                 self.dq_r = format_number(numpy.average(data.dqy_data)) 
     1600                self.dq_l = format_number(np.average(data.dqx_data)) 
     1601                self.dq_r = format_number(np.average(data.dqy_data)) 
    16021602                return 
    16031603            else: 
    16041604                return 
    16051605        # check if it is pinhole smear and get min max if it is. 
    1606         if data.dx is not None and numpy.any(data.dx): 
     1606        if data.dx is not None and np.any(data.dx): 
    16071607            self.smear_type = "Pinhole" 
    16081608            self.dq_l = data.dx[0] 
     
    16121612        elif data.dxl is not None or data.dxw is not None: 
    16131613            self.smear_type = "Slit" 
    1614             if data.dxl is not None and numpy.all(data.dxl, 0): 
     1614            if data.dxl is not None and np.all(data.dxl, 0): 
    16151615                self.dq_l = data.dxl[0] 
    1616             if data.dxw is not None and numpy.all(data.dxw, 0): 
     1616            if data.dxw is not None and np.all(data.dxw, 0): 
    16171617                self.dq_r = data.dxw[0] 
    16181618        # return self.smear_type,self.dq_l,self.dq_r 
     
    18081808        if not flag: 
    18091809            self.onSmear(None) 
    1810  
    1811     def _mac_sleep(self, sec=0.2): 
    1812         """ 
    1813         Give sleep to MAC 
    1814         """ 
    1815         if self.is_mac: 
    1816             time.sleep(sec) 
    18171810 
    18181811    def get_view_mode(self): 
     
    19211914                self.default_mask = copy.deepcopy(self.data.mask) 
    19221915                if self.data.err_data is not None \ 
    1923                         and numpy.any(self.data.err_data): 
     1916                        and np.any(self.data.err_data): 
    19241917                    di_flag = True 
    19251918                if self.data.dqx_data is not None \ 
    1926                         and numpy.any(self.data.dqx_data): 
     1919                        and np.any(self.data.dqx_data): 
    19271920                    dq_flag = True 
    19281921            else: 
    19291922                self.slit_smearer.Enable(True) 
    19301923                self.pinhole_smearer.Enable(True) 
    1931                 if self.data.dy is not None and numpy.any(self.data.dy): 
     1924                if self.data.dy is not None and np.any(self.data.dy): 
    19321925                    di_flag = True 
    1933                 if self.data.dx is not None and numpy.any(self.data.dx): 
     1926                if self.data.dx is not None and np.any(self.data.dx): 
    19341927                    dq_flag = True 
    1935                 elif self.data.dxl is not None and numpy.any(self.data.dxl): 
     1928                elif self.data.dxl is not None and np.any(self.data.dxl): 
    19361929                    dq_flag = True 
    19371930 
     
    20672060        if self.data.__class__.__name__ == "Data2D" or \ 
    20682061                        self.enable2D: 
    2069             radius = numpy.sqrt(self.data.qx_data * self.data.qx_data + 
     2062            radius = np.sqrt(self.data.qx_data * self.data.qx_data + 
    20702063                                self.data.qy_data * self.data.qy_data) 
    20712064            index_data = (self.qmin_x <= radius) & (radius <= self.qmax_x) 
    20722065            index_data = (index_data) & (self.data.mask) 
    2073             index_data = (index_data) & (numpy.isfinite(self.data.data)) 
     2066            index_data = (index_data) & (np.isfinite(self.data.data)) 
    20742067            npts2fit = len(self.data.data[index_data]) 
    20752068        else: 
     
    21042097        # make sure stop button to fit button all the time 
    21052098        self._on_fit_complete() 
    2106         if out is None or not numpy.isfinite(chisqr): 
     2099        if out is None or not np.isfinite(chisqr): 
    21072100            raise ValueError, "Fit error occured..." 
    21082101 
     
    21152108 
    21162109        # Check if chi2 is finite 
    2117         if chisqr is not None and numpy.isfinite(chisqr): 
     2110        if chisqr is not None and np.isfinite(chisqr): 
    21182111            # format chi2 
    21192112            chi2 = format_number(chisqr, True) 
     
    21672160 
    21682161                        if cov[ind] is not None: 
    2169                             if numpy.isfinite(float(cov[ind])): 
     2162                            if np.isfinite(float(cov[ind])): 
    21702163                                val_err = format_number(cov[ind], True) 
    21712164                                item[4].SetForegroundColour(wx.BLACK) 
     
    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') 
     
    22912280            self.smear_type = 'Pinhole2d' 
    22922281            len_data = len(data.data) 
    2293             data.dqx_data = numpy.zeros(len_data) 
    2294             data.dqy_data = numpy.zeros(len_data) 
     2282            data.dqx_data = np.zeros(len_data) 
     2283            data.dqy_data = np.zeros(len_data) 
    22952284        else: 
    22962285            self.smear_type = 'Pinhole' 
    22972286            len_data = len(data.x) 
    2298             data.dx = numpy.zeros(len_data) 
     2287            data.dx = np.zeros(len_data) 
    22992288            data.dxl = None 
    23002289            data.dxw = None 
     
    24692458        try: 
    24702459            self.dxl = float(self.smear_slit_height.GetValue()) 
    2471             data.dxl = self.dxl * numpy.ones(data_len) 
     2460            data.dxl = self.dxl * np.ones(data_len) 
    24722461            self.smear_slit_height.SetBackgroundColour(wx.WHITE) 
    24732462        except: 
    24742463            self.dxl = None 
    2475             data.dxl = numpy.zeros(data_len) 
     2464            data.dxl = np.zeros(data_len) 
    24762465            if self.smear_slit_height.GetValue().lstrip().rstrip() != "": 
    24772466                self.smear_slit_height.SetBackgroundColour("pink") 
     
    24822471            self.dxw = float(self.smear_slit_width.GetValue()) 
    24832472            self.smear_slit_width.SetBackgroundColour(wx.WHITE) 
    2484             data.dxw = self.dxw * numpy.ones(data_len) 
     2473            data.dxw = self.dxw * np.ones(data_len) 
    24852474        except: 
    24862475            self.dxw = None 
    2487             data.dxw = numpy.zeros(data_len) 
     2476            data.dxw = np.zeros(data_len) 
    24882477            if self.smear_slit_width.GetValue().lstrip().rstrip() != "": 
    24892478                self.smear_slit_width.SetBackgroundColour("pink") 
     
    26122601            if event is None: 
    26132602                output = "-" 
    2614             elif not numpy.isfinite(event.output): 
     2603            elif not np.isfinite(event.output): 
    26152604                output = "-" 
    26162605            else: 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r4c5098c red2276f  
    1616import wx 
    1717import logging 
    18 import numpy 
     18import numpy as np 
    1919import time 
    2020from copy import deepcopy 
     
    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(): 
     
    13321323                    new_theory = copy_data.data 
    13331324                    new_theory[res.index] = res.theory 
    1334                     new_theory[res.index == False] = numpy.nan 
     1325                    new_theory[res.index == False] = np.nan 
    13351326                    correct_result = True 
    13361327                #get all fittable parameters of the current model 
     
    13411332                        param_list.remove(param) 
    13421333                if not correct_result or res.fitness is None or \ 
    1343                     not numpy.isfinite(res.fitness) or \ 
    1344                     numpy.any(res.pvec == None) or not \ 
    1345                     numpy.all(numpy.isfinite(res.pvec)): 
     1334                    not np.isfinite(res.fitness) or \ 
     1335                        np.any(res.pvec == None) or not \ 
     1336                        np.all(np.isfinite(res.pvec)): 
    13461337                    data_name = str(None) 
    13471338                    if data is not None: 
     
    13521343                    msg += "Data %s and Model %s did not fit.\n" % (data_name, 
    13531344                                                                    model_name) 
    1354                     ERROR = numpy.NAN 
     1345                    ERROR = np.NAN 
    13551346                    cell = BatchCell() 
    13561347                    cell.label = res.fitness 
     
    13661357                            batch_inputs["error on %s" % str(param)].append(ERROR) 
    13671358                else: 
    1368                     # TODO: Why sometimes res.pvec comes with numpy.float64? 
     1359                    # TODO: Why sometimes res.pvec comes with np.float64? 
    13691360                    # probably from scipy lmfit 
    1370                     if res.pvec.__class__ == numpy.float64: 
     1361                    if res.pvec.__class__ == np.float64: 
    13711362                        res.pvec = [res.pvec] 
    13721363 
     
    15201511            page_id = [] 
    15211512        ## fit more than 1 model at the same time 
    1522         self._mac_sleep(0.2) 
    15231513        try: 
    15241514            index = 0 
     
    15331523                fit_msg = res.mesg 
    15341524                if res.fitness is None or \ 
    1535                     not numpy.isfinite(res.fitness) or \ 
    1536                     numpy.any(res.pvec == None) or \ 
    1537                     not numpy.all(numpy.isfinite(res.pvec)): 
     1525                    not np.isfinite(res.fitness) or \ 
     1526                        np.any(res.pvec == None) or \ 
     1527                    not np.all(np.isfinite(res.pvec)): 
    15381528                    fit_msg += "\nFitting did not converge!!!" 
    15391529                    wx.CallAfter(self._update_fit_button, page_id) 
    15401530                else: 
    15411531                    #set the panel when fit result are float not list 
    1542                     if res.pvec.__class__ == numpy.float64: 
     1532                    if res.pvec.__class__ == np.float64: 
    15431533                        pvec = [res.pvec] 
    15441534                    else: 
    15451535                        pvec = res.pvec 
    1546                     if res.stderr.__class__ == numpy.float64: 
     1536                    if res.stderr.__class__ == np.float64: 
    15471537                        stderr = [res.stderr] 
    15481538                    else: 
     
    16921682        if dy is None: 
    16931683            new_plot.is_data = False 
    1694             new_plot.dy = numpy.zeros(len(y)) 
     1684            new_plot.dy = np.zeros(len(y)) 
    16951685            # If this is a theory curve, pick the proper symbol to make it a curve 
    16961686            new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM 
     
    17411731        """ 
    17421732        try: 
    1743             numpy.nan_to_num(y) 
     1733            np.nan_to_num(y) 
    17441734            new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 
    17451735                                             data_description=model.name, 
     
    18251815        that can be plot. 
    18261816        """ 
    1827         numpy.nan_to_num(image) 
     1817        np.nan_to_num(image) 
    18281818        new_plot = Data2D(image=image, err_image=data.err_data) 
    18291819        new_plot.name = model.name + '2d' 
     
    20172007        if data_copy.__class__.__name__ == "Data2D": 
    20182008            if index == None: 
    2019                 index = numpy.ones(len(data_copy.data), dtype=bool) 
     2009                index = np.ones(len(data_copy.data), dtype=bool) 
    20202010            if weight != None: 
    20212011                data_copy.err_data = weight 
    20222012            # get rid of zero error points 
    20232013            index = index & (data_copy.err_data != 0) 
    2024             index = index & (numpy.isfinite(data_copy.data)) 
     2014            index = index & (np.isfinite(data_copy.data)) 
    20252015            fn = data_copy.data[index] 
    20262016            theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 
     
    20322022            # 1 d theory from model_thread is only in the range of index 
    20332023            if index == None: 
    2034                 index = numpy.ones(len(data_copy.y), dtype=bool) 
     2024                index = np.ones(len(data_copy.y), dtype=bool) 
    20352025            if weight != None: 
    20362026                data_copy.dy = weight 
    20372027            if data_copy.dy == None or data_copy.dy == []: 
    2038                 dy = numpy.ones(len(data_copy.y)) 
     2028                dy = np.ones(len(data_copy.y)) 
    20392029            else: 
    20402030                ## Set consistently w/AbstractFitengine: 
     
    20572047            return 
    20582048 
    2059         residuals = res[numpy.isfinite(res)] 
     2049        residuals = res[np.isfinite(res)] 
    20602050        # get chisqr only w/finite 
    2061         chisqr = numpy.average(residuals * residuals) 
     2051        chisqr = np.average(residuals * residuals) 
    20622052 
    20632053        self._plot_residuals(page_id=page_id, data=data_copy, 
     
    20962086            residuals.qy_data = data_copy.qy_data 
    20972087            residuals.q_data = data_copy.q_data 
    2098             residuals.err_data = numpy.ones(len(residuals.data)) 
     2088            residuals.err_data = np.ones(len(residuals.data)) 
    20992089            residuals.xmin = min(residuals.qx_data) 
    21002090            residuals.xmax = max(residuals.qx_data) 
     
    21102100            # 1 d theory from model_thread is only in the range of index 
    21112101            if data_copy.dy == None or data_copy.dy == []: 
    2112                 dy = numpy.ones(len(data_copy.y)) 
     2102                dy = np.ones(len(data_copy.y)) 
    21132103            else: 
    21142104                if weight == None: 
    2115                     dy = numpy.ones(len(data_copy.y)) 
     2105                    dy = np.ones(len(data_copy.y)) 
    21162106                ## Set consitently w/AbstractFitengine: 
    21172107                ## But this should be corrected later. 
     
    21322122                residuals.y = (fn - gn[index]) / en 
    21332123            residuals.x = data_copy.x[index] 
    2134             residuals.dy = numpy.ones(len(residuals.y)) 
     2124            residuals.dy = np.ones(len(residuals.y)) 
    21352125            residuals.dx = None 
    21362126            residuals.dxl = None 
  • 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/pagestate.py

    r27109e5 red2276f  
    1818import copy 
    1919import logging 
    20 import numpy 
     20import numpy as np 
    2121import traceback 
    2222 
     
    410410        for fittable, name, value, _, uncert, lower, upper, units in params: 
    411411            if not value: 
    412                 value = numpy.nan 
     412                value = np.nan 
    413413            if not uncert or uncert[1] == '' or uncert[1] == 'None': 
    414414                uncert[0] = False 
    415                 uncert[1] = numpy.nan 
     415                uncert[1] = np.nan 
    416416            if not upper or upper[1] == '' or upper[1] == 'None': 
    417417                upper[0] = False 
    418                 upper[1] = numpy.nan 
     418                upper[1] = np.nan 
    419419            if not lower or lower[1] == '' or lower[1] == 'None': 
    420420                lower[0] = False 
    421                 lower[1] = numpy.nan 
     421                lower[1] = np.nan 
    422422            if is_string: 
    423423                p[name] = str(value) 
     
    449449                lower = params.get(name + ".lower", '-inf') 
    450450                units = params.get(name + ".units") 
    451                 if std is not None and std is not numpy.nan: 
     451                if std is not None and std is not np.nan: 
    452452                    std = [True, str(std)] 
    453453                else: 
    454454                    std = [False, ''] 
    455                 if lower is not None and lower is not numpy.nan: 
     455                if lower is not None and lower is not np.nan: 
    456456                    lower = [True, str(lower)] 
    457457                else: 
    458458                    lower = [True, '-inf'] 
    459                 if upper is not None and upper is not numpy.nan: 
     459                if upper is not None and upper is not np.nan: 
    460460                    upper = [True, str(upper)] 
    461461                else: 
     
    11001100                                       % (line, tagname, name)) 
    11011101                                logging.error(msg + traceback.format_exc()) 
    1102                         dic[name] = numpy.array(value_list) 
     1102                        dic[name] = np.array(value_list) 
    11031103                    setattr(self, varname, dic) 
    11041104 
  • 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) 
  • src/sas/sasgui/plottools/PlotPanel.py

    r198fa76 r9a5097c  
    2929DEFAULT_CMAP = pylab.cm.jet 
    3030import copy 
    31 import numpy 
     31import numpy as np 
    3232 
    3333from sas.sasgui.guiframe.events import StatusEvent 
     
    14521452                if  self.zmin_2D <= 0  and len(output[output > 0]) > 0: 
    14531453                    zmin_temp = self.zmin_2D 
    1454                     output[output > 0] = numpy.log10(output[output > 0]) 
     1454                    output[output > 0] = np.log10(output[output > 0]) 
    14551455                    #In log scale Negative values are not correct in general 
    1456                     #output[output<=0] = math.log(numpy.min(output[output>0])) 
     1456                    #output[output<=0] = math.log(np.min(output[output>0])) 
    14571457                elif self.zmin_2D <= 0: 
    14581458                    zmin_temp = self.zmin_2D 
    1459                     output[output > 0] = numpy.zeros(len(output)) 
     1459                    output[output > 0] = np.zeros(len(output)) 
    14601460                    output[output <= 0] = -32 
    14611461                else: 
    14621462                    zmin_temp = self.zmin_2D 
    1463                     output[output > 0] = numpy.log10(output[output > 0]) 
     1463                    output[output > 0] = np.log10(output[output > 0]) 
    14641464                    #In log scale Negative values are not correct in general 
    1465                     #output[output<=0] = math.log(numpy.min(output[output>0])) 
     1465                    #output[output<=0] = math.log(np.min(output[output>0])) 
    14661466            except: 
    14671467                #Too many problems in 2D plot with scale 
     
    14921492            X = self.x_bins[0:-1] 
    14931493            Y = self.y_bins[0:-1] 
    1494             X, Y = numpy.meshgrid(X, Y) 
     1494            X, Y = np.meshgrid(X, Y) 
    14951495 
    14961496            try: 
     
    15551555        # 1d array to use for weighting the data point averaging 
    15561556        #when they fall into a same bin. 
    1557         weights_data = numpy.ones([self.data.size]) 
     1557        weights_data = np.ones([self.data.size]) 
    15581558        # get histogram of ones w/len(data); this will provide 
    15591559        #the weights of data on each bins 
    1560         weights, xedges, yedges = numpy.histogram2d(x=self.qy_data, 
     1560        weights, xedges, yedges = np.histogram2d(x=self.qy_data, 
    15611561                                                    y=self.qx_data, 
    15621562                                                    bins=[self.y_bins, self.x_bins], 
    15631563                                                    weights=weights_data) 
    15641564        # get histogram of data, all points into a bin in a way of summing 
    1565         image, xedges, yedges = numpy.histogram2d(x=self.qy_data, 
     1565        image, xedges, yedges = np.histogram2d(x=self.qy_data, 
    15661566                                                  y=self.qx_data, 
    15671567                                                  bins=[self.y_bins, self.x_bins], 
     
    15811581        # do while loop until all vacant bins are filled up up 
    15821582        #to loop = max_loop 
    1583         while not(numpy.isfinite(image[weights == 0])).all(): 
     1583        while not(np.isfinite(image[weights == 0])).all(): 
    15841584            if loop >= max_loop:  # this protects never-ending loop 
    15851585                break 
     
    16301630 
    16311631        # store x and y bin centers in q space 
    1632         x_bins = numpy.linspace(xmin, xmax, npix_x) 
    1633         y_bins = numpy.linspace(ymin, ymax, npix_y) 
     1632        x_bins = np.linspace(xmin, xmax, npix_x) 
     1633        y_bins = np.linspace(ymin, ymax, npix_y) 
    16341634 
    16351635        #set x_bins and y_bins 
     
    16501650        """ 
    16511651        # No image matrix given 
    1652         if image == None or numpy.ndim(image) != 2 \ 
    1653                 or numpy.isfinite(image).all() \ 
     1652        if image == None or np.ndim(image) != 2 \ 
     1653                or np.isfinite(image).all() \ 
    16541654                or weights == None: 
    16551655            return image 
     
    16571657        len_y = len(image) 
    16581658        len_x = len(image[1]) 
    1659         temp_image = numpy.zeros([len_y, len_x]) 
    1660         weit = numpy.zeros([len_y, len_x]) 
     1659        temp_image = np.zeros([len_y, len_x]) 
     1660        weit = np.zeros([len_y, len_x]) 
    16611661        # do for-loop for all pixels 
    16621662        for n_y in range(len(image)): 
    16631663            for n_x in range(len(image[1])): 
    16641664                # find only null pixels 
    1665                 if weights[n_y][n_x] > 0 or numpy.isfinite(image[n_y][n_x]): 
     1665                if weights[n_y][n_x] > 0 or np.isfinite(image[n_y][n_x]): 
    16661666                    continue 
    16671667                else: 
    16681668                    # find 4 nearest neighbors 
    16691669                    # check where or not it is at the corner 
    1670                     if n_y != 0 and numpy.isfinite(image[n_y - 1][n_x]): 
     1670                    if n_y != 0 and np.isfinite(image[n_y - 1][n_x]): 
    16711671                        temp_image[n_y][n_x] += image[n_y - 1][n_x] 
    16721672                        weit[n_y][n_x] += 1 
    1673                     if n_x != 0 and numpy.isfinite(image[n_y][n_x - 1]): 
     1673                    if n_x != 0 and np.isfinite(image[n_y][n_x - 1]): 
    16741674                        temp_image[n_y][n_x] += image[n_y][n_x - 1] 
    16751675                        weit[n_y][n_x] += 1 
    1676                     if n_y != len_y - 1 and numpy.isfinite(image[n_y + 1][n_x]): 
     1676                    if n_y != len_y - 1 and np.isfinite(image[n_y + 1][n_x]): 
    16771677                        temp_image[n_y][n_x] += image[n_y + 1][n_x] 
    16781678                        weit[n_y][n_x] += 1 
    1679                     if n_x != len_x - 1 and numpy.isfinite(image[n_y][n_x + 1]): 
     1679                    if n_x != len_x - 1 and np.isfinite(image[n_y][n_x + 1]): 
    16801680                        temp_image[n_y][n_x] += image[n_y][n_x + 1] 
    16811681                        weit[n_y][n_x] += 1 
    16821682                    # go 4 next nearest neighbors when no non-zero 
    16831683                    # neighbor exists 
    1684                     if n_y != 0 and n_x != 0 and\ 
    1685                          numpy.isfinite(image[n_y - 1][n_x - 1]): 
     1684                    if n_y != 0 and n_x != 0 and \ 
     1685                            np.isfinite(image[n_y - 1][n_x - 1]): 
    16861686                        temp_image[n_y][n_x] += image[n_y - 1][n_x - 1] 
    16871687                        weit[n_y][n_x] += 1 
    16881688                    if n_y != len_y - 1 and n_x != 0 and \ 
    1689                         numpy.isfinite(image[n_y + 1][n_x - 1]): 
     1689                            np.isfinite(image[n_y + 1][n_x - 1]): 
    16901690                        temp_image[n_y][n_x] += image[n_y + 1][n_x - 1] 
    16911691                        weit[n_y][n_x] += 1 
    16921692                    if n_y != len_y and n_x != len_x - 1 and \ 
    1693                         numpy.isfinite(image[n_y - 1][n_x + 1]): 
     1693                            np.isfinite(image[n_y - 1][n_x + 1]): 
    16941694                        temp_image[n_y][n_x] += image[n_y - 1][n_x + 1] 
    16951695                        weit[n_y][n_x] += 1 
    16961696                    if n_y != len_y - 1 and n_x != len_x - 1 and \ 
    1697                         numpy.isfinite(image[n_y + 1][n_x + 1]): 
     1697                            np.isfinite(image[n_y + 1][n_x + 1]): 
    16981698                        temp_image[n_y][n_x] += image[n_y + 1][n_x + 1] 
    16991699                        weit[n_y][n_x] += 1 
  • src/sas/sasgui/plottools/fitDialog.py

    rdd5bf63 r9a5097c  
    22from plottables import Theory1D 
    33import math 
    4 import numpy 
     4import numpy as np 
    55import fittings 
    66import transform 
     
    482482 
    483483                if self.xLabel.lower() == "log10(x)": 
    484                     tempdy = numpy.asarray(tempdy) 
     484                    tempdy = np.asarray(tempdy) 
    485485                    tempdy[tempdy == 0] = 1 
    486486                    chisqr, out, cov = fittings.sasfit(self.model, 
     
    491491                                                       math.log10(xmax)) 
    492492                else: 
    493                     tempdy = numpy.asarray(tempdy) 
     493                    tempdy = np.asarray(tempdy) 
    494494                    tempdy[tempdy == 0] = 1 
    495495                    chisqr, out, cov = fittings.sasfit(self.model, 
     
    572572        if self.rg_on: 
    573573            if self.Rg_tctr.IsShown(): 
    574                 rg = numpy.sqrt(-3 * float(cstA)) 
     574                rg = np.sqrt(-3 * float(cstA)) 
    575575                value = format_number(rg) 
    576576                self.Rg_tctr.SetValue(value) 
    577577                if self.I0_tctr.IsShown(): 
    578                     val = numpy.exp(cstB) 
     578                    val = np.exp(cstB) 
    579579                    self.I0_tctr.SetValue(format_number(val)) 
    580580            if self.Rgerr_tctr.IsShown(): 
     
    585585                self.Rgerr_tctr.SetValue(value) 
    586586                if self.I0err_tctr.IsShown(): 
    587                     val = numpy.abs(numpy.exp(cstB) * errB) 
     587                    val = np.abs(np.exp(cstB) * errB) 
    588588                    self.I0err_tctr.SetValue(format_number(val)) 
    589589            if self.Diameter_tctr.IsShown(): 
    590                 rg = numpy.sqrt(-2 * float(cstA)) 
    591                 _diam = 4 * numpy.sqrt(-float(cstA)) 
     590                rg = np.sqrt(-2 * float(cstA)) 
     591                _diam = 4 * np.sqrt(-float(cstA)) 
    592592                value = format_number(_diam) 
    593593                self.Diameter_tctr.SetValue(value) 
  • src/sas/sasgui/plottools/plottables.py

    ra9f579c r9a5097c  
    4343# Support for ancient python versions 
    4444import copy 
    45 import numpy 
     45import numpy as np 
    4646import sys 
    4747import logging 
     
    706706                self.dy = None 
    707707            if not has_err_x: 
    708                 dx = numpy.zeros(len(x)) 
     708                dx = np.zeros(len(x)) 
    709709            if not has_err_y: 
    710                 dy = numpy.zeros(len(y)) 
     710                dy = np.zeros(len(y)) 
    711711            for i in range(len(x)): 
    712712                try: 
     
    796796        tempdy = [] 
    797797        if self.dx == None: 
    798             self.dx = numpy.zeros(len(self.x)) 
     798            self.dx = np.zeros(len(self.x)) 
    799799        if self.dy == None: 
    800             self.dy = numpy.zeros(len(self.y)) 
     800            self.dy = np.zeros(len(self.y)) 
    801801        if self.xLabel == "log10(x)": 
    802802            for i in range(len(self.x)): 
     
    826826        tempdy = [] 
    827827        if self.dx == None: 
    828             self.dx = numpy.zeros(len(self.x)) 
     828            self.dx = np.zeros(len(self.x)) 
    829829        if self.dy == None: 
    830             self.dy = numpy.zeros(len(self.y)) 
     830            self.dy = np.zeros(len(self.y)) 
    831831        if self.yLabel == "log10(y)": 
    832832            for i in range(len(self.x)): 
     
    859859        tempdy = [] 
    860860        if self.dx == None: 
    861             self.dx = numpy.zeros(len(self.x)) 
     861            self.dx = np.zeros(len(self.x)) 
    862862        if self.dy == None: 
    863             self.dy = numpy.zeros(len(self.y)) 
     863            self.dy = np.zeros(len(self.y)) 
    864864        if xmin != None and xmax != None: 
    865865            for i in range(len(self.x)): 
     
    12281228 
    12291229def sample_graph(): 
    1230     import numpy as nx 
     1230    import numpy as np 
    12311231 
    12321232    # Construct a simple graph 
    12331233    if False: 
    1234         x = nx.array([1, 2, 3, 4, 5, 6], 'd') 
    1235         y = nx.array([4, 5, 6, 5, 4, 5], 'd') 
    1236         dy = nx.array([0.2, 0.3, 0.1, 0.2, 0.9, 0.3]) 
     1234        x = np.array([1, 2, 3, 4, 5, 6], 'd') 
     1235        y = np.array([4, 5, 6, 5, 4, 5], 'd') 
     1236        dy = np.array([0.2, 0.3, 0.1, 0.2, 0.9, 0.3]) 
    12371237    else: 
    1238         x = nx.linspace(0, 1., 10000) 
    1239         y = nx.sin(2 * nx.pi * x * 2.8) 
    1240         dy = nx.sqrt(100 * nx.abs(y)) / 100 
     1238        x = np.linspace(0, 1., 10000) 
     1239        y = np.sin(2 * np.pi * x * 2.8) 
     1240        dy = np.sqrt(100 * np.abs(y)) / 100 
    12411241    data = Data1D(x, y, dy=dy) 
    12421242    data.xaxis('distance', 'm') 
Note: See TracChangeset for help on using the changeset viewer.