Skip to content

np.xrange does not exist - should be range() - in BVGFitTools.py #40832

@daym

Description

@daym

Describe the bug

In scripts/SCD_Reduction/BVGFitTools.py lines 339-341, the code uses np.xrange() which does not exist in NumPy and never has:

  for i in np.xrange(QX.shape[0]):
      for j in np.xrange(QX.shape[1]):
          for k in np.xrange(QX.shape[2]):

This appears to be a remnant from Python 2 where xrange was a builtin function, with an erroneous np. prefix added.

Fix

Should use Python's builtin range():

  for i in range(QX.shape[0]):
      for j in range(QX.shape[1]):
          for k in range(QX.shape[2]):

Impact

The getXTOF() function in BVGFitTools.py will raise AttributeError: module 'numpy' has no attribute 'xrange' if called.

Environment:

  • Mantid version: 6.14.0.3
  • File: scripts/SCD_Reduction/BVGFitTools.py

Platform/Version (please complete the following information):

  • OS: GNU Guix
  • OS Version: 1.5.0
  • Mantid Version commit 4574b7c

Metadata

Metadata

Assignees

Labels

BugIssues and pull requests that are regressions or would be considered a bug by users (e.g. crashing)ORNL TeamIssues and pull requests managed by the ORNL development team

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions