Changeset 4331b05e in sasview


Ignore:
Timestamp:
Jul 6, 2009 5:01:12 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
27fea3f
Parents:
e7b1ccf
Message:

allow fit with smearing for range different of range of data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/AbstractFitEngine.py

    r24b8d5c r4331b05e  
    259259      
    260260        dy[dy==0]=1 
    261         #idx = (x>=self.qmin) & (x <= self.qmax) 
    262    
     261        
    263262        # Compute theory data f(x) 
    264         #fx = numpy.zeros(len(x)) 
    265263        tempy=[] 
     264        fx=numpy.zeros(len(y)) 
     265        tempdy=[] 
     266        index=[] 
    266267        tempfx=[] 
    267         tempdy=[] 
    268         #fx[idx] = numpy.asarray([fn(v) for v in x[idx]]) 
    269268        for i_x in  range(len(x)): 
    270269            try: 
    271270                if self.qmin <=x[i_x] and x[i_x]<=self.qmax: 
    272271                    value= fn(x[i_x]) 
    273                     tempfx.append( value) 
     272                    fx[i_x] =value 
    274273                    tempy.append(y[i_x]) 
    275274                    tempdy.append(dy[i_x]) 
     275                    index.append(i_x) 
    276276            except: 
    277277                ## skip error for model.run(x) 
     
    280280        ## Smear theory data 
    281281        if self.smearer is not None: 
    282             tempfx = self.smearer(tempfx) 
     282            fx = self.smearer(fx) 
     283             
     284        for i in index: 
     285            tempfx.append(fx[i]) 
     286       
    283287        newy= numpy.asarray(tempy) 
    284288        newfx= numpy.asarray(tempfx) 
    285289        newdy= numpy.asarray(tempdy) 
    286290        
    287         
    288291        ## Sanity check 
    289292        if numpy.size(newdy)!= numpy.size(newfx): 
    290293            raise RuntimeError, "FitData1D: invalid error array" 
    291         #return (y[idx] - fx[idx])/dy[idx] 
    292294        
    293295        return (newy- newfx)/newdy 
Note: See TracChangeset for help on using the changeset viewer.