def test_matched_laser_plasma(cet_param): """Check laser-plasma matching function.""" match = matched_laser_plasma(cet_param.a0) assert_allclose_units(match.ΔE, 1564.41581593 * u.megaelectronvolt) assert_allclose_units(match.Q, 533.34275131 * u.picocoulomb) assert_allclose_units(match.η, 0.1228936 * u.dimensionless) with pytest.raises(ValueError): _ = matched_laser_plasma(a0=0.5 * u.dimensionless)
def test_plasma_with_laser(cet_plasma, cet_param): """Check Plasma class when given a Laser.""" # test constructor with no bubble_radius and given propagation_distance _ = Plasma( n_pe=cet_param.npe, laser=cet_plasma.laser, propagation_distance=13.56555928 * u.mm, ) assert_allclose_units(cet_plasma.Pc, 19.7422087 * u.terawatt) assert_allclose_units(cet_plasma.depletion, 13.92603593 * u.mm) assert_allclose_units(cet_plasma.dephasing, 13.56555928 * u.mm)
def test_atom_list_position(self): atom = Atom() atom.position = [2.0, 2.0, 2.0] u.assert_allclose_units(atom.position, (2.0, 2.0, 2.0) * u.nm)
def test_atom_tuple_position(self): atom = Atom() atom.position = (2.0, 2.0, 2.0) u.assert_allclose_units(atom.position, [2.0, 2.0, 2.0] * u.nm)
def test_plasma(cet_plasma, cet_param): """Check Plasma class.""" assert_allclose_units(cet_plasma.λp, 27.26235669 * u.micrometer) assert_allclose_units(cet_plasma.kp, cet_param.kp) assert_allclose_units(cet_plasma.ωp, 0.0690935 * 1 / u.femtosecond)
def test_laser(cet_plasma, cet_param): """Check Laser class.""" laser = cet_plasma.laser assert_allclose_units(laser.ɛL, cet_param.ɛL) assert_allclose_units(laser.ncrit, 1741.95959e18 / u.cm**3) assert_allclose_units(laser.kL, 7.85398163 * 1 / u.micrometer) assert_allclose_units(laser.ωL, 2.35456446 * 1 / u.femtosecond) assert_allclose_units(laser.P0, 180.84167615 * u.terawatt) assert_allclose_units(laser.I0, 3.5533144e19 * u.watt / u.cm**2) assert_allclose_units(laser.E0, 16362.40354854 * u.megavolt / u.mm)
def test_rayleigh(cet_plasma, cet_param): """Check Rayleigh length.""" assert_allclose_units(cet_plasma.laser.beam.zR, cet_param.zR)
def test_a0_intensity(cet_param): """Round-trip checking of a0 to io to a0 conversion.""" assert_allclose_units(a0_from_intensity(intensity_from_a0(cet_param.a0)), cet_param.a0)
def test_waist_fwhm(cet_param): """Round-trip checking of w0 to fwhm to w0 conversion.""" assert_allclose_units(fwhm_to_w0(w0_to_fwhm(cet_param.w0)), cet_param.w0)
def test_w0_to_fwhm(cet_param): """The the beam-waist to full-width half-maximum conversion.""" fwhm = w0_to_fwhm(cet_param.w0) assert_allclose_units(fwhm, cet_param.fwhm)
def test_simulation(cet_plasma, cet_param): """Check Simulation class.""" with pytest.raises(TypeError): _ = Simulation( Plasma(n_pe=cet_param.npe, propagation_distance=13.56555928 * u.mm) ) sim = Simulation(cet_plasma) assert_allclose_units(sim.L, 109.04942675 * u.micrometer) assert_allclose_units(sim.Δx, 0.43389388 * u.micrometer) assert_allclose_units(sim.Δz, 0.04 * u.micrometer) assert_allclose_units(sim.nx, 251 * u.dimensionless) assert_allclose_units(sim.nz, 2726 * u.dimensionless) assert_allclose_units(sim.npart, 1373925808 * u.dimensionless) assert_allclose_units(sim.nstep, 341865 * u.dimensionless) sim2 = Simulation(cet_plasma, box_length=4 * cet_plasma.λp, ppc=8) assert sim2 == sim