Changeset 25a92d1 in sasview for Invariant


Ignore:
Timestamp:
Dec 18, 2009 3:37:23 PM (15 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:
6e74ee4
Parents:
c8c4fa1
Message:

took care of dy when there's no dy data in fit function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Invariant/invariant.py

    reb62193 r25a92d1  
    121121        power = power 
    122122        fx = numpy.zeros(len(self.data.x)) 
    123         sigma = numpy.zeros(len(self.data.x)) 
     123        one = numpy.ones(len(self.data.x)) 
    124124 
    125125        #define dy^2 
    126         sigma = self.data.dy[self.idx_unsmeared ] 
     126        try: 
     127            sigma = self.data.dy[self.idx_unsmeared ] 
     128        except: 
     129            print "The dy data for Invariant calculation should be prepared before get to FitFunctor.fit()..." 
     130            sigma = one[self.idx_unsmeared ] 
    127131        sigma2 = sigma*sigma 
    128132 
     
    199203            raise ValueError,"Data must be of type DataLoader.Data1D" 
    200204        new_data = self._scale * data - self._background 
    201         new_data.dy = data.dy 
    202         new_data.dxl = data.dxl 
    203         new_data.dxw = data.dxw 
     205        try: 
     206            #All data should pass here. 
     207            new_data.dy = data.dy 
     208            new_data.dxl = data.dxl 
     209            new_data.dxw = data.dxw         
     210        except: 
     211            #in case... 
     212            new_data.dy = numpy.ones(len(data.x)) 
     213            new_data.dxl = numpy.zeros(len(data.x)) 
     214            new_data.dxw = numpy.zeros(len(data.x))        
     215 
    204216        return new_data 
    205217         
Note: See TracChangeset for help on using the changeset viewer.