Changeset eb8a82e in sasmodels
- Timestamp:
- Oct 10, 2016 4:53:04 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3023268
- Parents:
- 0ae0f9a
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/resolution.py
r0ae0f9a reb8a82e 9 9 from numpy import sqrt, log, log10, exp, pi # type: ignore 10 10 import numpy as np # type: ignore 11 12 from sasmodels import sesans 11 13 12 14 __all__ = ["Resolution", "Perfect1D", "Pinhole1D", "Slit1D", … … 59 61 60 62 def __init__(self, data, q_calc): 63 self.q = data.x 61 64 self.data = data 62 65 self.q_calc = q_calc -
sasmodels/sesans.py
r0444c02 reb8a82e 15 15 from numpy import pi, exp # type: ignore 16 16 from scipy.special import jv as besselj 17 from sas.sasgui.perspectives.fitting.fitpage import FitPage17 #from sas.sasgui.perspectives.fitting.fitpage import FitPage 18 18 #import direct_model.DataMixin as model 19 19 … … 60 60 (2016-03-19: currently controlled from parameters script) 61 61 nqmono is the number of q vectors to be used for the detector integration 62 """ 63 nqmono = len(qmono) 64 #if nqmono == 0 # if radiobutton hankel is active 65 if FitPage.hankel.GetValue(): 62 qmono are the detector limits: can be a 1D or 2D array (depending on Q-limit or Qx,Qy limits) 63 """ 64 if qmono == None: 66 65 result = call_hankel(data, q_calc, Iq_calc) 67 elif nqmono == 1: 68 q = qmono[0] 69 result = call_HankelAccept(data, q_calc, Iq_calc, q, Iq_mono) 70 else: #if radiobutton Cosine is active 71 Qx, Qy = [qmono[0], qmono[1]] 72 Qx = np.reshape(Qx, nqx, nqy) 73 Qy = np.reshape(Qy, nqx, nqy) 74 Iq_mono = np.reshape(Iq_mono, nqx, nqy) 75 qx = Qx[0, :] 76 qy = Qy[:, 0] 77 result = call_Cosine2D(data, q_calc, Iq_calc, qx, qy, Iq_mono) 66 else: 67 nqmono = len(qmono) 68 if nqmono == 0: # if radiobutton hankel is active 69 #if FitPage.hankel.GetValue(): 70 result = call_hankel(data, q_calc, Iq_calc) 71 elif nqmono == 1: 72 q = qmono[0] 73 result = call_HankelAccept(data, q_calc, Iq_calc, q, Iq_mono) 74 else: #if radiobutton Cosine is active 75 Qx, Qy = [qmono[0], qmono[1]] 76 Qx = np.reshape(Qx, nqx, nqy) 77 Qy = np.reshape(Qy, nqx, nqy) 78 Iq_mono = np.reshape(Iq_mono, nqx, nqy) 79 qx = Qx[0, :] 80 qy = Qy[:, 0] 81 result = call_Cosine2D(data, q_calc, Iq_calc, qx, qy, Iq_mono) 78 82 79 83 return result 80 84 81 85 def call_hankel(data, q_calc, Iq_calc): 82 return hankel((data.x, data.x_unit), 83 (data.lam, data.lam_unit), 84 (data.sample.thickness, 85 data.sample.thickness_unit), 86 q_calc, Iq_calc) 86 # data.lam_unit='nm' 87 #return hankel((data.x, data.x_unit), 88 # (data.lam, data.lam_unit), 89 # (data.sample.thickness, 90 # data.sample.thickness_unit), 91 # q_calc, Iq_calc) 92 93 return hankel((data.x, data._xunit), q_calc, Iq_calc) 87 94 88 95 def call_HankelAccept(data, q_calc, Iq_calc, q_mono, Iq_mono): … … 168 175 P = exp(thickness*wavelength**2/(4*pi**2)*(G-G[0])) 169 176 170 def hankel(SElength, wavelength, thickness, q, Iq): 177 #def hankel(SElength, wavelength, thickness, q, Iq): 178 def hankel(SElength, q, Iq): 171 179 r""" 172 180 Compute the expected SESANS polarization for a given SANS pattern. … … 191 199 192 200 from sas.sascalc.data_util.nxsunit import Converter 193 wavelength = Converter(wavelength[1])(wavelength[0],"A")194 thickness = Converter(thickness[1])(thickness[0],"A")201 #wavelength = Converter(wavelength[1])(wavelength[0],"A") 202 #thickness = Converter(thickness[1])(thickness[0],"A") 195 203 Iq = Converter("1/cm")(Iq,"1/A") # All models default to inverse centimeters 196 204 SElength = Converter(SElength[1])(SElength[0],"A") … … 203 211 integral = besselj(0, q*SElength_i)*Iq*q 204 212 G[i] = np.sum(integral) 205 G0 = np.sum(Iq*q) 213 G0 = np.sum(Iq*q) #relation to ksi? For generalization to all models 206 214 207 215 # [m^-1] step size in q, needed for integration … … 212 220 G0 = np.sum(Iq*q)*dq*2*np.pi 213 221 214 P = exp(thickness*wavelength**2/(4*pi**2)*(G-G0)) 222 #P = exp(thickness*wavelength**2/(4*pi**2)*(G-G0)) 223 P = (G-G0)/(4*pi**2) 215 224 216 225 return P
Note: See TracChangeset
for help on using the changeset viewer.