Changeset ef8d42f in sasview for sansmodels
- Timestamp:
- Apr 13, 2012 12:08:48 PM (13 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/qsmearing.py
r5f65636 ref8d42f 1 1 """ 2 Handle Q smearing 3 """ 2 4 ##################################################################### 3 5 #This software was developed by the University of Tennessee as part of the … … 84 86 85 87 class _BaseSmearer(object): 86 88 """ 89 Base class for smearers 90 """ 87 91 def __init__(self): 88 92 self.nbins = 0 … … 94 98 self._smearer = None 95 99 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): 98 105 """ 99 106 Return a valid copy of self. … … 107 114 def _compute_matrix(self): 108 115 """ 116 Place holder for matrix computation 109 117 """ 110 118 return NotImplemented 111 119 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 112 126 def get_bin_range(self, q_min=None, q_max=None): 113 127 """ … … 218 232 def _initialize_smearer(self): 219 233 """ 234 Place holder for initializing data smearer 220 235 """ 221 236 return NotImplemented … … 263 278 else: 264 279 # In the case that doesn't need higher q extrapolation data 265 280 last_bin += self.nbins_low 266 281 267 282 return first_bin, last_bin … … 567 582 568 583 # 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.