Skip to content

Commit 0d6d63a

Browse files
fix test
1 parent fd3eff6 commit 0d6d63a

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

tests/unit_tests/utils/test_convolution.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -304,30 +304,28 @@ def test_components_delta_gauss(
304304
"Test with different offset types and methods."
305305
# WHEN
306306
if sample_is_gauss:
307-
sample_delta = DeltaFunction(name="Delta", center=0.1, area=2)
308-
resolution_gauss = gaussian_component
307+
sample = DeltaFunction(name="Delta", center=0.1, area=2)
308+
resolution = gaussian_component
309309
else:
310-
sample_delta = DeltaFunction(name="Delta", center=0.1, area=2)
311-
resolution_gauss = gaussian_component
310+
resolution = DeltaFunction(name="Delta", center=0.1, area=2)
311+
sample = gaussian_component
312312

313313
# THEN
314314
calculated_convolution = convolution(
315315
x=x,
316-
sample_model=sample_delta,
317-
resolution_model=resolution_gauss,
316+
sample_model=sample,
317+
resolution_model=resolution,
318318
offset=offset_obj,
319319
method=method,
320320
)
321321

322322
# EXPECT
323-
expected_center = (
324-
sample_delta.center.value + resolution_gauss.center.value + expected_shift
325-
)
326-
expected_area = sample_delta.area.value * resolution_gauss.area.value
323+
expected_center = sample.center.value + resolution.center.value + expected_shift
324+
expected_area = sample.area.value * resolution.area.value
327325
expected_result = (
328326
expected_area
329-
* np.exp(-0.5 * ((x - expected_center) / resolution_gauss.width.value) ** 2)
330-
/ (np.sqrt(2 * np.pi) * resolution_gauss.width.value)
327+
* np.exp(-0.5 * ((x - expected_center) / resolution.width.value) ** 2)
328+
/ (np.sqrt(2 * np.pi) * resolution.width.value)
331329
)
332330

333331
np.testing.assert_allclose(calculated_convolution, expected_result, atol=1e-10)

0 commit comments

Comments
 (0)