Skip to content

Refinement fails due to TypeError: must be real number, not str for goniometer angles with value #190

Open
@HamidReza-Azimaee

Description

@HamidReza-Azimaee

When attempting to refine a powder pattern in GSAS-II (latest version, Windows 11), the refinement fails with the following traceback:

TypeError: must be real number, not str
...
pFile.write(' Goniometer omega = %.2f, chi = %.2f, phi = %.2f\n' %
(Sample['Omega'], Sample['Chi'], Sample['Phi']))

Upon inspection, the values for Omega, Chi, and Phi in the Sample Parameters tab were shown as 0. — which appear to be interpreted as strings rather than real numbers.

Workaround that resolved the issue:
Manually changing the values to a very small real number (1e-09) allowed refinement to proceed without error. Attempts to enter 0.0 directly reverted back to 0., and the error persisted.

Steps to reproduce:

Import a PWDR dataset and CIF.

Attempt refinement without modifying sample orientation values (which appear as 0.).

Refinement fails with TypeError.

Suggested Fix:
Ensure that default or user-entered values like 0. are parsed and stored as floats (0.0) instead of strings.

Let me know if you want to include system details or contact info.

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