# Changeset 65fbf7c in sasmodels

Ignore:
Timestamp:
May 21, 2018 5:33:49 PM (3 months ago)
Branches:
master, ESS_GUI, beta_approx, beta_approx_lazy_results, beta_approx_new_R_eff, doc_update, ticket-1102-pinhole, ticket-1104-resolution, ticket-1112, ticket-1142-plugin-reload, ticket-1148-Sq-scale-background, ticket-608-user-defined-weights
Children:
2b2d431
Parents:
87964ac
Message:

play with resolution defined by fixed dtheta,dlambda

Location:
sasmodels
Files:
2 edited

### Legend:

Unmodified
 rd86f0fc import numpy as np  # type: ignore from numpy import sqrt, sin, cos, pi # pylint: disable=unused-import def empty_data1D(q, resolution=0.0): def empty_data1D(q, resolution=0.0, L=0., dL=0.): # type: (np.ndarray, float) -> Data1D """ r""" Create empty 1D data using the given *q* as the x value. *resolution* dq/q defaults to 5%. rms *resolution* $\Delta q/q$ defaults to 0%.  If wavelength *L* and rms wavelength divergence *dL* are defined, then *resolution* defines rms $\Delta \theta/\theta$ for the lowest *q*, with $\theta$ derived from $q = 4\pi/\lambda \sin(\theta)$. """ Iq, dIq = None, None q = np.asarray(q) data = Data1D(q, Iq, dx=resolution * q, dy=dIq) if L != 0 and resolution != 0: theta = np.arcsin(q*L/(4*pi)) dtheta = theta[0]*resolution ## Solving Gaussian error propagation from ##   Dq^2 = (dq/dL)^2 DL^2 + (dq/dtheta)^2 Dtheta^2 ## gives ##   (Dq/q)^2 = (DL/L)**2 + (Dtheta/tan(theta))**2 ## Take the square root and multiply by q, giving ##   Dq = (4*pi/L) * sqrt((sin(theta)*dL/L)**2 + (cos(theta)*dtheta)**2) dq = (4*pi/L) * sqrt((sin(theta)*dL/L)**2 + (cos(theta)*dtheta)**2) else: dq = resolution * q data = Data1D(q, Iq, dx=dq, dy=dIq) data.filename = "fake data" return data