Skip to content

Commit

Permalink
Fix integer sigma in multi-broadening functions (#35)
Browse files Browse the repository at this point in the history
There was a bug when singled-value sigma/gamma were
provided as integers for the peaks in multi-broadening
functions. A list wasn't generated properly.
  • Loading branch information
bastonero authored Jul 27, 2023
1 parent b6487cf commit c786c70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/aiida_vibroscopy/utils/broadenings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def multilorentz(x_range: np.ndarray, peaks: list[float], intensities: list[floa
raise ValueError("length of `gammas` and `peaks` doesn't match")
sigmas = deepcopy(gammas)
else:
sigmas = float(gammas)
sigmas = [float(gammas) for _ in peaks]

if len(intensities) != len(peaks):
raise ValueError("length of `intensities` and `peaks` doesn't match")
Expand Down Expand Up @@ -164,7 +164,7 @@ def multilvoigt(
raise ValueError("length of `gammas_lorentz` and `peaks` doesn't match")
sigmas = deepcopy(gammas_lorentz)
else:
sigmas = float(gammas_lorentz)
sigmas = [float(gammas_lorentz) for _ in peaks]

if len(intensities) != len(peaks):
raise ValueError("length of `intensities` and `peaks` doesn't match")
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_broadening.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _generate_lorentz_inputs(multi=False):
x_range = np.arange(0, 100, 0.1)
peak = 50.0
intensity = 1.0
sigma = 10.0
sigma = 10

if multi:
peak = [20.0, 30.0, 40.0]
Expand Down

0 comments on commit c786c70

Please sign in to comment.