Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Base state for photons is not correct #49

Closed
szabo137 opened this issue Dec 11, 2023 · 0 comments · Fixed by #50
Closed

[BUG] Base state for photons is not correct #49

szabo137 opened this issue Dec 11, 2023 · 0 comments · Fixed by #50
Labels
01 - Bug Something isn't working as expected; needs a fix 02 - Critical Something breaks the code; needs a fix asap
Milestone

Comments

@szabo137
Copy link
Member

It seems like the base state of incoming and outgoing photons for PolY is wrong regarding the azimuthal angle:

julia> using QEDbase

julia> using Test

julia> function test_ortho(phi)
           om = 1.0
           cth, sth = 0.0, 1.0
           sphi,cphi = sincos(phi)
           K = SFourMomentum(om,om*sth*cphi,om*sth*sphi,om*cth)

           eps= base_state(
                   Photon(),
                   Outgoing(),
                   K,
                   PolY()
               )

           return K*eps
       end
test_ortho (generic function with 1 method)

julia> @test isapprox(test_ortho(pi/2*0.9),0.0,atol=eps())
Test Passed

julia> @test isapprox(test_ortho(pi/2*1.01),0.0,atol=eps())
Test Failed at REPL[23]:1
  Expression: isapprox(test_ortho((pi / 2) * 1.01), 0.0, atol = eps())
   Evaluated: isapprox(-0.03141075907812746, 0.0; atol = 2.220446049250313e-16)

ERROR: There was an error during testing

It seems like, for $\phi\in [0,\pi/2]$ and $\phi\in [3/2\pi,2\pi]$ everything is alright, but for $\phi\in [\pi/2,3/2\pi]$ the y-pol state is not orthogonal to the respective four-momentum.

@szabo137 szabo137 added 01 - Bug Something isn't working as expected; needs a fix 02 - Critical Something breaks the code; needs a fix asap labels Dec 11, 2023
@szabo137 szabo137 added this to the Release-next milestone Dec 11, 2023
szabo137 pushed a commit to szabo137/QEDbase.jl that referenced this issue Dec 12, 2023
SimeonEhrig pushed a commit that referenced this issue Dec 14, 2023
This PR improves the coverage for coordinates tested in
`test/particle.jl` to the full domains for angles in spherical
coordinates for photons.

### Summary

- added safetestsets to modulize the unit tests
- added more cases for the angles in spherical coordinates
- added a fix for #49 


This resolves #49

---------

Co-authored-by: Uwe Hernandez Acosta <[email protected]>
szabo137 added a commit that referenced this issue Jan 28, 2024
This PR improves the coverage for coordinates tested in
`test/particle.jl` to the full domains for angles in spherical
coordinates for photons.

- added safetestsets to modulize the unit tests
- added more cases for the angles in spherical coordinates
- added a fix for #49

This resolves #49

---------

Co-authored-by: Uwe Hernandez Acosta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 - Bug Something isn't working as expected; needs a fix 02 - Critical Something breaks the code; needs a fix asap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant