Ignore:
Timestamp:
Mar 26, 2017 11:33:16 PM (7 years ago)
Author:
andyfaff
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
ed2276f
Parents:
9146ed9
Message:

MAINT: import numpy as np

File:
1 edited

Legend:

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

    rb301db9 r9a5097c  
    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 
     
    21202120        for data in self.data_list: 
    21212121            # q value from qx and qy 
    2122             radius = numpy.sqrt(data.qx_data * data.qx_data + 
     2122            radius = np.sqrt(data.qx_data * data.qx_data + 
    21232123                                data.qy_data * data.qy_data) 
    21242124            # get unmasked index 
     
    21262126                         (radius <= float(self.qmax.GetValue())) 
    21272127            index_data = (index_data) & (data.mask) 
    2128             index_data = (index_data) & (numpy.isfinite(data.data)) 
     2128            index_data = (index_data) & (np.isfinite(data.data)) 
    21292129 
    21302130            if len(index_data[index_data]) < 10: 
     
    21612161            index_data = (float(self.qmin.GetValue()) <= radius) & \ 
    21622162                         (radius <= float(self.qmax.GetValue())) 
    2163             index_data = (index_data) & (numpy.isfinite(data.y)) 
     2163            index_data = (index_data) & (np.isfinite(data.y)) 
    21642164 
    21652165            if len(index_data[index_data]) < 5: 
     
    22332233 
    22342234                # 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) 
     2235                low = -np.inf if min_str == "" else float(min_str) 
     2236                high = np.inf if max_str == "" else float(max_str) 
    22372237                if high < low: 
    22382238                    min_ctrl.SetBackgroundColour("pink") 
     
    26542654            self.qmin_x = data_min 
    26552655            self.qmax_x = math.sqrt(x * x + y * y) 
    2656             # self.data.mask = numpy.ones(len(self.data.data),dtype=bool) 
     2656            # self.data.mask = np.ones(len(self.data.data),dtype=bool) 
    26572657            # check smearing 
    26582658            if not self.disable_smearer.GetValue(): 
     
    33663366 
    33673367            if value[1] == 'array': 
    3368                 pd_vals = numpy.array(value[2]) 
    3369                 pd_weights = numpy.array(value[3]) 
     3368                pd_vals = np.array(value[2]) 
     3369                pd_weights = np.array(value[3]) 
    33703370                if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 
    33713371                    msg = ("bad array distribution parameters for %s" 
Note: See TracChangeset for help on using the changeset viewer.