-
Notifications
You must be signed in to change notification settings - Fork 29
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
Detector orientation with euler angles: simulations from master patterns and GeometricalKikuchiPatternSimulation #691
base: develop
Are you sure you want to change the base?
Commits on Nov 22, 2024
-
Modified EBSDDetector to incude detector Euler angles
Added an attribute self._euler, which holds the three detector Euler angles in degrees. These describe the orientation of the detector. The attributes self.tilt and self.azimuthal were made into "non-public" attributes i.e. self._tilt and self._azimuthal. self._tilt, self._azimuthal and self._euler are set directly in self.__init__() i.e. NOT by calling the setters. These values will therefore always be self consistent: self._euler is not an argument for self.__init_(). Getters and setters were added for tilt, azimuthal and euler. These are designed to retain self.consistency - e.g. if you set self.azimuthal or self.tilt, self.euler will be updated accordingly and vice versa. self.euler[0] == self.azimuthal self.euler[1] == 90 + self.tilt The methods EBSDDetector.save() and EBSDDetector.load() were updated so that the EBSDDetector.euler property is additionally saved. This is needed because EBSDDetector.euler[2] may not be zero and is currently not represented by any other EBSDDetector property or attribute. The test method TestSaveLoadDetector.test_save_load_detector() in tests/test_detectors/test_ebsd_detector.py has been updated to include an extra assert statement to check that the saved and read euler angles are the same. All tests in TestSaveLoadDetector pass with the current code. The tests test_set_tilt(), test_set_azimuthal() and test_set_euler() were added to the class TestEBSDDetector in tests/test_detectors/test_ebsd_detector.py. These help to ensure that when setting one of the properties, the others are updated for consistency. All tests in tests/test_detectors/test_ebsd_detector.py pass with the current code. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 378f09c - Browse repository at this point
Copy the full SHA 378f09cView commit details -
Added properties u_s and u_s_inv to EBSDDetector
These properties return the orientation matrix u_s, which transforms vectors in the sample coordinate system CSs, to the detector coordinate system, CSd, and the inverse matrix, u_s_inv,for the opposite transformation. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a1046bd - Browse repository at this point
Copy the full SHA a1046bdView commit details -
Updated EBSDDetector.__repr__() to include euler and updated associat…
…ed test The __repr__() method in the EBSDDetector class in src/kikuchipy/detectors/ebsd_detector.py was modified so that the detector euler angles are also printed. The associated test, TestEBSDDetector.test_repr() in tests/test_detectors/test_ebsd_detector.py was modified accordingly so that it still passes. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4bcffe0 - Browse repository at this point
Copy the full SHA 4bcffe0View commit details -
Modified KikuchiPatternSimulator.on_detector() for detector Euler
Modified the calculation of the orientation matrix u_s_bruker in KikuchiPatternSimulator.on_detector(). Previously u_s_bruker was determined from the 'total_tilt', which only considered EBSDDetector.sample_tilt and EBSDDetector.tilt but NOT EBSDDetector.azimuthal. Now EBSDDetector has the detector Euler angles, which describe the full orientation of the detector and these can be used to calculate u_s_bruker. In this way, the full orientation of the detector can be considered when making simulations to overlay on patterns. This will give a much better fit for cases where the detector azimuthal angle was non-zero (i.e. EBSDDetector.euler[0] != 0) or where the third detector Euler angle was non-zero. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c4e8383 - Browse repository at this point
Copy the full SHA c4e8383View commit details -
Modified functions for getting direction cosines in kikuchipy.signals…
….util._master_pattern.py The functions _get_direction_cosines_for_fixed_pc() and _get_direction_cosines_for_varying_pc() have been modified. The previous functions used an algorithm adapted from EMSoft to calculate the direction cosines of the detector pixels. This has now been changed and the functions use an orientation matrix approach, adapted from that in the tutorial paper by Britton et al. This enables the detector tilt, azimuthal and euler[2], i.e. all 3 detector euler angles, to be correctly incorporated in the pattern simulation. The function _get_direction_cosines_from_detector() has been updated to reflect the new signatures of the other two functions. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 735b38d - Browse repository at this point
Copy the full SHA 735b38dView commit details -
Removed the function _get_cosine_sine_of_alpha_and_azimuthal() and as…
…sociated test The funtion _get_cosine_sine_of_alpha_and_azimuthal() has been removed from src/kikuchipy/signals/util/_master_pattern.py as it is no longer needed. The function import and associated test in tests/test_signals/test_ebsd_master_pattern.py has also been removed. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a972111 - Browse repository at this point
Copy the full SHA a972111View commit details -
Updated tests calling _get_direction_cosines_for_fixed_pc() and _get_…
…direction_cosines_for_varying_pc() In tests/test_rotation/test_rotation.py: In TestRotationVectorTools.test_rotate_vector(), added the instantiation of an EBSDDetector so that the gnomonic_bounds can be passed into the new signature of _get_direction_cosines_for_fixed_pc(). Modified the arguments in the function call accordingly. In tests/test_signals/test_ebsd_master_pattern.py: In TestProjectFromLambert.test_get_direction_cosines(), updated the arguments in the function call to _get_direction_cosines_for_fixed_pc(). Added a further call to that function but WITHOUT .py_func and added a further assert statement to check that the results with and without .py_func are the same (as recommended in the contributing guidelines). In TestProjectFromLambert.test_get_direction_cosines_for_multiple_pcs(), updated the arguments in the function call to _get_direction_cosines_for_varying_pc(). Added a further call to that function but WITHOUT .py_func and added a further assert statement to check that the results with and without .py_func are the same (as recommended in the contributing guidelines). In TestProjectFromLambert.test_detector_azimuthal() As the function_get_direction_cosines_for_fixed_pc() has been modified, the small rotation in the EBSD pattern simulated from the master pattern for tilt!=0 and azimuthal!=0 is no longer present. The mean values of the data in the simulated patterns sim2 and sim3 in the above test are therefore very slightly different to the old values. The mean values have been updated. The above tests are now all passing. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4a21aba - Browse repository at this point
Copy the full SHA 4a21abaView commit details -
Updated getting direction cosines in objective functions and solvers …
…for indexing In src/kikuchipy/indexing/_refinement/_objective_functions.py, _refine_pc_objective_function() and _refine_orientation_pc_objective_function() were modified. Instead of calling _get_direction_cosines_for_fixed_pc() directly, an EBSDDetector is instantiated and _get_direction_cosines_from_detector() is called instead. This handles the changed function signature of _get_direction_cosines_for_fixed_pc(). In src/kikuchipy/indexing/_refinement/_solvers.py, _refine_orientation_solver_scipy() and _refine_orientation_solver_nlopt() were modified. The block under "if direction_cosines is None:" has been changed so that an EBSDDetector is instantiated and then _get_direction_cosines_from_detector() is called. Imports to these two modules have been added/modified accordingly. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3af47f7 - Browse repository at this point
Copy the full SHA 3af47f7View commit details -
Modified test_refine_orientation_pc_pseudo_symmetry_scipy()
The above function in the suite TestEBSDRefineOrientationPC has been modified by adding a trust region as an argument in the call to s.refine_orientation_projection_centre() with the method "differential_evolution". This was necessary because the new version of _refine_orientation_pc_objective_function() in indexing\_refinement\_objective_functions.py requires the instatiation of an EBSDDetector and thus the subsequent calculation of its gnomonic_bounds. If pc is (0, 0, 0), this leads to strange results which cause errors in the function _get_direction_cosines_for_fixed_pc() in signals\util\_master_pattern.py. Adding the trust region (same parameters as in the earlier call to s.refine_orientation_projection_centre() within the same test function) solves this problem. The test test_refine_orientation_pc_pseudo_symmetry_scipy() now passes, as do ALL the tests in tests/test_indexing/test_ebsd_refinement.py. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a0bf69a - Browse repository at this point
Copy the full SHA a0bf69aView commit details -
Added a class testing the fit between a simulated EBSD pattern and a …
…GeometricalKikuchiPatternSimulation The class TestFitPatternDetectorOrientation has been added to tests/test_signals/test_ebsd_master_pattern.py. The class contains the test test_fit_detector_orientation(), which is parametrised with 8 sets of detector tilt, azimuthal and euler_2 angles, and lists of associated zone axes, which are on the pattern simulated under those conditions. For each set of parameters, we expect that the fit between the simulated pattern and the GeometricalKikuchiPatternSimulation is perfect. These tests are currently all passing. Signed-off-by: tgwoodcock <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 22842a0 - Browse repository at this point
Copy the full SHA 22842a0View commit details