Skip to content

Commit 1b8d307

Browse files
committed
update test to work with new centroid
fix unit test after stricter laser centroid_position use
1 parent 35576fe commit 1b8d307

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/python/picongpu/quick/picmi/gaussian_laser.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import unittest
1111
from picongpu import pypicongpu
1212
from math import sqrt
13+
from scipy.constants import c
1314

1415

1516
class TestPicmiGaussianLaser(unittest.TestCase):
@@ -22,7 +23,7 @@ def test_basic(self):
2223
propagation_direction=[0, 1, 0],
2324
polarization_direction=[0, 0, 1],
2425
focal_position=[5, 4, 5],
25-
centroid_position=[0, 0, 0],
26+
centroid_position=[0, -1.5, 0],
2627
E0=5,
2728
picongpu_laguerre_modes=[2.0, 3.0],
2829
picongpu_laguerre_phases=[4.0, 5.0],
@@ -50,7 +51,8 @@ def test_basic(self):
5051
self.assertEqual([[1, -1], [1, -1], [1, -1]], pypic_laser.huygens_surface_positions)
5152

5253
# computed values
53-
self.assertEqual(15, pypic_laser.pulse_init)
54+
self.assertAlmostEqual(-2. * picmi_laser.centroid_position[1] / picmi_laser.propagation_direction[1]
55+
/ c / picmi_laser.duration, pypic_laser.pulse_init)
5456

5557
def test_scalar_values_negative(self):
5658
"""waist, duration and wavelelngth must be > 0"""
@@ -171,7 +173,7 @@ def test_minimal(self):
171173
2,
172174
3,
173175
focal_position=[0, 0, 0],
174-
centroid_position=[0, 0, 0],
176+
centroid_position=[0, -1, 0],
175177
propagation_direction=[0, 1, 0],
176178
polarization_direction=[1, 0, 0],
177179
E0=1,

0 commit comments

Comments
 (0)