Skip to content

Slit resolution calculation fails for q_length=0 and small q_width. #697

@pkienzle

Description

@pkienzle

The following comment will be added to resolution.py (#533):

elif li == 0:
    in_x = 1.0 * ((q_calc >= qi-wi) & (q_calc <= qi+wi))
    abs_x = 1.0*(q_calc < abs(qi - wi)) if qi < wi else 0.
    # TODO: need pixel fraction for the boundary pixels
    # Diff q_edges in the expression below gives the pixel width in
    # q. As wi drops below the width of a single pixel, the
    # numerator stays the same but the denominater gets smaller, leading
    # to ever increasing weights. We can't see this in SasView since
    # it explicitly excludes q_length < 10 q_width.
    weights[i, :] = (in_x + abs_x) * np.diff(q_edges) / (2*wi)

We should either fix the code or disallow this configuration of slits. As noted, SasView forces q_length > 10 q_width.

For q_width large relative to the q spacing the issue is not significant.

The same issue doesn't appear for q_width=0 and q_length small even though it uses a similar diff(u_edges) / length construction.

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