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

Fix typo in equation that computes interplanar angels #2780

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EurusWei
Copy link

@EurusWei EurusWei commented Dec 21, 2022

Summary

In the function get_interplnar_angle of module analysis/diffraction/tem.py, there are some typos about the angels and index.

Todo (if any)

N/A

Checklist

Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request title.

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format. Run pydocstyle on your code.
  • Type annotations are highly encouraged. Run mypy path/to/file.py to type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more efficient if you already fix most errors prior to submitting the PR. We highly recommended installing pre-commit hooks. Simply Run

pip install -U pre-commit
pre-commit install

in the repo's root directory. Afterwards linters will run before every commit and abort if any issues pop up.

@mkhorton
Copy link
Member

Thanks @EurusWei, much appreciated for catching this!

Can you suggest a good test for this function, e.g. a known input and output?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 46.594% when pulling 4c0cd65 on EurusWei:fix-equation into b566980 on materialsproject:master.

@EurusWei
Copy link
Author

Thanks @EurusWei, much appreciated for catching this!

Can you suggest a good test for this function, e.g. a known input and output?

Hi Horton,

Has this catch been confirmed to be true? I am comparing the diffraction patterns (DPs) generated before and after the fix to those on the MaterialsProject website. I found the code before the fix generated DPs matched the MaterialsProject, instead of after the fix. Based on symmetry I am sure the equation should be fixed, but I don't know why the above phenomenon happens (not what I expected). Do you know how the MaterialsProject website generates their DPs?

@mkhorton
Copy link
Member

mkhorton commented Dec 21, 2022

Yes, I do -- the MP website uses the TEMCalculator exactly from pymatgen. At time of writing, this is pymatgen 2022.11.7.

We, at Materials Project, are likely switching to use functionality from py4DSTEM in future, and this is being worked on by @sezelt (and is looking really nice!) but right now, all functionality is unmodified from pymatgen.

@EurusWei
Copy link
Author

I see, that makes sense. Since I don't have much background in this field, I cannot tell which DP is more accurate, before or after the fix. What about this: I will give you some examples that I find having discrepancies in DPs before and after the fix, together with my calculation results, and your group can help identify if this fix makes sense. After that you can either add some tests or directly merge the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing PRs that are not ready to merge due to lacking tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants