STL2SASScattering workbench
Runs on your deviceMVP 0.1
Interactive small-angle scattering

From shape to scattering.

Explore a model, rotate its scattering pattern, or reconstruct a shape from data.

Real space

Torus

Example
20,000 points
↔ Drag to rotate · scroll to zoomLIVE
Filling particle volume…
Orientation
Reciprocal space

2D scattering planes

Initializing
XYbeam ∥ Z
qᵧqₓ
−0.320+0.32
XZbeam ∥ Y
q𝓏qₓ
−0.320+0.32
YZbeam ∥ X
q𝓏qᵧ
−0.320+0.32
I(q) / I(0)10⁻⁵
1Log scale
↗

Three fixed laboratory planes, one rotating particle.
128² pixels per plane · q in nm⁻¹

Hover over a detector to inspect q and intensity.
Scattering profiles

A closer look at I(q)

Plane averages follow orientation.
The isotropic average stays fixed.

IsotropicXYXZYZ
Waiting for model…
Inverse reconstruction · experimental

From scattering to a possible shape.

Fit a connected, uniform-density envelope to an isotropic I(q) curve.

Local computation

A 1D curve can support many different 3D shapes. Compare independent searches; treat each result as a candidate under the selected size and compactness constraints.

Synthetic sphere data
Synthetic data settings

Radius 30 Å, seeded noise. Changes regenerate an active synthetic dataset; the fitted q range is set separately below.

Load a curve, or start with the synthetic sphere example.

Reconstruction settings

Diameter of the region for voxel centers, in the inverse of your q unit. Boundary cubes can extend beyond the sphere by up to half a voxel diagonal. The suggested size is a rough Guinier estimate.

Angular accuracy adapts to q range and search extent.

Ready when you are.

Data & fitData Candidate

The fit and weighted residuals will appear here.

A candidate envelope will appear here.Drag to inspect · arrow keys to rotate
What this reconstruction assumes

This is an independent hybrid reconstruction prototype, inspired by bead-model methods such as DAMMIN. A global sphere/ellipsoid fit initializes the dimensions, followed by simulated annealing of connected, constant-contrast voxels. Cube centers lie inside the selected sphere; boundary cubes may extend outside it. Local occupancy changes update cached amplitudes; the objective combines weighted intensity residuals and a surface-area compactness prior. Scale is fitted analytically; optional background is constrained nonnegative.

Up to 256 q values guide the search. Angular accuracy adapts to the requested q range and search extent: 512–8,192 search directions and 2,048–8,192 final-check directions. Each final candidate is evaluated against every retained data point using an oversampled projection FFT. The supported q max × diameter extent is now 120; larger values need additional numerical support. A stabilized sub-unit weighted residual may stop a search early, and actual step counts are exported. The finite cube form factor is included. STL exports are the exact block-shaped envelopes used in the fit, without smoothing. They have no embedded length unit; keep the run report.

Two-column input uses assumed σ = max(5% |I|, 0.2% of the low-q reference); it does not acquire experimental error bars. The reported weighted RMS is not reduced χ² or evidence for a unique structure. This MVP assumes a dilute, monodisperse particle with uniform contrast, no structure factor or instrument smearing. Grid size, q range, size constraint, incomplete search and angular integration can all affect the result. Cavities and handles may occur; only material connectivity is enforced globally.

Scattering points—uniform volume sampling
Last calculation—three 128 × 128 planes
Radius of gyration—estimated from sampled points
Sampling floor—finite-point noise ≈ 1 / N
Method

A fast path from volume to scattering.

Uniform random points fill the enclosed model. For a single particle of constant scattering-length density, the normalized intensity is:

P(q) = | Σⱼ exp(i q · R rⱼ) / N |²

We rotate the same points, project them onto XY, XZ and YZ, then apply a 2D FFT to each density projection. Cloud-in-cell deposition, a 2× oversampled grid, and a window correction reduce gridding error. The central pixel is exactly 1.

At fixed detector size, rotation and deposition scale as O(N); the three FFTs add O(M² log M), where M is the detector width. Initial mesh checks and volume sampling have a separate, geometry-dependent cost.

The isotropic average

The dark curve averages intensity over directions on a sphere, rather than averaging the three plane curves. The default Quick setting uses 40 approximately uniformly spaced Fibonacci directions over the sphere, with equal weights. It averages intensity from all N original volume points in each direction, without a point-pair sum. Each direction is calculated with an eight-fold oversampled 1D projection FFT. The denser Fast, Balanced and Fine settings use Gauss–Legendre polar weights and evenly spaced azimuths over the positive hemisphere, exploiting I(q) = I(−q).

This numerical spherical average is cached in the original model frame over the entire qD range, up to 120. Rotation, zoom, q range, detector resolution and physical units reuse the same values. A new model, resampling, point count or isotropic accuracy restarts its separate background worker. Its cost is O(KN + KG log G), where K is the chosen direction count and G = 8192. Live detector updates do not wait for it.

The isotropic average is approximate: both angular quadrature and gridding have finite resolution. Quick is intended for fast exploration. Compare it with the denser settings for high q, elongated models or sharp minima. It retains the same finite-point self terms and approximate 1/N noise floor; it is not an exact O(N²) Debye sum.

What this MVP assumes

References: Larsen et al., Shape2SAS (2023) · SasView orientational averaging · morphsld_sas. This is an independent implementation.