Skip to content

Commit

Permalink
revert some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiede committed Aug 19, 2024
1 parent 4cb7e44 commit f0b45ad
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/instrument/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,8 @@ intout(vis::StructArray{<:StokesParams{T}}) where {T<:Complex} = StructArray{SMa

@inline function apply_instrument(vis, J::ObservedInstrumentModel, x)
vout = intout(parent(vis))
pvis = parent(vis)
xint = x.instrument
# for i in eachindex(vout, pvis)
# vout[i] = apply_jones(pvis[i], i, J, xint)
vout .= apply_jones.(pvis, eachindex(pvis), Ref(J), Ref(xint))
# end
vout .= apply_jones.(vis, eachindex(vis), Ref(J), Ref(xint))
# vout = intout(parent(vis))
return vout
end
Expand Down Expand Up @@ -257,14 +253,6 @@ end
# return nothing
# end

@inline function apply_jones(v, index::Int, J::ObservedInstrumentModel, x)
j1 = build_jones(index, J, x, Val(1))
j2 = build_jones(index, J, x, Val(2))
vout = _apply_jones(v, j1, j2, refbasis(J))
return vout
end


@inline get_indices(bsitemaps, index, ::Val{1}) = map(x->getindex(x.indices_1, index), bsitemaps)
@inline get_indices(bsitemaps, index, ::Val{2}) = map(x->getindex(x.indices_2, index), bsitemaps)
@inline get_params(x::NamedTuple{N}, indices::NamedTuple{N}) where {N} = NamedTuple{N}(map(getindex, values(x), values(indices)))
Expand All @@ -281,6 +269,12 @@ Enzyme.EnzymeRules.inactive(::typeof(get_indices), args...) = nothing
end


@inline function apply_jones(v, index::Int, J::ObservedInstrumentModel, x)
j1 = build_jones(index, J, x, Val(1))
j2 = build_jones(index, J, x, Val(2))
vout = _apply_jones(v, j1, j2, refbasis(J))
return vout
end


@inline _apply_jones(v::Number, j1, j2, ::B) where {B} = j1*v*conj(j2)
Expand Down

0 comments on commit f0b45ad

Please sign in to comment.