Changeset 4581ac9 in sasview for src/sas/sascalc/data_util
- Timestamp:
- Nov 9, 2016 1:58:30 PM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f5e226c9
- Parents:
- 9087214
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/data_util/qsmearing.py
r392056d r4581ac9 15 15 from sasmodels import sesans 16 16 17 import numpy as np # type: ignore 18 from numpy import pi, exp # type: ignore 19 from scipy.special import jv as besselj 20 17 21 from sasmodels.resolution import Slit1D, Pinhole1D, SESANS1D 18 22 from sasmodels.resolution2d import Pinhole2D 23 from src.sas.sascalc.data_util.nxsunit import Converter 24 19 25 20 26 def smear_selection(data, model = None): … … 37 43 # Sanity check. If we are not dealing with a SAS Data1D 38 44 # object, just return None 45 46 # This checks for 2D data (does not throw exception because fail is common) 39 47 if data.__class__.__name__ not in ['Data1D', 'Theory1D']: 40 48 if data == None: … … 43 51 return None 44 52 return Pinhole2D(data) 45 53 # This checks for 1D data with smearing info in the data itself (again, fail is likely; no exceptions) 46 54 if not hasattr(data, "dx") and not hasattr(data, "dxl")\ 47 55 and not hasattr(data, "dxw"): … … 49 57 50 58 # Look for resolution smearing data 59 # This is the code that checks for SESANS data; it looks for the file loader 60 # TODO: change other sanity checks to check for file loader instead of data structure? 51 61 _found_sesans = False 52 62 if data.dx is not None and data.meta_data['loader']=='SESANS': … … 55 65 56 66 if _found_sesans == True: 57 return sesans_smear(data, model) 67 #Pre-computing the Hankel matrix 68 Rmax = 1000000 69 q_calc = sesans.make_q(data.sample.zacceptance, Rmax) 70 SElength = Converter(data._xunit)(data.x, "A") 71 dq = q_calc[1] - q_calc[0] 72 H0 = dq / (2 * pi) * q_calc 73 H = dq / (2 * pi) * besselj(0, np.outer(q_calc, SElength)) 74 75 return PySmear(SESANS1D(data, H0, H, q_calc), model) 58 76 59 77 _found_resolution = False … … 169 187 Rmax = 1000000 170 188 q_calc = sesans.make_q(data.sample.zacceptance, Rmax) 171 return PySmear(SESANS1D(data,q_calc),model) 189 SElength=Converter(data._xunit)(data.x, "A") 190 #return sesans.HankelTransform(q_calc, SElength) 191 #Old return statement, running through the smearer 192 #return PySmear(SESANS1D(data,q_calc),model)
Note: See TracChangeset
for help on using the changeset viewer.