Skip to content

Commit

Permalink
remove some extraneous inbounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiede committed Aug 19, 2024
1 parent e50cfe9 commit b4f5ab1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/instrument/jonesmatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Base.@kwdef struct JonesR{M} <: AbstractJonesMatrix
matrices::M = nothing
add_fr::Bool = true
end
Base.@propagate_inbounds construct_jones(J::JonesR, x, index, ::Val{M}) where {M} = @inbounds J.matrices[M][index]
Base.@propagate_inbounds construct_jones(J::JonesR, x, index, ::Val{M}) where {M} = J.matrices[M][index]
param_map(::JonesR, x) = x

function preallocate_jones(J::JonesR, array::AbstractArrayConfiguration, ref)
Expand Down
2 changes: 1 addition & 1 deletion src/instrument/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ intout(vis::AbstractArray{<:StokesParams{T}}) where {T<:Complex} = similar(vis,
intout(vis::AbstractArray{T}) where {T<:Complex} = similar(vis, T)
intout(vis::AbstractArray{<:CoherencyMatrix{A,B,T}}) where {A,B,T<:Complex} = similar(vis, SMatrix{2,2, T, 4})

intout(vis::StructArray{<:StokesParams{T}}) where {T<:Complex} = StructArray{SMatrix{2,2, T, 4}}((vis.I, vis.Q, vis.U, vis.V))
# intout(vis::StructArray{<:StokesParams{T}}) where {T<:Complex} = StructArray{SMatrix{2,2, T, 4}}((vis.I, vis.Q, vis.U, vis.V))

@inline function apply_instrument(vis, J::ObservedInstrumentModel, x)
vout = intout(parent(vis))
Expand Down
2 changes: 1 addition & 1 deletion src/instrument/site_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ EnzymeRules.inactive(::(typeof(Base.size)), ::SiteArray) = nothing
Base.parent(a::SiteArray) = getfield(a, :data)
Base.size(a::SiteArray) = size(parent(a))
Base.IndexStyle(::Type{<:SiteArray{T, N, A}}) where {T, N, A} = Base.IndexStyle(A)
Base.@propagate_inbounds Base.getindex(a::SiteArray{T}, i::Integer) where {T} = @inbounds(getindex(parent(a), i))::T
Base.@propagate_inbounds Base.getindex(a::SiteArray{T}, i::Integer) where {T} = getindex(parent(a), i)
Base.@propagate_inbounds Base.getindex(a::SiteArray, I::Vararg{Integer, N}) where {N} = getindex(parent(a), I...)
Base.setindex!(m::SiteArray, v, i::Integer) = setindex!(parent(m), v, i)
Base.setindex!(m::SiteArray, v, i::Vararg{Integer, N}) where {N} = setindex!(parent(m), v, i...)
Expand Down
4 changes: 2 additions & 2 deletions src/mrf_image.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function apply_fluctuations(f, m::AbstractModel, g::AbstractRectiGrid, δ::Abstr
end

function apply_fluctuations(t::VLBIImagePriors.LogRatioTransform, m::AbstractModel, g::AbstractRectiGrid, δ::AbstractArray)
mimg = parent(intensitymap(m, g))
mimg = baseimage(intensitymap(m, g))
return apply_fluctuations(t, IntensityMap(mimg./sum(mimg), g), δ)
end

Expand All @@ -37,7 +37,7 @@ Enzyme.EnzymeRules.inactive(::typeof(_checknorm), args...) = nothing
function _apply_fluctuations(t::VLBIImagePriors.LogRatioTransform, mimg::AbstractArray, δ::AbstractArray)
@argcheck _checknorm(mimg) "Mean image must have unit flux when using log-ratio transformations in apply_fluctuations"
r = to_simplex(t, δ)
r .= r.*parent(mimg)
r .= r.*baseimage(mimg)
r .= r./sum(r)
return r
end

0 comments on commit b4f5ab1

Please sign in to comment.