Skip to content

Commit 93a78e4

Browse files
committed
Working again
1 parent 632e7d4 commit 93a78e4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/instrument/model.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ end
256256
# return nothing
257257
# end
258258

259-
@inline get_indices(bsitemaps, index, ::Val{1}) = map(x -> getindex(x.indices_1, index), bsitemaps)
260-
@inline get_indices(bsitemaps, index, ::Val{2}) = map(x -> getindex(x.indices_2, index), bsitemaps)
261-
@inline get_params(x::NamedTuple{N}, indices::NamedTuple{N}) where {N} = NamedTuple{N}(map(getindex, values(x), values(indices)))
259+
@inline get_indices(bsitemaps, index, ::Val{1}) = map(x -> rgetindex(x.indices_1, index), bsitemaps)
260+
@inline get_indices(bsitemaps, index, ::Val{2}) = map(x -> rgetindex(x.indices_2, index), bsitemaps)
261+
@inline get_params(x::NamedTuple{N}, indices::NamedTuple{N}) where {N} = NamedTuple{N}(map(rgetindex, values(x), values(indices)))
262262
# @inline get_params(x::NamedTuple{N}, indices::NamedTuple{N}) where {N} = NamedTuple{N}(ntuple(i->getindex(x[i], indices[i]), Val(length(N))))
263263

264264
# We need this because Enzyme seems to crash when generating code for this
@@ -268,13 +268,13 @@ EnzymeRules.inactive(::typeof(get_indices), args...) = nothing
268268

269269
@inline function apply_jones(v, index, J::ObservedInstrumentModel, x::NamedTuple{N}) where {N}
270270
# First lhs station
271-
indices1 = map(x -> getindex(x.indices_1, index), sitelookup(J)) #get_indices(sitelookup(J), index, Val(N))
272-
params1 = NamedTuple{N}(map(getindex, values(x), values(indices1)))
271+
indices1 = map(x -> rgetindex(x.indices_1, index), sitelookup(J)) #get_indices(sitelookup(J), index, Val(N))
272+
params1 = NamedTuple{N}(map(rgetindex, values(x), values(indices1)))
273273
j1 = jonesmatrix(instrument(J), params1, index, Val(1))
274274

275275
# Second RHS station
276-
indices2 = map(x -> getindex(x.indices_2, index), sitelookup(J)) #get_indices(sitelookup(J), index, Val(N))
277-
params2 = NamedTuple{N}(map(getindex, values(x), values(indices2)))
276+
indices2 = map(x -> rgetindex(x.indices_2, index), sitelookup(J)) #get_indices(sitelookup(J), index, Val(N))
277+
params2 = NamedTuple{N}(map(rgetindex, values(x), values(indices2)))
278278
j2 = jonesmatrix(instrument(J), params2, index, Val(2))
279279

280280
vout = _apply_jones(v, j1, j2, refbasis(J))

0 commit comments

Comments
 (0)