Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmenting of the stereographic projection #213

Closed

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Jul 7, 2021

Signed-off-by: Håkon Wiik Ånes hwaanes@gmail.com

Description of the change

This PR aims to allow drawing segment boarders in the stereographic projection, which will mostly be used for triangles.

I set up this PR so that others can contribute with comments on the API etc. It is still highly a work in progress.

See discussion in #169 and #166.

Progress of the PR

  • Figure out what to call Symmetry.fundamental_sector(), since I'd like to call the new property Symmetry.fundamental_sector, as per discussions in Project Miller indices (directions or plane normals) into a fundamental sector defined by a point group symmetry #169.
  • Ensure the sector looks correct for all 32 point groups.
    - [ ] Add Vector3d.plot() to draw lines between points (like the triangle). This is different from scatter() and draw_circle(). Will be added in a later PR. Only added to StereographicPlot.plot() here.
  • Allow plotting only a segment of the stereographic projection, defined e.g. by a fundamental sector, which typically is the inverse pole figure.
  • Add S2 UV sampling in new orix.sampling.S2_sampling.uniform_S2_sample() function. Necessary to get center vector for some point groups' fundamental sectors.
  • Docstrings for all functions
  • Unit tests with pytest for all lines
  • Clean code style by running black via pre-commit

Minimal example of the bug fix or new feature

Plotting the fundamental sector of point group m-3m in the stereographic projection

>>> import matplotlib.pyplot as plt
>>> from orix.quaternion.symmetry import T
>>> fs = T.fundamental_sector
>>> fig, ax = plt.subplots(subplot_kw=(projection="stereographic"))
>>> ax.scatter(fs.vertices, c="r")
>>> ax.plot(fs.edges, color="g")
>>> ax.scatter(fs.center, c="b")

produces this plot in stereographic projection (equal angle)

orix_28_T_23_laue_23_pf

From MTEX in equal area projection

28_T_laue_m-3_pf

For reviewers

  • The PR title is short, concise, and will make sense 1 year later.
  • New functions are imported in corresponding __init__.py.
  • New features, API changes, and deprecations are mentioned in the
    unreleased section in CHANGELOG.rst.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added the enhancement New feature or request label Jul 7, 2021
@hakonanes hakonanes added this to the v0.7.0 milestone Jul 7, 2021
@hakonanes hakonanes marked this pull request as draft July 7, 2021 12:52
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added the help-wanted A little help with this would be nice label Jul 13, 2021
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes
Copy link
Member Author

This PR is getting there, although there's lots of work left. I'm pretty sure I'll close this PR and make a new one from a new branch, since there is lots of trial and error here.

The framework in this PR only focuses on internal use, and little new public API will be added.

We're able to restrict the stereographic axes (xaxis - azimuth, yaxis - polar) using a SphericalRegion, most likely a FundamentalSector derived from a Symmetry:

>>> import matplotlib.pyplot as plt
>>> from orix import plot, quaternion
>>> pg = quaternion.symmetry.Td
>>> fig, ax = plt.subplots(subplot_kw=dict(projections="stereographic"))
>>> ax.grid()
>>> pg.fundamental_sector.vertices
Vector3d (3,)
[[ 0.5774  0.5774  0.5774]
 [ 0.      0.      1.    ]
 [ 0.5774 -0.5774  0.5774]]
>>> ax._restrict_to_fundamental_sector(pg.fundamental_sector)

Td_restricted

@pc494
Copy link
Member

pc494 commented Jul 16, 2021

Just for documentation purposes, I'm fairly sure that the sampling you've brought over from diffsims is of S2, not SO(2)

@hakonanes
Copy link
Member Author

Just for documentation purposes, I'm fairly sure that the sampling you've brought over from diffsims is of S2, not SO(2)

Yup, will change. Thanks.

@hakonanes hakonanes modified the milestones: v0.7.0, v0.8.0 Sep 5, 2021
@hakonanes
Copy link
Member Author

To not use up CI resources, I'll close this, but open a new PR once ready.

@hakonanes hakonanes closed this Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help-wanted A little help with this would be nice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants