Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/data_util/qsmearing.py

    rd3911e3 r345e7e4  
    4141        elif data.dqx_data == None or data.dqy_data == None: 
    4242            return None 
    43         return PySmear2D(data, model) 
     43        return Pinhole2D(data) 
    4444 
    4545    if  not hasattr(data, "dx") and not hasattr(data, "dxl")\ 
     
    142142    width = data.dx if data.dx is not None else 0 
    143143    return PySmear(Pinhole1D(q, width), model) 
    144  
    145  
    146 class PySmear2D(object): 
    147     """ 
    148     Q smearing class for SAS 2d pinhole data 
    149     """ 
    150  
    151     def __init__(self, data=None, model=None): 
    152         self.data = data 
    153         self.model = model 
    154         self.accuracy = 'Low' 
    155         self.limit = 3.0 
    156         self.index = None 
    157         self.coords = 'polar' 
    158         self.smearer = True 
    159  
    160     def set_accuracy(self, accuracy='Low'): 
    161         """ 
    162         Set accuracy. 
    163  
    164         :param accuracy:  string 
    165         """ 
    166         self.accuracy = accuracy 
    167  
    168     def set_smearer(self, smearer=True): 
    169         """ 
    170         Set whether or not smearer will be used 
    171  
    172         :param smearer: smear object 
    173  
    174         """ 
    175         self.smearer = smearer 
    176  
    177     def set_data(self, data=None): 
    178         """ 
    179         Set data. 
    180  
    181         :param data: DataLoader.Data_info type 
    182         """ 
    183         self.data = data 
    184  
    185     def set_model(self, model=None): 
    186         """ 
    187         Set model. 
    188  
    189         :param model: sas.models instance 
    190         """ 
    191         self.model = model 
    192  
    193     def set_index(self, index=None): 
    194         """ 
    195         Set index. 
    196  
    197         :param index: 1d arrays 
    198         """ 
    199         self.index = index 
    200  
    201     def get_value(self): 
    202         """ 
    203         Over sampling of r_nbins times phi_nbins, calculate Gaussian weights, 
    204         then find smeared intensity 
    205         """ 
    206         if self.smearer: 
    207             res = Pinhole2D(data=self.data, index=self.index, 
    208                             nsigma=3.0, accuracy=self.accuracy, 
    209                             coords=self.coords) 
    210             val = self.model.evalDistribution(res.q_calc) 
    211             return res.apply(val) 
    212         else: 
    213             index = self.index if self.index is not None else slice(None) 
    214             qx_data = self.data.qx_data[index] 
    215             qy_data = self.data.qy_data[index] 
    216             q_calc = [qx_data, qy_data] 
    217             val = self.model.evalDistribution(q_calc) 
    218             return val 
    219  
Note: See TracChangeset for help on using the changeset viewer.