Changeset 55e82f0 in sasmodels

Ignore:
Timestamp:
Sep 12, 2018 5:13:27 PM (4 months ago)
Branches:
ticket-608-user-defined-weights
Children:
01dba26
Parents:
d0fdba2
Message:

add some weights examples and update docs

Location:
example/weights
Files:
 r36873d1 r""" Cyclic gaussian dispersion on orientation. .. math: This provides a close match to the gaussian distribution for low angles (with $\sin \theta \approx \theta$), but the tails are limited to $\pm 90^\circ$.  For $\sigma$ large the distribution is approximately uniform.  The usual polar coordinate low angles, but the tails are limited to $\pm 90^\circ$.  For $\sigma$ large the distribution is approximately uniform.  The usual polar coordinate projection applies, with $\theta$ weights scaled by $\cos \theta$ and $\phi$ weights unscaled. This is closely related to a Maier-Saupe distribution with order parameter $P_2$ and appropriate scaling constants, and changes between $\sin$ and $\cos$ as appropriate for the coordinate system representation. This is eqivalent to a Maier-Saupe distribution with order parameter $P_2 = 1/(2 \sigma^2)$, with $\sigma$ in radians. """ type = "cyclic_gaussian" # Note: center is always zero for orientation distributions def _weights(self, center, sigma, lb, ub): # Convert sigma in degrees to the approximately equivalent Maier-Saupe "a" # Convert sigma in degrees to radians sigma = radians(sigma) a = -0.5/sigma**2 # Limit width to +/-90 degrees; use an open interval since the # pattern at +90 is the same as that at -90. # Limit width to +/- 90 degrees width = min(self.nsigmas*sigma, pi/2) x = np.linspace(-width, width, self.npts+2)[1:-1] x = np.linspace(-width, width, self.npts) # Truncate the distribution in case the parameter value is limited x[(x >= radians(lb)) & (x <= radians(ub))] # Return orientation in degrees with Maier-Saupe weights return degrees(x), exp(a*sin(x)**2) return degrees(x), exp(-0.5*sin(x)**2/sigma**2)