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

Add calib. pat. coords. and area/ROI shapes to NORDIF calib. pat. original metadata #586

Merged

Conversation

hakonanes
Copy link
Member

Description of the change

This PR adds the following information to the original_metadata of a returned EBSD signal with NORDIF calibration patterns (reading of a Setting.txt file):

  • Calibration pattern coordinates
  • Shapes of area (electron image) and region of interest (ROI)
  • Area (electron) image

The coordinates and shapes are given both in terms of pixels in the area image and in terms of the actual navigation shape of the ROI.

This information is required to fit a plane of projection centers (PCs) to selected PCs determined from the calibration patterns.

Other change(s):

  • Magnification is read correctly from EDAX h5ebsd files.

Progress of the PR

Minimal example of the bug fix or new feature

>>> import kikuchipy as kp
>>> s = kp.data.ni_gain0_calibration(allow_download=True)  # or kp.load("Setting.txt")
>>> s
<EBSD, title: Calibration patterns, dimensions: (9|480, 480)>
>>> s.original_metadata.as_dictionary()  # "nordif_header" entry is omitted
{'calibration_patterns': {'indices': array([[447, 425],
         [532, 294],
         [543, 573],
         [378, 596],
         [369, 308],
         [632, 171],
         [668, 704],
         [269, 696],
         [247, 152]]),
  'indices_scaled': array([[119, 113],
         [142,  78],
         [145, 153],
         [101, 159],
         [ 98,  82],
         [169,  46],
         [178, 188],
         [ 72, 186],
         [ 66,  41]])},
 'area': {'shape': (1000, 1000), 'shape_scaled': (267, 267)},
 'roi': {'origin': (185, 73),
  'shape': (558, 750),
  'origin_scaled': (49, 19),
  'shape_scaled': (149, 200)},
 'area_image': array([[144, 120, 165, ..., 255, 255, 252],
        [250, 222, 203, ..., 255, 255, 255],
        [255, 219, 186, ..., 249, 252, 255],
        ...,
        [120, 110, 116, ..., 121, 119, 118],
        [122,  99, 112, ..., 117, 127, 132],
        [122, 108, 121, ..., 112, 118, 122]], dtype=uint8)}

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.
  • New contributors are added to release.py, .zenodo.json and
    .all-contributorsrc with the table regenerated.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
…. metadata

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added bug Something isn't working enhancement New feature or request labels Jan 4, 2023
@hakonanes hakonanes added this to the v0.8.0 milestone Jan 4, 2023
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes merged commit 310a2bf into pyxem:develop Jan 4, 2023
@hakonanes hakonanes deleted the add-nordif-calibration-pattern-info branch January 4, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant