Skip to content

PR623 Add "Phase.plot_unit_cell" function#623

Open
argerlt wants to merge 8 commits intopyxem:developfrom
argerlt:Add-Phase.plot_unit_cell
Open

PR623 Add "Phase.plot_unit_cell" function#623
argerlt wants to merge 8 commits intopyxem:developfrom
argerlt:Add-Phase.plot_unit_cell

Conversation

@argerlt
Copy link
Collaborator

@argerlt argerlt commented Feb 3, 2026

Description of the change

As part of updating the examples, I wanted to be able to plot a unit cell. It ended up being nicer to just make it a class feature as opposed to a function in an example. This does that, and replaces a large chunck of crystal_map.ipynb with examples.

For reference, here are similar functions in other packages
py4dstem kinematical example notebook
The atomic models tutorial from abTEM
MTEX

Progress of the PR

Minimal example of the bug fix or new feature

import diffpy.structure as dps
import orix.crystal_map as ocm

atoms = [
    dps.Atom("Al",[1/3,2/3,0.815]),
         dps.Atom("O",[0.361,1/3,0.583]),
         ]
lattice = dps.Lattice(0.481, 0.481, 1.391, 90, 90, 120)
structure = dps.Structure(atoms=atoms, lattice=lattice)
Al2O3_phase = ocm.Phase(name = "Alumina",
    space_group = 167,
    structure = structure,
    color = 'red',
).expand_asymmetric_unit()

unit_cell_figure = Al2O3_phase.plot_unit_cell(return_figure=True)
unit_cell_figure.suptitle(r"$Al_2O_3$ unit cell")

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.
  • Contributor(s) are listed correctly in __credits__ in orix/__init__.py and in
    .zenodo.json.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@argerlt argerlt changed the title Add phase.plot unit cell PR623 Add "plot_unit_cell" function to Phase class Feb 3, 2026
@argerlt argerlt changed the title PR623 Add "plot_unit_cell" function to Phase class PR623 Add "Phase.plot_unit_cell" function Feb 3, 2026
@argerlt
Copy link
Collaborator Author

argerlt commented Feb 3, 2026

pre-commit.ci autofix

1 similar comment
@argerlt
Copy link
Collaborator Author

argerlt commented Feb 3, 2026

pre-commit.ci autofix

@argerlt
Copy link
Collaborator Author

argerlt commented Feb 3, 2026

@hakonanes, it looks like psf/black and pre-commit are disagreeing with each other on how to format "S2_sampling.py".

My thought is to just remove the psf/black check from workflows. we can do it in the hotfix 0.14.2 hotfix if you agree.

@argerlt argerlt force-pushed the Add-Phase.plot_unit_cell branch from 8682d43 to 50cff46 Compare February 27, 2026 22:56
@argerlt
Copy link
Collaborator Author

argerlt commented Feb 27, 2026

pre-commit.ci autofix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant