Skip to content

Misleading error message in Invariant low Q extrapolation #3836

@jellybean2004

Description

@jellybean2004

Describe the bug

As noted by @DrPaulSharp while reviewing PR #3833, when setting the first slider near the minimum value and running the calculation, warnings are thrown:

11:26:12 - WARNING: Low-q calculation failed: Rg expected positive value, but got -0.0
11:26:12 - WARNING: Calculation failed: Rg expected positive value, but got -0.0

The Guinier function: $I = I_0 \exp(-q^2 R_g^2 / 3)$, and $R_g \propto \sqrt{-m}$, requiring $m \leq 0$, which is the slope of $I$ vs $q^2$ plot.

Mathematically, $R_g = 0$ yields a low-q extrapolation with $e^0 = 1$. So, this should proceed, although it is not a useful result.

Lines 140-142 if invariant.py:

        if slope > 0:
            slope = 0.0
        self.radius = math.sqrt(-3 * slope)

So, the error message is misleading and prints the wrong value.

To Reproduce

Steps to reproduce the behavior:

  1. Load data onto Invariant perspective and input contrast value (here, used 10000A_sphere_dsm with $contrast = 2e-6$`)
  2. Turn on low q extrapolation and set the low q end value close to data minimum ($,4.2e-5$)
  3. Run calculation
  4. See error

Expected behavior

  • Run extrapolation for $R_g = 0$.
  • Show actual $R_g$ value in error message

SasView version (please complete the following information):

  • Version: 6.1.2 dev

Operating system (please complete the following information):

  • OS: Windows 11

Installation method (please complete the following information):

  • Installed: pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions