Ignore:
Timestamp:
Jun 23, 2017 4:16:29 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
98e3f24
Parents:
81b35396
git-author:
Paul Kienzle <pkienzle@…> (06/21/17 12:38:48)
git-committer:
Paul Kienzle <pkienzle@…> (06/23/17 16:16:29)
Message:

code cleanup

File:
1 edited

Legend:

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

    r7432acb rba8d326  
    11""" 
    2     Calculation thread for modeling 
     2Calculation thread for modeling 
    33""" 
    44 
     
    2828                 worktime=0.04, 
    2929                 exception_handler=None, 
    30                  ): 
     30                ): 
    3131        CalcThread.__init__(self, completefn, updatefn, yieldtime, worktime, 
    3232                            exception_handler=exception_handler) 
     
    5757        if self.qmax is None: 
    5858            if self.data is not None: 
    59                 newx = math.pow(max(math.fabs(self.data.xmax), 
    60                                    math.fabs(self.data.xmin)), 2) 
    61                 newy = math.pow(max(math.fabs(self.data.ymax), 
    62                                    math.fabs(self.data.ymin)), 2) 
    63                 self.qmax = math.sqrt(newx + newy) 
     59                newx = max(math.fabs(self.data.xmax), math.fabs(self.data.xmin)) 
     60                newy = max(math.fabs(self.data.ymax), math.fabs(self.data.ymin)) 
     61                self.qmax = math.sqrt(newx**2 + newy**2) 
    6462 
    6563        if self.data is None: 
     
    6866 
    6967        # Define matrix where data will be plotted 
    70         radius = np.sqrt((self.data.qx_data * self.data.qx_data) + \ 
    71                     (self.data.qy_data * self.data.qy_data)) 
    72  
    73         # For theory, qmax is based on 1d qmax  
     68        radius = np.sqrt(self.data.qx_data**2 + self.data.qy_data**2) 
     69 
     70        # For theory, qmax is based on 1d qmax 
    7471        # so that must be mulitified by sqrt(2) to get actual max for 2d 
    7572        index_model = (self.qmin <= radius) & (radius <= self.qmax) 
    76         index_model = index_model & self.data.mask 
    77         index_model = index_model & np.isfinite(self.data.data) 
     73        index_model &= self.data.mask 
     74        index_model &= np.isfinite(self.data.data) 
    7875 
    7976        if self.smearer is not None: 
     
    10097        elapsed = time.time() - self.starttime 
    10198        self.complete(image=output, 
    102                        data=self.data, 
    103                        page_id=self.page_id, 
    104                        model=self.model, 
    105                        state=self.state, 
    106                        toggle_mode_on=self.toggle_mode_on, 
    107                        elapsed=elapsed, 
    108                        index=index_model, 
    109                        fid=self.fid, 
    110                        qmin=self.qmin, 
    111                        qmax=self.qmax, 
    112                        weight=self.weight, 
    113                        #qstep=self.qstep, 
    114                        update_chisqr=self.update_chisqr, 
    115                        source=self.source) 
     99                      data=self.data, 
     100                      page_id=self.page_id, 
     101                      model=self.model, 
     102                      state=self.state, 
     103                      toggle_mode_on=self.toggle_mode_on, 
     104                      elapsed=elapsed, 
     105                      index=index_model, 
     106                      fid=self.fid, 
     107                      qmin=self.qmin, 
     108                      qmax=self.qmax, 
     109                      weight=self.weight, 
     110                      #qstep=self.qstep, 
     111                      update_chisqr=self.update_chisqr, 
     112                      source=self.source) 
    116113 
    117114 
     
    137134                 worktime=0.01, 
    138135                 exception_handler=None, 
    139                  ): 
     136                ): 
    140137        """ 
    141138        """ 
     
    192189                                                        * unsmeared_output[first_bin:last_bin+1]\ 
    193190                                                        / output[first_bin:last_bin+1] 
    194                 unsmeared_output=unsmeared_output[index] 
    195                 unsmeared_data=unsmeared_data[index] 
    196                 unsmeared_error=unsmeared_error 
     191                unsmeared_output = unsmeared_output[index] 
     192                unsmeared_data = unsmeared_data[index] 
     193                unsmeared_error = unsmeared_error 
    197194        else: 
    198195            output[index] = self.model.evalDistribution(self.data.x[index]) 
Note: See TracChangeset for help on using the changeset viewer.