Skip to content

Commit

Permalink
style: apply julia formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
fjebaker committed Nov 2, 2024
1 parent 4ce0fc6 commit 8ff1a69
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/corona/models/extended.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ function _calculate_ring_arms(
m,
d,
v,
gps[1:min_ρ_index-1],
ρs[1:min_ρ_index-1],
δs_filtered[1:min_ρ_index-1],
gps[1:(min_ρ_index-1)],
ρs[1:(min_ρ_index-1)],
δs_filtered[1:(min_ρ_index-1)],
)
right = @views _process_ring_traces(
setup,
Expand Down Expand Up @@ -175,7 +175,7 @@ function _process_ring_traces(setup::EmissivityProfileSetup, m, d, v, gps, rs,
points = gps[J]
δs_sorted = δs[J]
r, ε = _point_source_emissivity(m, d, setup.spectrum, v, rs[J], δs_sorted, points)
t = [i.x[1] for i in @views(points[1:end-1])]
t = [i.x[1] for i in @views(points[1:(end-1)])]
(; t, r, ε = abs.(ε))
end

Expand All @@ -189,7 +189,7 @@ function _integrate_transfer_problem!(
t_grid;
g_scale = 1,
) where {T,Profile<:Union{<:RingCoronaProfile,DiscCoronaProfile}}
g_grid_view = @views g_grid[1:end-1]
g_grid_view = @views g_grid[1:(end-1)]

r_itterator = collect(Grids._geometric_grid(r_limits..., setup.n_radii))
r2 = first(iterate(r_itterator, 2))
Expand Down
6 changes: 3 additions & 3 deletions src/corona/models/lamp-post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function _point_source_symmetric_emissivity_profile(
δs = δs[J]

r, ε = _point_source_emissivity(m, d, setup.spectrum, v, rs_sorted, δs, points)
t = [i.x[1] for i in @views(points[1:end-1])]
t = [i.x[1] for i in @views(points[1:(end-1)])]

RadialDiscProfile(r, t, ε)
end
Expand All @@ -124,7 +124,7 @@ function _point_source_emissivity(
_disc_velocity = _keplerian_velocity_projector(m, d)

# radial bin size
_points = @views(points[1:end-1])
_points = @views(points[1:(end-1)])

ε = map(enumerate(_points)) do (i, p)
v_disc = _disc_velocity(p.x)
Expand All @@ -136,7 +136,7 @@ function _point_source_emissivity(
point_source_equatorial_disc_emissivity(spec, δs[i], gs, A, γ)
end

r = r[1:end-1]
r = r[1:(end-1)]
r, ε
end

Expand Down
6 changes: 3 additions & 3 deletions src/corona/profiles/voronoi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function _cut_polygon(radius, poly; inner = true)
clines = getcycliclines(poly)
(i1, t1) = _circ_path_intersect(radius, clines)
if t1 > 0
(i2, t2) = _circ_path_intersect(radius, @view(clines[i1+1:end]))
(i2, t2) = _circ_path_intersect(radius, @view(clines[(i1+1):end]))
if inner
_circ_cut(radius, clines, i1, t1, i2 + i1, t2; outer = false)
else
Expand All @@ -187,12 +187,12 @@ function _circ_cut(radius, clines, i1, t1, i2, t2; outer = true)
points = first.(@view(clines[1:i1]))
push!(points, A)
push!(points, B)
points = vcat(points, first.(@view(clines[i2+1:end])))
points = vcat(points, first.(@view(clines[(i2+1):end])))

return GeometryBasics.Polygon(points)
else
# outside circle
points = first.(@view(clines[i1+1:i2]))
points = first.(@view(clines[(i1+1):i2]))
push!(points, B)
push!(points, A)

Expand Down
6 changes: 3 additions & 3 deletions src/plotting-recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ end
xscale --> :log10
yscale --> :log10

y = p.ε[2:end-1]
y = p.ε[2:(end-1)]

if !isnothing(normalize)
y = normalize(y)
end
p.radii[2:end-1], y
p.radii[2:(end-1)], y
end

@recipe function f(ctf::CunninghamTransferData; h = 1e-4)
Expand Down Expand Up @@ -184,5 +184,5 @@ end
y = y[2:end]
em_index = @. dydx * x / y

x[1:end-1], -em_index[1:end-1]
x[1:(end-1)], -em_index[1:(end-1)]
end
7 changes: 3 additions & 4 deletions src/transfer-functions/integration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,16 @@ function _integrate_transfer_problem!(
g_grid;
g_scale = 1,
) where {T}
g_grid_view = @views g_grid[1:end-1]
g_grid_view = @views g_grid[1:(end-1)]

r_itterator = Grids._inverse_grid(r_limits..., setup.n_radii)
r2 = first(iterate(r_itterator, 2))
# prime the first r_prev so that the bin width is r2 - r1
r_prev = r_limits[1] - (r2 - r_limits[1])

@inbounds for rₑ in r_itterator
for rₑ in r_itterator
branch = transfer_function_radial_interpolation(rₑ)
S = _both_branches(setup, branch)

Δrₑ = rₑ - r_prev
# integration weight for this annulus
θ = Δrₑ * rₑ * radial_component(setup, rₑ) * π / (branch.gmax - branch.gmin)
Expand Down Expand Up @@ -347,7 +346,7 @@ function _integrate_transfer_problem!(
t_grid;
g_scale = 1,
) where {T}
g_grid_view = @views g_grid[1:end-1]
g_grid_view = @views g_grid[1:(end-1)]

r_itterator = Grids._geometric_grid(r_limits..., setup.n_radii)
r2 = first(iterate(r_itterator, 2))
Expand Down
4 changes: 2 additions & 2 deletions src/transfer-functions/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ end

function _normalize!(flux::AbstractVector{T}, grid) where {T}
Σflux = zero(T)
@inbounds for i = 1:length(grid)-1
@inbounds for i = 1:(length(grid)-1)
= (grid[i+1] + grid[i])
flux[i] = flux[i] /
Σflux += flux[i]
Expand All @@ -140,7 +140,7 @@ end

function _normalize!(flux::AbstractMatrix{T}, grid) where {T}
Σflux = zero(T)
@views @inbounds for i = 1:length(grid)-1
@views @inbounds for i = 1:(length(grid)-1)
= (grid[i+1] + grid[i])
@. flux[i, :] = flux[i, :] /
Σflux += sum(flux[i, :])
Expand Down
4 changes: 2 additions & 2 deletions test/unit/orthonormalization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function numerical_lnrframe(m, u)
reduce(hcat, vecs)
end

for M = 0.2:0.8:2.0, a = -M:0.5:M
for M = 0.2:0.8:2.0, a = (-M):0.5:M
m = KerrMetric(M, a)
r = Gradus.inner_radius(m) + 4.2
for θ in angles
Expand Down Expand Up @@ -101,7 +101,7 @@ function numerical_lnrbasis(m, u)
reduce(hcat, vecs)
end

for M = 0.2:0.8:2.0, a = -M:0.5:M
for M = 0.2:0.8:2.0, a = (-M):0.5:M
m = KerrMetric(M, a)
r = Gradus.inner_radius(m) + 0.3
for θ in angles
Expand Down

0 comments on commit 8ff1a69

Please sign in to comment.