Changeset ba91f71 in sasview
- Timestamp:
- Apr 10, 2017 9:37:39 AM (8 years ago)
- Branches:
- costrafo411
- Children:
- 9f59333
- Parents:
- 3fd3c3a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/data_util/qsmearing.py
r3fd3c3a3 rba91f71 5 5 #This software was developed by the University of Tennessee as part of the 6 6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 7 #project funded by the US National Science Foundation. 7 #project funded by the US National Science Foundation. 8 8 #See the license text in license.txt 9 9 #copyright 2008, University of Tennessee … … 18 18 19 19 from sasmodels.resolution import Slit1D, Pinhole1D 20 from sasmodels.sesans import SesansTransform 20 from sasmodels.sesans import SesansTransform, OrientedSesansTransform 21 21 from sasmodels.resolution2d import Pinhole2D 22 22 from .nxsunit import Converter … … 73 73 Rmax = 10000000 74 74 # data must have the isoriented flag here! 75 coshankel = SesansTransform(data.x, SElength, zaccept, Rmax)76 75 # Then return the actual transform, as if it were a smearing function 77 if data.isoriented: 78 return PySmear2D(coshankel) 76 if getattr(data, 'isoriented', False): 77 costransform = OrientedSesansTransform(data.x, SElength, zaccept, Rmax) 78 return PySmear(costransform, model, offset=0) 79 79 else: 80 return PySmear(coshankel, model, offset=0) 80 hankel = SesansTransform(data.x, SElength, zaccept, Rmax) 81 return PySmear(hankel, model, offset=0) 81 82 82 83 _found_resolution = False … … 138 139 first_bin:last_bin set to the resolution smeared values. 139 140 """ 140 if last_bin is None: last_bin = len(iq_in)141 start, end = first_bin + self.offset, last_bin + self.offset142 141 q_calc = self.resolution.q_calc 143 iq_calc = numpy.empty_like(q_calc) 144 if start > 0: 145 iq_calc[:start] = self.model.evalDistribution(q_calc[:start]) 146 if end+1 < len(q_calc): 147 iq_calc[end+1:] = self.model.evalDistribution(q_calc[end+1:]) 148 iq_calc[start:end+1] = iq_in[first_bin:last_bin+1] 142 if isinstance(q_calc, tuple): 143 # We are 2D -> 1D! 144 iq_calc = self.model.evalDistribution(q_calc) 145 else: 146 if last_bin is None: last_bin = len(iq_in) 147 start, end = first_bin + self.offset, last_bin + self.offset 148 iq_calc = numpy.empty_like(q_calc) 149 if start > 0: 150 iq_calc[:start] = self.model.evalDistribution(q_calc[:start]) 151 if end+1 < len(q_calc): 152 iq_calc[end+1:] = self.model.evalDistribution(q_calc[end+1:]) 153 iq_calc[start:end+1] = iq_in[first_bin:last_bin+1] 149 154 smeared = self.resolution.apply(iq_calc) 150 155 return smeared
Note: See TracChangeset
for help on using the changeset viewer.