-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added polariations and adjusted tests
- Loading branch information
Uwe Hernandez Acosta
committed
Nov 1, 2023
1 parent
b62b8b9
commit e0975ae
Showing
7 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
################# | ||
# polarization vectors | ||
# | ||
# In this file, we provide an extension of the Polarizations of Photons from | ||
# QEDbase to define polarization states of background fields | ||
################ | ||
# | ||
# TODO: | ||
# * write doc strings | ||
# * implement elliptical/circular polarisation | ||
|
||
@inline polarization_vector(pol::AbstractDefinitePolarization, mom) = base_state(Photon(),Incoming(), mom, pol) | ||
|
||
@inline oscillator(::PolX, x) = cos(x) | ||
@inline oscillator(::PolY, x) = sin(x) | ||
@inline function oscillator(::AbstractIndefinitePolarization,x) | ||
sincos_res = sincos(x) | ||
@inbounds cossin_res = (sincos_res[2], sincos_res[1]) | ||
return cossin_res | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
using QEDbase | ||
using QEDfields | ||
using Random | ||
using IntervalSets | ||
|
||
RNG = MersenneTwister(137) | ||
ATOL = eps() | ||
RTOL = sqrt(eps()) | ||
|
||
RND_MOM = SFourMomentum(rand(RNG,4)) | ||
POL_SET = [PolX(), PolY()] | ||
|
||
@testset "polarization vectors" begin | ||
@testset "$mom" for mom in [SFourMomentum(1,0,0,1),RND_MOM] | ||
@testset "single $pol" for pol in POL_SET | ||
pol_vec = polarization_vector(pol,mom) | ||
@test isapprox(pol_vec*pol_vec, -one(eltype(pol_vec)), atol = ATOL, rtol = RTOL) | ||
@test isapprox(pol_vec*mom, zero(eltype(mom)), atol = ATOL, rtol = RTOL) | ||
end | ||
|
||
@testset "both polarizations" begin | ||
pol_vec1 = polarization_vector(PolX(),mom) | ||
pol_vec2 = polarization_vector(PolY(),mom) | ||
|
||
@test isapprox(pol_vec1*pol_vec2, zero(eltype(pol_vec1)), atol = ATOL, rtol = RTOL) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters