Skip to content

Commit

Permalink
Add fast light emission coordinates function and corresponding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dominic-chang committed Jan 24, 2025
1 parent 8d26e58 commit 175b28e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/metrics/Kerr/emission_coordinates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,52 @@ function emission_coordinates_fast_light(pix::AbstractPixel, θs::T, isindir, n)
return rs, ϕs, νr, νθ, issuccess
end

"""
Ray trace a point that appears at the screen coordinate (`α`, `β`) for an observer located at inclination θo
# Arguments
- `pix` : Pixel information
- `τ` : Mino Time
"""
function emission_coordinates_fast_light(pix::AbstractPixel, τ::T) where {T}
α, β = screen_coordinate(pix)
met = metric(pix)
θo = inclination(pix)

θs, τs, _, _, n, isindir = emission_inclination(pix, τ)
νθ = τs > 0

if cos(θs) > abs(cos(θo))
αmin = αboundary(met, θs)
βbound = (abs(α) >= (αmin + eps(T)) ? βboundary(met, α, θo, θs) : zero(T))

if (abs(β) + eps(T)) < βbound
return zero(T), zero(T), zero(T), true, true, false
end
end

a = met.spin

λtemp = λ(met, α, θo)
rs, νr, _, issuccess = emission_radius(pix, τ)
issuccess || return zero(T), zero(T), zero(T), true, true, false
_, _, _, Ip, Im = radial_integrals(pix, rs, τ, νr)

rp = one(T) + (one(T) - a^2)
rm = one(T) - (one(T) - a^2)

= 2a / (rp - rm) * ((rp - a * λtemp / 2) * Ip - (rm - a * λtemp / 2) * Im)

Gϕtemp, _, _, _, _ = (pix, θs, isindir, n)

emission_azimuth = -(Iϕ + λtemp * Gϕtemp + T/2))

νθ = abs(cos(θs)) < abs(cos(θo)) ? (n % 2 == 1) (θo > θs) : !isindir (θs > T/ 2))
return rs, θs, emission_azimuth, νr, νθ, issuccess
end


"""
Emission radius and azimuthal angle for point originating at inclination θs whose nth order image appears at the screen
coordinate (`α`, `β`) for an observer located at inclination θo.
Expand Down
7 changes: 7 additions & 0 deletions test/emission_coordinates_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
ts, testrs, ϕs, νr, νθ = Krang.emission_coordinates(pix, θs, isindir, 0)
testrs2, ϕs2, νr2, νθ2 = Krang.emission_coordinates_fast_light(pix, θs, isindir, 0)
ts3, testrs3, testθs, ϕs3, νr3, νθ3 = Krang.emission_coordinates(pix, τ)
testrs4, θs4, ϕs4, νr4, νθ4 = Krang.emission_coordinates_fast_light(pix, τ)

testτ = Krang.Ir(pix, isindir, testrs)[1]
@testset "Consistency between raytracing methods" begin
Expand All @@ -148,6 +149,12 @@
@test ϕs/ϕs3 1.0 atol = 1e-5
@test νr == νr3
@test νθ == νθ3
@test testrs/testrs4 1.0 atol = 1e-5
@test θs4/θs 1.0 atol = 1e-5
@test ϕs4/ϕs 1.0 atol = 1e-5
@test νr == νr4
@test νθ == νθ4


@test testθs/θs 1.0 atol = 1e-5
@test testτ/τ 1.0 atol = 1e-5
Expand Down

0 comments on commit 175b28e

Please sign in to comment.