pyxem / orix

Analysing crystal orientations and symmetry in Python
https://orix.readthedocs.io
GNU General Public License v3.0
82 stars 50 forks source link

Implementing more projections than the stereographic projection? #91

Closed hakonanes closed 3 years ago

hakonanes commented 4 years ago

This ties into my question in #90 of where the projection from Cubochoric coordinates to a Homochoric vector could be placed.

EMsoft (Fortran) places this projection in their Lambert module (https://github.com/EMsoft-org/EMsoft/blob/develop/Source/EMsoftLib/Lambert.f90#L952), which also includes a stereographic projection (https://github.com/EMsoft-org/EMsoft/blob/develop/Source/EMsoftLib/Lambert.f90#L1630). These projections are used to e.g. orientation sampling, and projecting part of an EBSD/ECP master pattern onto a detector. I mentioned my desire to implement such a projection in #62. I believe it could be implemented in orix in such a general way so that it can be useful for other use cases apart from this projection.

MTEX (Matlab) has several spherical projections (https://mtex-toolbox.github.io/SphericalProjections.html, https://github.com/mtex-toolbox/mtex/tree/develop/plotting/sphericalProjections) in their geometry/geometry_tools part. These are used to great effect by McAuliffe and Britton to perform spherical integration of intensities along specific Kikuchi bands in EBSD patterns (code: https://github.com/tmcaul/SphericalAngularDF/blob/master/SphericalAnalysis/detector.m, arXiv: https://arxiv.org/abs/2005.10581).

The stereographic projection in #62 is "tied to" Matplotlib. Would it be possible to add it to a projection module, and use that for plotting? Then the cubochoric to homochoric projection could be placed in that module as well.

dnjohnstone commented 4 years ago

Thanks for this @hakonanes - a projection module sounds like a good idea to me and yes I think we'd ultimately like to have multiple spherical projections in orix. Do you need anything more than to know that here?

I do wonder if @tmcaul might be interested in this....

hakonanes commented 4 years ago

Thanks for this @hakonanes - a projection module sounds like a good idea to me and yes I think we'd ultimately like to have multiple spherical projections in orix. Do you need anything more than to know that here?

No, I'll see if I can create a PR setting up this module with the cubochoric <--> homochoric projection/inverse projection. This will be the first step towards getting the alternative cubochoric sampling from EMsoft into orix, as @pc494 mentioned here https://github.com/pyxem/orix/pull/90#issuecomment-671064548.

pc494 commented 4 years ago

Before you get too far with that @hakonanes, are we sure homochoric ---> cubochoric is a "projection" and not just a mapping between representations of rotations. If it's not a "projection" adding a to_cubochoric and from_cubochoric to the existing homochoric class (https://github.com/pyxem/orix/blob/master/orix/vector/neo_euler.py) might be a simpler option?

In general very in favour of a projections module.

hakonanes commented 4 years ago

You're onto something @pc494. I was simply looking for someplace else than vector/neo_euler to place the cubochoric representation, as it is not neo-Eulerian (can not be expressed in the form hat(n)f(w))... Do you have a suggestion for a place for it? Perhaps just vector/cubochoric?

dnjohnstone commented 4 years ago

You're onto something @pc494. I was simply looking for someplace else than vector/neo_euler to place the cubochoric representation, as it is not neo-Eulerian (can not be expressed in the form hat(n)f(w))... Do you have suggestion for place for it? Perhaps just vector/cubochoric?

Yes, that sounds better for cubochoric.

pc494 commented 4 years ago

vector/cubochoric sounds good to me.

hakonanes commented 4 years ago

vector/cubochoric sounds good to me.

Okay, will have a go at that.

dnjohnstone commented 4 years ago

I was just working on #62 and looking around noticed this https://matplotlib.org/basemap/users/index.html - I wonder if we could make use of that...

hakonanes commented 4 years ago

I was just working on #62 and looking around noticed this https://matplotlib.org/basemap/users/index.html - I wonder if we could make use of that...

The project development has moved over to cartopy (https://github.com/SciTools/cartopy). We might be able to use that, I haven't looked into it.

hakonanes commented 3 years ago

The stereographic projection is now in and will be part of v0.6. More projections can be implemented in the orix.projections module when the need arises.