Skip to content

Commit

Permalink
Test that enabling/disabling FS enables/disables FS components
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-dlp committed Sep 21, 2023
1 parent 97ef087 commit 1fc8dde
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion hyperspy/tests/model/test_eelsmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ def test_fs_components_inherit_fs_active(self, fine_structure_active):
self.m.components.Fe_L3.fine_structure_components.update((self.g1, self.g2))
for component in self.m.components.Fe_L3.fine_structure_components:
assert component.active == fine_structure_active
self.m.components.Fe_L3.fine_structure_active = (not fine_structure_active)
for component in self.m.components.Fe_L3.fine_structure_components:
assert component.active == (not fine_structure_active)


def test_fine_structure_smoothing(self):
Fe = self.m.components.Fe_L3
Expand Down Expand Up @@ -514,4 +518,17 @@ def test_fine_structure_spline(self):
axis3 = np.linspace(Fe.onset_energy.value + Fe.fine_structure_spline_onset,
Fe.onset_energy.value + Fe.fine_structure_width, endpoint=False)
assert np.all(Fe.function(axis2) == 0)
assert np.all(Fe.function(axis3) != 0)
assert np.all(Fe.function(axis3) != 0)

def test_model_store_restore(self):
Fe = self.m.components.Fe_L3
Fe.fine_structure_active = True
Fe.fine_structure_components.update((self.g1, self.g2))
Fe.fine_structure_spline_onset = 20
Fe.fine_structure_coeff.value = np.arange(len(Fe.fine_structure_coeff.value)) + 1
m = self.m
m.store()
mc = m.signal1D.models.a.restore()
assert np.array_equal(m(), mc())


0 comments on commit 1fc8dde

Please sign in to comment.