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

BugFix: Allow get_kwargs for setting kwargs on __mul__ #499

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

CSSFrancis
Copy link
Member

Description of the change

This should fix (part) of the problems upstream with pyxem/diffsims#211 by allowing the function get_kwargs to be overwritten in subclasses and change the order/what is passed to the init fuction.

Minimal example of the bug fix or new feature (This now works)

from orix.crystal_map import Phase
from orix.quaternion import Rotation
from diffsims.crystallography import ReciprocalLatticeVector


phase = Phase(point_group="m-3m")
g = ReciprocalLatticeVector(phase, [1, 1, 1])

R = Rotation.random()
g1 = R * g

# CHanges to RLV
# ---------------- 

    def get_kwargs(self, new_data, *args, **kwargs):
        return dict(phase=self.phase, xyz=new_data)

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.

@hakonanes
Copy link
Member

Thanks for suggesting a fix to the issue in diffsims. But, I've raised some doubts regarding our approach in the referenced issue pyxem/diffsims#211 (comment).

@CSSFrancis
Copy link
Member Author

@hakonanes I think this should be possible. It works quite nicely with everything and makes the logic much simpler. Otherwise we end up having to struggle to track the rotation alongside the RLV from diffsims --> pyxem and it gets complicated.

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.

None yet

2 participants