Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hakonanes
Copy link
Member

@hakonanes hakonanes commented Aug 26, 2020

Signed-off-by: Håkon Wiik Ånes [email protected]

See #115 for brief motivation. Closes #115.

  • Add derived Vector3d.theta, Vector3d.phi and Vector3d.r attributes.
  • Add Vector3d.to_polar() method to return theta, phi and r. The method takes no parameters.

Written simple tests, which pass. Coverage remains at 100%.

Todo:

  • @pc494, were you thinking of a polar() function defined outside of Vector3d, so this could be used elsewhere? If so, where do you think this should be placed?
  • Decide whether Vector3d.r etc. should return Scalar objects or numpy arrays. I prefer numpy arrays, since I haven't yet understood the use of Scalar.

@hakonanes hakonanes added the enhancement New feature or request label Aug 26, 2020
@hakonanes hakonanes added this to the v0.5.0 milestone Aug 26, 2020
@hakonanes hakonanes self-assigned this Aug 26, 2020
@pc494
Copy link
Member

pc494 commented Aug 26, 2020

In the short term I prefer Scalar, it's architecturally consistent even is Scalar as a class has always seemed a bit shallow in orix. I don't think we need to abstract polar just yet, for example if you got axes (from axis-angle rep) they would already be Vector3D. Review coming up.

Copy link
Member

@pc494 pc494 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conventions and docstrings, I think we are using "ISO 31-11" - see https://mathworld.wolfram.com/SphericalCoordinates.html

@hakonanes hakonanes changed the title Add theta, phi and r attributes to Vector3d, plus Vector3d.to_polar() Add spherical coordinate attributes to Vector3d, plus Vector3d.to_polar() Aug 27, 2020
@hakonanes hakonanes requested a review from pc494 August 27, 2020 10:18
@pc494
Copy link
Member

pc494 commented Aug 27, 2020

Merging, we scan (and probably should) consider Scalar's place within orix at a future point

@pc494 pc494 merged commit b8e6dfe into pyxem:master Aug 27, 2020
@hakonanes hakonanes deleted the add-spherical-coordinates-to-vector3d branch August 27, 2020 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector3d class should have radius and polar coordinates as attributes

2 participants