diff --git a/src/corona/models/extended.jl b/src/corona/models/extended.jl index 54fafa23..c8e99d0c 100644 --- a/src/corona/models/extended.jl +++ b/src/corona/models/extended.jl @@ -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, @@ -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 @@ -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)) diff --git a/src/corona/models/lamp-post.jl b/src/corona/models/lamp-post.jl index 95e88101..ef7a4bde 100644 --- a/src/corona/models/lamp-post.jl +++ b/src/corona/models/lamp-post.jl @@ -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 @@ -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) @@ -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 diff --git a/src/corona/profiles/voronoi.jl b/src/corona/profiles/voronoi.jl index 8670e13b..4f3d1dc7 100644 --- a/src/corona/profiles/voronoi.jl +++ b/src/corona/profiles/voronoi.jl @@ -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 @@ -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) diff --git a/src/plotting-recipes.jl b/src/plotting-recipes.jl index f89c5c38..f1e4f408 100644 --- a/src/plotting-recipes.jl +++ b/src/plotting-recipes.jl @@ -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) @@ -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 diff --git a/src/transfer-functions/integration.jl b/src/transfer-functions/integration.jl index 571f8863..b9de4dc6 100644 --- a/src/transfer-functions/integration.jl +++ b/src/transfer-functions/integration.jl @@ -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) @@ -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)) diff --git a/src/transfer-functions/utils.jl b/src/transfer-functions/utils.jl index ef68cf38..31a9e4ce 100644 --- a/src/transfer-functions/utils.jl +++ b/src/transfer-functions/utils.jl @@ -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] @@ -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, :]) diff --git a/test/unit/orthonormalization.jl b/test/unit/orthonormalization.jl index e02f4b66..9fe38838 100644 --- a/test/unit/orthonormalization.jl +++ b/test/unit/orthonormalization.jl @@ -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 @@ -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