Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelwood100 committed Aug 27, 2020
1 parent 66da664 commit f67cc0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions diffsims/tests/test_utils/test_sim_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ def test_uvtw_to_uvw(uvtw, uvw):
np.testing.assert_almost_equal(val, uvw)


def test_get_intensities_params():
struct = make_structure()
latt = struct.lattice
def test_get_intensities_params(default_structure):
latt = default_structure.lattice
reciprocal_lattice = latt.reciprocal()
reciprocal_radius = 0.2
unique_hkls, multiplicites, g_hkls = get_intensities_params(reciprocal_lattice, reciprocal_radius)
Expand All @@ -151,9 +150,8 @@ def test_get_intensities_params():
print(unique_hkls)
np.testing.assert_array_equal(unique_hkls, [[1., 0., 0.], [0., 0., 0.]])

def test_get_kinematical_intensities():
struct = make_structure()
latt = struct.lattice
def test_get_kinematical_intensities(default_structure):
latt = default_structure.lattice
reciprocal_lattice = latt.reciprocal()
reciprocal_radius = 0.2
unique_hkls, multiplicites, g_hkls = get_intensities_params(reciprocal_lattice, reciprocal_radius)
Expand Down
6 changes: 3 additions & 3 deletions diffsims/utils/sim_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ def get_kinematical_intensities(
# Define an intensity scaling that is linear with distance from Ewald sphere
# along the beam direction.

if (all(excitation_error)!=None):
shape_factor = 1 - (excitation_error / max_excitation_error)
if excitation_error is None:
shape_factor = 1

else:
shape_factor = 1
shape_factor = 1 - (excitation_error / max_excitation_error)

# Calculate the peak intensities from the structure factor and excitation
peak_intensities = multiplicites * (f_hkls * f_hkls.conjugate()).real * shape_factor
Expand Down

0 comments on commit f67cc0a

Please sign in to comment.