Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ def residualsData2D(reference_data, current_data, weight):
residuals.qx_data = current_data.qx_data
residuals.qy_data = current_data.qy_data
residuals.q_data = current_data.q_data
residuals.err_data = None
# Slicers expect residuals to have err_data, so add dummy error data of ones
residuals.err_data = numpy.ones(len(residuals.data))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't numpy.zeros make more sense?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In manipulations.py, a zero value in err-data triggers a fallback, and data is used as a proxy. So I used ones.

Copy link
Copy Markdown
Contributor

@pkienzle pkienzle May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

χ² = Σ (f(x) - y)²/Δy² so Δy=1 is a natural value to use in the absence of any information about the data uncertainty. Parameter uncertainties can be normalized by √(χ²/DOF) to account for improperly scaled error bars. I'm not doing this by default because this assumes that there is no systematic error.

Note: in the broader stats world where measurement uncertainty is unknown, data is generally drawn without uncertainty. Whether the result of SasView (i.e., the plotting infrastructure and the bumps interface) can handle the missing error bars is a separate question. They probably should, since fixed Δy = 1 will make for ugly plots.

What does sasdata do with datasets that don't have any associated uncertainty? Does it return them as None? In which case, the correct fix is to leave err_data as None and fix the "isfinite" masking.

Note 2: If this is acting on a normalized residual, then the Δy is supposed to be one. It should be put there by whatever generated the residual, though, and not be introduced by the slicer.

residuals.xmin = min(residuals.qx_data)
residuals.xmax = max(residuals.qx_data)
residuals.ymin = min(residuals.qy_data)
Expand Down
Loading