Changeset 94078a8 in sasview


Ignore:
Timestamp:
Oct 20, 2011 11:57:11 AM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
2d98490
Parents:
e947cd4
Message:

check npts for all 1d data in batch mode

Location:
fittingview/src/sans/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fittingview/src/sans/perspectives/fitting/basepage.py

    rdbbdf11 r94078a8  
    14411441            else: 
    14421442                self.fitrange = False     
    1443              
    14441443            ## if any value is modify draw model with new value 
    14451444            if not self.fitrange: 
     
    22252224             
    22262225        return flag 
     2226 
     2227    def _validate_Npts_1D(self):   
     2228        """ 
     2229        Validate the number of points for fitting is more than 5 points. 
     2230        If valid, setvalues Npts_fit otherwise post msg. 
     2231        """ 
     2232        #default flag 
     2233        flag = True 
     2234        # Theory 
     2235        if self.data == None: 
     2236            return flag 
     2237        for data in self.data_list: 
     2238            # q value from qx and qy 
     2239            radius= data.x 
     2240            #get unmasked index 
     2241            index_data = (float(self.qmin.GetValue()) <= radius) & \ 
     2242                            (radius <= float(self.qmax.GetValue())) 
     2243            index_data = (index_data) & (numpy.isfinite(data.y)) 
     2244 
     2245            if len(index_data[index_data]) < 5: 
     2246                # change the color pink. 
     2247                self.qmin.SetBackgroundColour("pink") 
     2248                self.qmin.Refresh() 
     2249                self.qmax.SetBackgroundColour("pink") 
     2250                self.qmax.Refresh() 
     2251                msg= "Npts of Data Error :No or too little npts of %s."% data.name 
     2252                wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 
     2253                self.fitrange = False 
     2254                flag = False 
     2255            else: 
     2256                self.Npts_fit.SetValue(str(len(index_data[index_data==True]))) 
     2257                self.fitrange = True 
     2258             
     2259        return flag 
     2260 
     2261 
    22272262     
    22282263    def _check_value_enter(self, list, modified): 
  • fittingview/src/sans/perspectives/fitting/fitpage.py

    re947cd4 r94078a8  
    11101110         
    11111111        flag = self._update_paramv_on_fit()  
     1112         
     1113        if self.batch_on and not self._is_2D(): 
     1114            if not self._validate_Npts_1D(): 
     1115                return 
    11121116                 
    11131117        if not flag: 
Note: See TracChangeset for help on using the changeset viewer.