From cbf11daf201f57d0c8fd4524ffd8310027ad53b8 Mon Sep 17 00:00:00 2001 From: phillip Date: Thu, 3 Sep 2020 10:53:44 +0100 Subject: [PATCH] excitation_function---> shape_factor_model --- diffsims/generators/diffraction_generator.py | 12 ++++++------ .../test_generators/test_diffraction_generator.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/diffsims/generators/diffraction_generator.py b/diffsims/generators/diffraction_generator.py index 965b918a..e1b62a73 100644 --- a/diffsims/generators/diffraction_generator.py +++ b/diffsims/generators/diffraction_generator.py @@ -94,7 +94,7 @@ def calculate_ed_data( structure, reciprocal_radius, rotation=(0, 0, 0), - excitation_function="linear", + shape_factor_model="linear", max_excitation_error=1e-2, with_direct_beam=True, **kwargs @@ -113,7 +113,7 @@ def calculate_ed_data( rotation : tuple Euler angles, in degrees, in the rzxz convention. Default is (0,0,0) which aligns 'z' with the electron beam - excitation_function : function or str + shape_factor_model : function or str a function that takes excitation_error and max_excitation_error (and potentially **kwargs) and returns an intensity scaling factor. The code provides "linear" and "binary" options accessed with by parsing the associated strings max_excitation_error : float @@ -122,7 +122,7 @@ def calculate_ed_data( If True, the direct beam is included in the simulated diffraction pattern. If False, it is not. **kwargs : - passed to excitation_function + passed to shape_factor_model Returns ------- @@ -162,12 +162,12 @@ def calculate_ed_data( excitation_error = excitation_error[intersection] g_hkls = spot_distances[intersection] - if excitation_function == "linear": + if shape_factor_model == "linear": shape_factor = 1 - (excitation_error / max_excitation_error) - elif excitation_function == "binary": + elif shape_factor_model == "binary": shape_factor = 1 else: - shape_factor = excitation_function( + shape_factor = shape_factor_model( excitation_error, max_excitation_error, **kwargs ) diff --git a/diffsims/tests/test_generators/test_diffraction_generator.py b/diffsims/tests/test_generators/test_diffraction_generator.py index 2c48dd20..a9d109a0 100644 --- a/diffsims/tests/test_generators/test_diffraction_generator.py +++ b/diffsims/tests/test_generators/test_diffraction_generator.py @@ -129,14 +129,14 @@ def test_shape_factor_strings( self, diffraction_calculator, local_structure, string ): _ = diffraction_calculator.calculate_ed_data( - local_structure, 2, excitation_function=string + local_structure, 2, shape_factor_model=string ) def test_shape_factor_custom(self, diffraction_calculator, local_structure): def local_excite(excitation_error, maximum_excitation_error, t): return (np.sin(t) * excitation_error) / maximum_excitation_error - _ = diffraction_calculator.calculate_ed_data(local_structure, 2,excitation_function=local_excite, t=0.2) + _ = diffraction_calculator.calculate_ed_data(local_structure, 2,shape_factor_model=local_excite, t=0.2) def test_calculate_profile_class(self, local_structure, diffraction_calculator): # tests the non-hexagonal (cubic) case