Changeset e9b17b18 in sasmodels
- Timestamp:
- Aug 7, 2018 9:17:32 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c11d09f, 97d172c
- Parents:
- 2dcd6e7 (diff), 0d87e79 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/resolution.py
r0b9c6df r9e7837a 20 20 MINIMUM_RESOLUTION = 1e-8 21 21 MINIMUM_ABSOLUTE_Q = 0.02 # relative to the minimum q in the data 22 PINHOLE_N_SIGMA = 2.5 # From: Barker & Pedersen 1995 JAC 22 # According to (Barker & Pedersen 1995 JAC), 2.5 sigma is a good limit. 23 # According to simulations with github.com:scattering/sansresolution.git 24 # it is better to use asymmetric bounds (2.5, 3.0) 25 PINHOLE_N_SIGMA = (2.5, 3.0) 23 26 24 27 class Resolution(object): … … 90 93 # from the geometry, they may appear since we are using a truncated 91 94 # gaussian to represent resolution rather than a skew distribution. 92 cutoff = MINIMUM_ABSOLUTE_Q*np.min(self.q)93 self.q_calc = self.q_calc[self.q_calc >= cutoff]95 #cutoff = MINIMUM_ABSOLUTE_Q*np.min(self.q) 96 #self.q_calc = self.q_calc[self.q_calc >= cutoff] 94 97 95 98 # Build weight matrix from calculated q values … … 188 191 cdf = erf((edges[:, None] - q[None, :]) / (sqrt(2.0)*q_width)[None, :]) 189 192 weights = cdf[1:] - cdf[:-1] 190 # Limit q range to +/- 2.5 sigma 191 qhigh = q + nsigma*q_width 192 #qlow = q - nsigma*q_width # linear limits 193 qlow = q*q/qhigh # log limits 193 # Limit q range to (-2.5,+3) sigma 194 try: 195 nsigma_low, nsigma_high = nsigma 196 except TypeError: 197 nsigma_low = nsigma_high = nsigma 198 qhigh = q + nsigma_high*q_width 199 qlow = q - nsigma_low*q_width # linear limits 200 ##qlow = q*q/qhigh # log limits 194 201 weights[q_calc[:, None] < qlow[None, :]] = 0. 195 202 weights[q_calc[:, None] > qhigh[None, :]] = 0. … … 365 372 366 373 367 def pinhole_extend_q(q, q_width, nsigma= 3):374 def pinhole_extend_q(q, q_width, nsigma=PINHOLE_N_SIGMA): 368 375 """ 369 376 Given *q* and *q_width*, find a set of sampling points *q_calc* so … … 371 378 function. 372 379 """ 373 q_min, q_max = np.min(q - nsigma*q_width), np.max(q + nsigma*q_width) 380 try: 381 nsigma_low, nsigma_high = nsigma 382 except TypeError: 383 nsigma_low = nsigma_high = nsigma 384 q_min, q_max = np.min(q - nsigma_low*q_width), np.max(q + nsigma_high*q_width) 374 385 return linear_extrapolation(q, q_min, q_max) 375 386 -
sasmodels/core.py
r4341dd4 r2dcd6e7 233 233 if not callable(model_info.Iq): 234 234 source = generate.make_source(model_info)['dll'] 235 old_path = kerneldll. DLL_PATH235 old_path = kerneldll.SAS_DLL_PATH 236 236 try: 237 kerneldll. DLL_PATH = path237 kerneldll.SAS_DLL_PATH = path 238 238 dll = kerneldll.make_dll(source, model_info, dtype=numpy_dtype) 239 239 finally: 240 kerneldll. DLL_PATH = old_path240 kerneldll.SAS_DLL_PATH = old_path 241 241 compiled_dlls.append(dll) 242 242 return compiled_dlls
Note: See TracChangeset
for help on using the changeset viewer.