Ignore:
Timestamp:
Apr 13, 2012 12:08:48 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
c4cf266
Parents:
1e62361
Message:

Fixing code style problems and bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/qsmearing.py

    r5f65636 ref8d42f  
    1  
     1""" 
     2    Handle Q smearing 
     3""" 
    24##################################################################### 
    35#This software was developed by the University of Tennessee as part of the 
     
    8486 
    8587class _BaseSmearer(object): 
    86      
     88    """ 
     89        Base class for smearers 
     90    """ 
    8791    def __init__(self): 
    8892        self.nbins = 0 
     
    9498        self._smearer = None 
    9599        self.model = None 
    96          
    97     def __deepcopy__(self, memo={}): 
     100        self.min = None 
     101        self.max = None 
     102        self.qvalues = [] 
     103         
     104    def __deepcopy__(self, memo=None): 
    98105        """ 
    99106        Return a valid copy of self. 
     
    107114    def _compute_matrix(self): 
    108115        """ 
     116            Place holder for matrix computation  
    109117        """ 
    110118        return NotImplemented 
    111119 
     120    def get_unsmeared_range(self, q_min=None, q_max=None): 
     121        """ 
     122            Place holder for method returning unsmeared range 
     123        """ 
     124        return NotImplemented 
     125     
    112126    def get_bin_range(self, q_min=None, q_max=None): 
    113127        """ 
     
    218232    def _initialize_smearer(self): 
    219233        """ 
     234            Place holder for initializing data smearer 
    220235        """ 
    221236        return NotImplemented 
     
    263278        else: 
    264279            # In the case that doesn't need higher q extrapolation data  
    265              last_bin += self.nbins_low 
     280            last_bin += self.nbins_low 
    266281 
    267282        return first_bin, last_bin 
     
    567582     
    568583    # nbins corrections due to the negative q value 
    569     nbins_low = nbins_low - len(data_x_ext[data_x_ext<=0]) 
    570     return  nbins_low, nbins_high, \ 
    571              new_width[data_x_ext>0], data_x_ext[data_x_ext>0] 
    572      
    573 if __name__ == '__main__': 
    574     x = 0.001 * numpy.arange(1, 11) 
    575     y = 12.0 - numpy.arange(1, 11) 
    576     print x 
    577     #for i in range(10): print i, 0.001 + i*0.008/9.0  
    578     #for i in range(100): print i, int(math.floor( (i/ (100/9.0)) ))  
    579     s = _SlitSmearer(nbins=10, width=0.0, height=0.005, min=0.001, max=0.010) 
    580     #s = _QSmearer(nbins=10, width=0.001, min=0.001, max=0.010) 
    581     s._compute_matrix() 
    582  
    583     sy = s(y) 
    584     print sy 
    585      
    586     if True: 
    587         for i in range(10): 
    588             print x[i], y[i], sy[i] 
    589             #print q, ' : ', s.weight(q), s._compute_iq(q)  
    590             #print q, ' : ', s(q), s._compute_iq(q)  
    591             #s._compute_iq(q)  
    592  
    593  
    594  
    595  
     584    nbins_low = nbins_low - len(data_x_ext[data_x_ext <= 0]) 
     585    return nbins_low, nbins_high, \ 
     586             new_width[data_x_ext > 0], data_x_ext[data_x_ext > 0] 
Note: See TracChangeset for help on using the changeset viewer.