Ignore:
Timestamp:
Apr 4, 2017 10:50:04 AM (7 years ago)
Author:
Ricardo Ferraz Leal <ricleal@…>
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:
f2940c4
Parents:
463e7ffc (diff), 1779e72 (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:

After merge conflict

File:
1 edited

Legend:

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

    r463e7ffc r9c0f3c17  
    55import os 
    66import wx 
    7 import numpy 
     7import numpy as np 
    88import time 
    99import copy 
     
    101101        self.graph_id = None 
    102102        # Q range for data set 
    103         self.qmin_data_set = numpy.inf 
     103        self.qmin_data_set = np.inf 
    104104        self.qmax_data_set = None 
    105105        self.npts_data_set = 0 
     
    279279 
    280280        """ 
    281         x = numpy.linspace(start=self.qmin_x, stop=self.qmax_x, 
     281        x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 
    282282                           num=self.npts_x, endpoint=True) 
    283283        self.data = Data1D(x=x) 
     
    296296        """ 
    297297        if self.qmin_x >= 1.e-10: 
    298             qmin = numpy.log10(self.qmin_x) 
     298            qmin = np.log10(self.qmin_x) 
    299299        else: 
    300300            qmin = -10. 
    301301 
    302302        if self.qmax_x <= 1.e10: 
    303             qmax = numpy.log10(self.qmax_x) 
     303            qmax = np.log10(self.qmax_x) 
    304304        else: 
    305305            qmax = 10. 
    306306 
    307         x = numpy.logspace(start=qmin, stop=qmax, 
     307        x = np.logspace(start=qmin, stop=qmax, 
    308308                           num=self.npts_x, endpoint=True, base=10.0) 
    309309        self.data = Data1D(x=x) 
     
    342342        qstep = self.npts_x 
    343343 
    344         x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    345         y = numpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
     344        x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
     345        y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
    346346        # use data info instead 
    347         new_x = numpy.tile(x, (len(y), 1)) 
    348         new_y = numpy.tile(y, (len(x), 1)) 
     347        new_x = np.tile(x, (len(y), 1)) 
     348        new_y = np.tile(y, (len(x), 1)) 
    349349        new_y = new_y.swapaxes(0, 1) 
    350350        # all data reuire now in 1d array 
    351351        qx_data = new_x.flatten() 
    352352        qy_data = new_y.flatten() 
    353         q_data = numpy.sqrt(qx_data * qx_data + qy_data * qy_data) 
     353        q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 
    354354        # set all True (standing for unmasked) as default 
    355         mask = numpy.ones(len(qx_data), dtype=bool) 
     355        mask = np.ones(len(qx_data), dtype=bool) 
    356356        # store x and y bin centers in q space 
    357357        x_bins = x 
     
    359359 
    360360        self.data.source = Source() 
    361         self.data.data = numpy.ones(len(mask)) 
    362         self.data.err_data = numpy.ones(len(mask)) 
     361        self.data.data = np.ones(len(mask)) 
     362        self.data.err_data = np.ones(len(mask)) 
    363363        self.data.qx_data = qx_data 
    364364        self.data.qy_data = qy_data 
     
    784784                    # Skip non-data lines 
    785785                    logger.error(traceback.format_exc()) 
    786             return numpy.array(angles), numpy.array(weights) 
     786            return np.array(angles), np.array(weights) 
    787787        except: 
    788788            raise 
     
    14501450                self.state_change = True 
    14511451                self._draw_model() 
    1452                 # Time delay has been introduced to prevent _handle error 
    1453                 # on Windows 
    1454                 # This part of code is executed when model is selected and 
    1455                 # it's parameters are changed (with respect to previously 
    1456                 # selected model). There are two Iq evaluations occuring one 
    1457                 # after another and therefore there may be compilation error 
    1458                 # if model is calculated for the first time. 
    1459                 # This seems to be Windows only issue - haven't tested on Linux 
    1460                 # though.The proper solution (other than time delay) requires 
    1461                 # more fundemental code refatoring 
    1462                 # Wojtek P. Nov 7, 2016 
    1463                 if not ON_MAC: 
    1464                     time.sleep(0.1) 
    14651452                self.Refresh() 
    14661453 
     
    21212108        for data in self.data_list: 
    21222109            # q value from qx and qy 
    2123             radius = numpy.sqrt(data.qx_data * data.qx_data + 
     2110            radius = np.sqrt(data.qx_data * data.qx_data + 
    21242111                                data.qy_data * data.qy_data) 
    21252112            # get unmasked index 
     
    21272114                         (radius <= float(self.qmax.GetValue())) 
    21282115            index_data = (index_data) & (data.mask) 
    2129             index_data = (index_data) & (numpy.isfinite(data.data)) 
     2116            index_data = (index_data) & (np.isfinite(data.data)) 
    21302117 
    21312118            if len(index_data[index_data]) < 10: 
     
    21622149            index_data = (float(self.qmin.GetValue()) <= radius) & \ 
    21632150                         (radius <= float(self.qmax.GetValue())) 
    2164             index_data = (index_data) & (numpy.isfinite(data.y)) 
     2151            index_data = (index_data) & (np.isfinite(data.y)) 
    21652152 
    21662153            if len(index_data[index_data]) < 5: 
     
    22342221 
    22352222                # Check that min is less than max 
    2236                 low = -numpy.inf if min_str == "" else float(min_str) 
    2237                 high = numpy.inf if max_str == "" else float(max_str) 
     2223                low = -np.inf if min_str == "" else float(min_str) 
     2224                high = np.inf if max_str == "" else float(max_str) 
    22382225                if high < low: 
    22392226                    min_ctrl.SetBackgroundColour("pink") 
     
    26102597            Layout is called after fitting. 
    26112598        """ 
    2612         self._sleep4sec() 
    26132599        self.Layout() 
    26142600        return 
    2615  
    2616     def _sleep4sec(self): 
    2617         """ 
    2618             sleep for 1 sec only applied on Mac 
    2619             Note: This 1sec helps for Mac not to crash on self. 
    2620             Layout after self._draw_model 
    2621         """ 
    2622         if ON_MAC: 
    2623             time.sleep(1) 
    26242601 
    26252602    def _find_polyfunc_selection(self, disp_func=None): 
     
    26552632            self.qmin_x = data_min 
    26562633            self.qmax_x = math.sqrt(x * x + y * y) 
    2657             # self.data.mask = numpy.ones(len(self.data.data),dtype=bool) 
     2634            # self.data.mask = np.ones(len(self.data.data),dtype=bool) 
    26582635            # check smearing 
    26592636            if not self.disable_smearer.GetValue(): 
     
    33673344 
    33683345            if value[1] == 'array': 
    3369                 pd_vals = numpy.array(value[2]) 
    3370                 pd_weights = numpy.array(value[3]) 
     3346                pd_vals = np.array(value[2]) 
     3347                pd_weights = np.array(value[3]) 
    33713348                if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 
    33723349                    msg = ("bad array distribution parameters for %s" 
Note: See TracChangeset for help on using the changeset viewer.