Skip to content

Fix typo in equation that computes interplanar angels#2780

Open
EurusWei wants to merge 1 commit intomaterialsproject:masterfrom
EurusWei:fix-equation
Open

Fix typo in equation that computes interplanar angels#2780
EurusWei wants to merge 1 commit intomaterialsproject:masterfrom
EurusWei:fix-equation

Conversation

@EurusWei
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown

Coverage Status

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

@EurusWei
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@mkhorton mkhorton added the needs testing PRs that are not ready to merge due to lacking tests label Mar 2, 2023
@janosh janosh force-pushed the master branch 2 times, most recently from 3c23114 to 36e289c Compare December 19, 2023 02:10
@janosh janosh force-pushed the master branch 4 times, most recently from d725325 to dca98be Compare February 2, 2024 11:47
@janosh janosh force-pushed the master branch 2 times, most recently from e3fbc67 to 41e6d99 Compare August 3, 2024 19:01
@shyuep
Copy link
Copy Markdown
Member

shyuep commented Apr 10, 2026

Any update on this?

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.

4 participants