Skip to content

Commit

Permalink
Update test_laser_profiles.py
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerjolly authored Jan 15, 2024
1 parent 9663291 commit 41b17de
Showing 1 changed file with 50 additions and 53 deletions.
103 changes: 50 additions & 53 deletions tests/test_laser_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,39 @@ def gaussian():

return profile

@pytest.fixture(scope="function")
def spatial_chirp():
# Cases with Gaussian laser having non-zero spatial chirp (b)
wavelength = 0.8e-6
pol = (1, 0)
laser_energy = 1.0 # J
t_peak = 0.0e-15 # s
tau = 30.0e-15 # s
w0 = 5.0e-6 # m
a = 0.0
b = w0 * tau / 2 # m.s
profile = GaussianProfile(
wavelength, pol, laser_energy, w0, tau, t_peak, a, b, gdd=0.0
)

def test_profile_gaussian_spatial_chirp(spatial_chirp):
# - 3D Cartesian case
dim = "xyt"
lo = (-10e-6, -10e-6, -60e-15)
hi = (+10e-6, +10e-6, +60e-15)
npoints = (100, 100, 100)

laser = Laser(dim, lo, hi, npoints, spatial_chirp)
laser.write_to_file("gaussianlaserSC")
laser.propagate(1e-6)
laser.write_to_file("gaussianlaserSC")


def test_profile_gaussian_angular_dispersion(angular_dispersion):
# - 3D Cartesian case
dim = "xyt"
lo = (-10e-6, -10e-6, -60e-15)
hi = (+10e-6, +10e-6, +60e-15)
npoints = (100, 100, 100)
return profile

laser = Laser(dim, lo, hi, npoints, angular_dispersion)
laser.write_to_file("gaussianlaserAD")
laser.propagate(1e-6)
laser.write_to_file("gaussianlaserAD")
@pytest.fixture(scope="function")
def angular_dispersion():
# Cases with Gaussian laser having non-zero angular dispersion (a)
wavelength = 0.8e-6
pol = (1, 0)
laser_energy = 1.0 # J
t_peak = 0.0e-15 # s
tau = 30.0e-15 # s
w0 = 5.0e-6 # m
a = tau / w0 # s/m
b = 0.0
profile = GaussianProfile(
wavelength, pol, laser_energy, w0, tau, t_peak, a, b, gdd=0.0
)

return profile

def test_transverse_profiles_rt():
npoints = 4000
Expand Down Expand Up @@ -185,40 +192,30 @@ def test_profile_gaussian_cylindrical(gaussian):
laser.propagate(1e-6)
laser.write_to_file("gaussianlaserRZ")

def test_profile_gaussian_spatial_chirp(spatial_chirp):
# - 3D Cartesian case
dim = "xyt"
lo = (-10e-6, -10e-6, -60e-15)
hi = (+10e-6, +10e-6, +60e-15)
npoints = (100, 100, 100)

def spatial_chirp():
# Cases with Gaussian laser having non-zero spatial chirp (b)
wavelength = 0.8e-6
pol = (1, 0)
laser_energy = 1.0 # J
t_peak = 0.0e-15 # s
tau = 30.0e-15 # s
w0 = 5.0e-6 # m
a = 0.0
b = w0 * tau / 2 # m.s
profile = GaussianProfile(
wavelength, pol, laser_energy, w0, tau, t_peak, a, b, gdd=0.0
)

return profile

laser = Laser(dim, lo, hi, npoints, spatial_chirp)
laser.write_to_file("gaussianlaserSC")
laser.propagate(1e-6)
laser.write_to_file("gaussianlaserSC")

def angular_dispersion():
# Cases with Gaussian laser having non-zero angular dispersion (a)
wavelength = 0.8e-6
pol = (1, 0)
laser_energy = 1.0 # J
t_peak = 0.0e-15 # s
tau = 30.0e-15 # s
w0 = 5.0e-6 # m
a = tau / w0 # s/m
b = 0.0
profile = GaussianProfile(
wavelength, pol, laser_energy, w0, tau, t_peak, a, b, gdd=0.0
)

return profile
def test_profile_gaussian_angular_dispersion(angular_dispersion):
# - 3D Cartesian case
dim = "xyt"
lo = (-10e-6, -10e-6, -60e-15)
hi = (+10e-6, +10e-6, +60e-15)
npoints = (100, 100, 100)

laser = Laser(dim, lo, hi, npoints, angular_dispersion)
laser.write_to_file("gaussianlaserAD")
laser.propagate(1e-6)
laser.write_to_file("gaussianlaserAD")

def test_from_array_profile():
# Create a 3D numpy array, use it to create a LASY profile,
Expand Down

0 comments on commit 41b17de

Please sign in to comment.