Skip to content

bug in unitVector #916

@donald-e-boyce

Description

@donald-e-boyce

Describe the bug

There is a bug in the unitVector function when the input is 1D. It then returns a matrix with the unit vector repeated in rows.

Impact

Will eventually cause someone a problem

Reproduction

Here is an example of the error.

"""Test unit vector"""

import numpy as np

from hexrd.core.matrixutil import unitVector

x = np.array([1.0, 2.0, 3.0])
u = unitVector(x)
print(u)

And running it:

> python test_uv.py
[[0.26726124 0.53452248 0.80178373]
 [0.26726124 0.53452248 0.80178373]
 [0.26726124 0.53452248 0.80178373]]

Version

Latest version.

Affected Workflows

  • core
  • EDD
  • HEDM
  • Powder
  • Laue

Metadata

Metadata

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions