Skip to content

Commit

Permalink
Test free/fix FS and wrong smoothing value
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-dlp committed Sep 21, 2023
1 parent 2f107c1 commit 58841b6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions hyperspy/tests/model/test_eelsmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,34 @@ def test_fine_structure_smoothing(self):
assert len(Fe.fine_structure_coeff) < len_coeff
Fe.fine_structure_smoothing = 0.4
assert len(Fe.fine_structure_coeff) > len_coeff
with pytest.raises(ValueError):
Fe.fine_structure_smoothing = 3
with pytest.raises(ValueError):
Fe.fine_structure_smoothing = -3

def test_free_fix_fine_structure(self):
Fe = self.m.components.Fe_L3
Fe.fine_structure_active = True
assert Fe.fine_structure_coeff.free
Fe.fix_fine_structure()
assert not Fe.fine_structure_coeff.free
Fe.free_fine_structure()
assert Fe.fine_structure_coeff.free
Fe.fine_structure_components.update((self.g1, self.g2))
self.g1.fwhm.free = False
self.g2.fwhm.free = False
Fe.fix_fine_structure()
for component in (self.g1, self.g2):
for parameter in component.parameters:
assert not parameter.free
Fe.free_fine_structure()
for component in (self.g1, self.g2):
for parameter in component.parameters:
if parameter.name != "fwhm":
assert parameter.free
else:
assert not parameter.free


def test_fine_structure_active_frees_coeff(self):
Fe = self.m.components.Fe_L3
Expand Down

0 comments on commit 58841b6

Please sign in to comment.