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

Allow reading of EDAX TSL .ang files with ten columns #416

Merged
merged 10 commits into from
Jan 31, 2023

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Dec 7, 2022

Description of the change

EDAX TSL .ang files with ten data columns should be read correctly with this patch.

Fixes #413, where it was identified that two openly available .ang files, shown in #411 (comment), were read incorrectly. With this patch, there is a correct correspondence between phase ID and phase list, and the scan unit is "um". Big thanks to @argerlt who pointed me to these datasets.

I've made another small change to IO scan units. Previously, ASTAR/orix/unknown .ang files returned maps with "nm" as scan unit. Now, all but ASTAR .ang files return maps with "um" as scan unit. As far as I know there is no scan unit information .ang files. Hence, we have to guess, and I think the new guess is better.

I'd like to release this as part of a 0.10.3 patch soon (see #415).

Progress of the PR

Minimal example of the bug fix or new feature

Previously

>>> from orix import io

>>> xmap = io.load("IN100_Raw/ANG_Series/Slice_001.ang")
/home/hakon/kode/orix/orix/io/plugins/ang.py:268: UserWarning: Number of columns, 10, in the file is not equal to the expected number of columns, 14, for the 
assumed vendor 'tsl'. Will therefore assume the following columns: euler1, euler2, euler3, x, y, unknown1, unknown2, phase_id, unknown3, unknown4, etc.
  warnings.warn(
>>> xmap
Phase    Orientations    Name  Space group  Point group  Proper point group     Color
    0  37989 (100.0%)  Nickel         None          432                 432  tab:blue
Properties: unknown1, unknown2, unknown3, unknown4
Scan unit: nm

>>> xmap2 = io.load("Field of view 1_EBSD data_Raw.ang")
/home/hakon/kode/orix/orix/io/plugins/ang.py:268: UserWarning: Number of columns, 10, in the file is not equal to the expected number of columns, 14, for the 
assumed vendor 'tsl'. Will therefore assume the following columns: euler1, euler2, euler3, x, y, unknown1, unknown2, phase_id, unknown3, unknown4, etc.
  warnings.warn(
>>> xmap2
Phase      Orientations       Name  Space group  Point group  Proper point group       Color
    0         29 (0.0%)  Austenite         None          432                 432  tab:orange
    1      14900 (0.7%)    Ferrite         None          432                 432    tab:blue
    2   2202639 (99.3%)       None         None         None                None   tab:green
Properties: unknown1, unknown2, unknown3, unknown4
Scan unit: nm

Now

>>> from orix import io

>>> xmap = io.load("IN100_Raw/ANG_Series/Slice_001.ang")
>>> xmap
Phase    Orientations         Name  Space group  Point group  Proper point group     Color
   -1    7912 (20.8%)  not_indexed         None         None                None         w
    0   30077 (79.2%)       Nickel         None          432                 432  tab:blue
Properties: iq, ci, unknown1, fit
Scan unit: um

>>> xmap2 = io.load("Field of view 1_EBSD data_Raw.ang")
>>> xmap2
Phase      Orientations         Name  Space group  Point group  Proper point group       Color
   -1         29 (0.0%)  not_indexed         None         None                None           w
    1      14900 (0.7%)    Austenite         None          432                 432  tab:orange
    2   2202639 (99.3%)      Ferrite         None          432                 432    tab:blue
Properties: iq, ci, unknown1, fit
Scan unit: um

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 hakonanes added the bug Something isn't working label Dec 7, 2022
@hakonanes hakonanes added this to the v0.10.3 milestone Dec 7, 2022
@hakonanes
Copy link
Member Author

The two failing tests on Windows Py 3.9/10 are fixed on develop in #410:

I've also bumped the minimum version of diffpy.structure to 3.0.2 in setup.py. This ensures that Phase.from_cif() works on Windows with Python 3.10. I've added a changelog entry for this change.

I think this fix should be included in a potential patch release.

"fit",
],
"tsl": {
0: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe changing unknown1 to sem is the correct way to read TSL files. example below:

            0: [
                "euler1",
                "euler2",
                "euler3",
                "x",
                "y",
                "iq",  # Image quality from Hough transform
                "ci",  # Confidence index
                "phase_id",
                "sem",
                "fit",  # Pattern fit
                "unknown1",
                "unknown2",
                "unknown3",
                "unknown4",
            ],
            1: [
                "euler1",
                "euler2",
                "euler3",
                "x",
                "y",
                "iq",
                "ci",
                "phase_id",
                "sem",
                "fit",
            ],

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, thanks! I've renamed it to "detector_signal", as I find this more descriptive.

@hakonanes hakonanes changed the base branch from main to develop January 30, 2023 21:00
@hakonanes hakonanes marked this pull request as draft January 30, 2023 21:08
@hakonanes
Copy link
Member Author

The failing tests are test_symmetry_plot() in which the number of Matplotlib collections are checked in the axis returned from Symmetry.plot() (via the figure). The expected number does not match the actual in these tests.

I can reproduce these errors locally after updating to Matplotlib 3.6.3. When running the code in the tests outside of tests, I get the expected number of collections, though. So I do not know what causes the extra collections when running with pytest.

The errors happen when running on both one or more cores (via pytest-xdist).

I think easing the test criteria is the way to go. Will try to find a fix for this in this PR.

@hakonanes hakonanes marked this pull request as ready for review January 31, 2023 08:59
@hakonanes hakonanes modified the milestones: v0.10.3, v0.11.0 Jan 31, 2023
@hakonanes hakonanes requested a review from pc494 January 31, 2023 12:10
Copy link
Member

@pc494 pc494 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, glad the workflows have got an update as well :)

@hakonanes hakonanes merged commit 30caa57 into pyxem:develop Jan 31, 2023
@hakonanes hakonanes deleted the fix-413 branch January 31, 2023 15:00
@hakonanes
Copy link
Member Author

Thank you, @pc494!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect reading of two openly available test datasets in .ang file format
3 participants