Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into release_v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaehne committed Nov 2, 2022
2 parents c802e70 + 6ee5535 commit 55a9c3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
6 changes: 1 addition & 5 deletions lumispy/signals/luminescence_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def to_eV(self, inplace=True, jacobian=True):
The intensity is converted from counts/nm (counts/µm) to counts/cm^-1
by doing a Jacobian transformation, see e.g. Mooney and Kambhampati,
J. Phys. Chem. Lett. 4, 3316 (2013), doi:10.1021/jz401508t, which
ensures that integrated signals are correct also in the wavenumber
ensures that integrated signals are correct also in the wavenumber
domain. If the variance of the signal is known, i.e.
`metadata.Signal.Noise_properties.variance` is a signal representing the
variance, a squared renormalization of the variance is performed.
Expand Down Expand Up @@ -557,10 +557,6 @@ def remove_background_from_file(self, background=None, inplace=False, **kwargs):
try:
bkg_x = background_xy[0]
bkg_y = background_xy[1]
if len(bkg_x) is not len(bkg_y):
raise AttributeError(
"The length of the x and y axis must match."
)
except IndexError: # pragma: no cover
raise AttributeError(
"Please provide a background file containing both the x and y axis."
Expand Down
12 changes: 3 additions & 9 deletions lumispy/tests/signals/test_luminescence_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
(LumiSpectrum(np.ones(50)), [np.zeros(50, dtype="float64")]),
]

error_backgrounds = [
([np.linspace(0, 49, num=10, dtype="float64"), np.ones(50)], AttributeError),
([[1, 1], [1, 1], [1, 1]], AttributeError),
# ([np.linspace(0, 48, num=10, dtype="float64"), np.ones(50)], AttributeError),
]


class TestLumiSpectrum:
def test_remove_background_from_file(self):
Expand All @@ -55,9 +49,9 @@ def test_remove_background_from_file(self):

def test_errors_raise(self):
s = LumiSpectrum(np.ones(50))
for bkg, error in error_backgrounds:
with pytest.raises(error):
s.remove_background_from_file(bkg)
with pytest.raises(AttributeError):
bkg = np.array([[1, 1], [1, 1], [1, 1]])
s.remove_background_from_file(bkg)
# Test that a GUI is opened if s.remove_background_from_file is passed without a background
# s.remove_background_from_file()
# Test double background removal
Expand Down

0 comments on commit 55a9c3d

Please sign in to comment.