Buffer subtraction

Purpose. Solute scattering is Isample − s·Ibuffer. The hard part is choosing the scale s so that solvent / capillary contributions cancel while the solute signal remains. Visually, sample and scaled buffer should match in the high-q “tail”, especially past the Porod region / before a detector “knee”.

What autosaxs does.

  1. Detect the detector knee on the buffer alone (SNR-weighted descending-edge contrast on rolling-median log I). Set qmax just before that cliff.
  2. Take the late pre-knee band (default: last 35% of [qmin,data, qknee]). Optional manual qmin / qmax override this.
  3. In that band, gate low-SNR points, form raw ratios Isample/Ibuffer, take sliding-window medians, then s = approach_factor × min(medians).
  4. Write Isub = Isample − s·Ibuffer with propagated errors. Flag over-subtracted if any point has Isub+σsub < 0.

A fixed scaling factor (Subtraction wizard) overrides automatic scaling.

Engines. Fully custom (no ATSAS).