Skip to content

Commit

Permalink
Update test_laser_utils.py
Browse files Browse the repository at this point in the history
Add t_peak test
  • Loading branch information
spencerjolly authored Jan 15, 2024
1 parent 78524b3 commit fb2f9ae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_laser_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from lasy.laser import Laser
from lasy.profiles.gaussian_profile import GaussianProfile
from lasy.utils.laser_utils import get_spectrum, compute_laser_energy, get_duration
from lasy.utils.laser_utils import get_spectrum, compute_laser_energy, get_t_peak, get_duration


def get_gaussian_profile():
Expand Down Expand Up @@ -45,6 +45,10 @@ def test_laser_analysis_utils():
energy = compute_laser_energy(dim, laser.grid)
np.testing.assert_approx_equal(spectrum_energy, energy, significant=10)

# Check that laser duration agrees with the given one.
t_peak_rms = get_t_peak(laser.grid, dim)
np.testing.assert_approx_equal(t_peak_rms, laser.profile.t_peak, significant=3)

# Check that laser duration agrees with the given one.
tau_rms = get_duration(laser.grid, dim)
np.testing.assert_approx_equal(2 * tau_rms, laser.profile.tau, significant=3)
Expand Down

0 comments on commit fb2f9ae

Please sign in to comment.