SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
52 stars 41 forks source link

A different beast - Smearing done proper #1865

Closed toqduj closed 2 years ago

toqduj commented 3 years ago

Continuing from the discussion in #1753 :

The smearing using only a dQ Gaussian "width" is inadequate for SAXS, both in its 2D form (pinhole/slit collimation) or in 1D form (Kratky cameras and Bones Hart USAXS instruments).

If it is to be done in any way correctly, the smearing implementation has to be able to smear the model using an (anisotropic) kernel that describes the (2D) beam profile on the detector at that configuration (describing divergence and collimation limits), and an optional kernel that describes the wavelength distribution. Ideally, these would be matrices (or spline points), so the kernels can be generated using any analytical function you'd like, and should probably be done in the data reduction (as that's where the instrument geometry should be known).

pbeaucage commented 3 years ago

I'm a little confused on why a 2D kernel is needed to properly smear a model in 1D, dS/dW vs |q|, space. In a highly oriented system and where the 1D kernel represents only a fraction of the azimuthal space, maybe? But I'm hard pressed to put my finger on a real experimental system like this where it wouldn't be preferable to co-fit the different rotation slices or do a full 2D fitting operation.

I can see plenty of reasons to capture the full, potentially non-Gaussian distribution of |q| in each point, and agree that that's a necessary part of future steps, but I don't see why additional dimensions are needed if not for 2D fitting. Is there a motivating experimental example?

The reason I ask is that I'm not sure the 2D + 1D smearing kernel is adequate for certain kinds of SANS measurements, e.g. spin echo SANS or new interferometric SANS tools being developed, or for ToF SANS experiments with advanced timing profiles like frame-skipping or TISANE. In each of these cases I'm unable to produce an intuitive reduction of the instrumental resolution function to a beam profile plus wavelength distribution.

toqduj commented 3 years ago

I can see 2D kernels being useful in two cases:

However, once such a 2D kernel is provided for 1D data for unoriented scatterers, the kernel can be reduced to 1D as needed before application in the fitting routine.

As for the SESANS / ToFSANS experiments, I cannot possibly comment on this, I know far too little on those. Their smearing kernels would need to be multi-dimensional to include a time-axis too, no?

toqduj commented 3 years ago
pkienzle commented 3 years ago

I added oriented samples with slit geometry to sasmodels years ago but it never made it into sasview. See example.

It uses the Slit2D resolution function: https://github.com/SasView/sasmodels/blob/9618b477753abd95b06d3cde92ed52e9ec4f5915/sasmodels/resolution2d.py#L178

See DirectModel and DataMixin to see how it fits together: https://github.com/SasView/sasmodels/blob/9618b477753abd95b06d3cde92ed52e9ec4f5915/sasmodels/direct_model.py#L202

Something similar would need to happen in sas.sascalc.fitting.qsmearing, in addition to to some UI bits to indicate that the slit data was taken with an oriented shape.

toqduj commented 2 years ago

so the Slit2D function could also be used for pinhole and slit smearing using actual detected 2D smearing kernels?

lucas-wilkins commented 2 years ago

This appears to be a continuation of a different discussion. I'm taking the executive decision to close this, please use the original issue #1753 instead.