Changes in / [e9b17b18:2dcd6e7] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/resolution.py

    r9e7837a r0b9c6df  
    2020MINIMUM_RESOLUTION = 1e-8 
    2121MINIMUM_ABSOLUTE_Q = 0.02  # relative to the minimum q in the data 
    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) 
     22PINHOLE_N_SIGMA = 2.5 # From: Barker & Pedersen 1995 JAC 
    2623 
    2724class Resolution(object): 
     
    9390        # from the geometry, they may appear since we are using a truncated 
    9491        # gaussian to represent resolution rather than a skew distribution. 
    95         #cutoff = MINIMUM_ABSOLUTE_Q*np.min(self.q) 
    96         #self.q_calc = self.q_calc[self.q_calc >= cutoff] 
     92        cutoff = MINIMUM_ABSOLUTE_Q*np.min(self.q) 
     93        self.q_calc = self.q_calc[self.q_calc >= cutoff] 
    9794 
    9895        # Build weight matrix from calculated q values 
     
    191188    cdf = erf((edges[:, None] - q[None, :]) / (sqrt(2.0)*q_width)[None, :]) 
    192189    weights = cdf[1:] - cdf[:-1] 
    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 
     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 
    201194    weights[q_calc[:, None] < qlow[None, :]] = 0. 
    202195    weights[q_calc[:, None] > qhigh[None, :]] = 0. 
     
    372365 
    373366 
    374 def pinhole_extend_q(q, q_width, nsigma=PINHOLE_N_SIGMA): 
     367def pinhole_extend_q(q, q_width, nsigma=3): 
    375368    """ 
    376369    Given *q* and *q_width*, find a set of sampling points *q_calc* so 
     
    378371    function. 
    379372    """ 
    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) 
     373    q_min, q_max = np.min(q - nsigma*q_width), np.max(q + nsigma*q_width) 
    385374    return linear_extrapolation(q, q_min, q_max) 
    386375 
Note: See TracChangeset for help on using the changeset viewer.