Skip to content

Commit

Permalink
fix judi interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jun 27, 2024
1 parent 1bbd71b commit 804f326
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ImageGather"
uuid = "355d8124-6b2e-49b5-aab5-cdbc0a5fccbe"
authors = ["mloubout <[email protected]>"]
version = "0.2.9"
version = "0.2.10"

This comment has been minimized.

Copy link
@mloubout

mloubout Jun 27, 2024

Author Member

[deps]
JUDI = "f3b833dc-6b2e-5b9c-b940-873ed6319979"
Expand Down
15 changes: 9 additions & 6 deletions examples/offset_map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Date: June 2021
#

using JUDI, LinearAlgebra, Images, PyPlot, DSP, ImageGather
using JUDI, LinearAlgebra, Images, PyPlot, DSP, ImageGather, SlimPlotting

# Set up model structure
n = (601, 333) # (x,y,z) or (x,z)
Expand Down Expand Up @@ -54,7 +54,7 @@ wavelet = ricker_wavelet(timeS, dtS, f0)
q = judiVector(srcGeometry, wavelet)

###################################################################################################
opt = Options(space_order=16)
opt = Options(space_order=16, IC="as")
# Setup operators
F = judiModeling(model, srcGeometry, recGeometry; options=opt)
F0 = judiModeling(model0, srcGeometry, recGeometry; options=opt)
Expand All @@ -70,23 +70,26 @@ res = deepcopy(dD)
mute!(res.data[1], offs)
reso = deepcopy(res)

rtm = J'*res
I = inv(judiIllumination(J))

rtm = I*J'*res

omap = Array{Any}(undef, 2)
i = 1

# try a bunch of weighting functions
for (wf, iwf) = zip([x-> x./4000f0 .+ 1, x-> log.(x .+ 10)], [x -> 4000f0.*(x .- 1), x-> exp.(x) .- 10])
for (wf, iwf) = zip([x-> x .+ 5f3, x-> log.(x .+ 10)], [x -> x .- 5f3, x-> exp.(x) .- 10])
reso.data[1] .= res.data[1] .* wf(offs)'
rtmo = J'*reso
rtmo = I*J'*reso
omap[i] = iwf(offset_map(rtm.data, rtmo.data))
global i+=1
end

figure()
for (i, name)=enumerate(["shift", "log"])
subplot(1,2,i)
imshow(omap[i]', vmin=0, vmax=4000, cmap="gist_ncar", aspect="auto")
plot_velocity(omap[i]', (1,1); cmap="jet", aspect="auto", perc=98, new_fig=false, vmax=5000)
colorbar()
title(name)
end
tight_layout()
4 changes: 2 additions & 2 deletions src/subsurface_gather.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ JUDI.process_input_data(::judiExtendedJacobian{D, :born, FT}, q::Vector{D}) wher

############################################################

function propagate(J::judiExtendedJacobian{T, :born, O}, q::AbstractArray{T}) where {T, O}
function propagate(J::judiExtendedJacobian{T, :born, O}, q::AbstractArray{T}, illum::Bool) where {T, O}
srcGeometry, srcData, recGeometry, _, dm = make_input(J, q)
# Load full geometry for out-of-core geometry containers
recGeometry = Geometry(recGeometry)
Expand Down Expand Up @@ -74,7 +74,7 @@ function propagate(J::judiExtendedJacobian{T, :born, O}, q::AbstractArray{T}) wh
return judiVector{Float32, Matrix{Float32}}(1, recGeometry, [dD])
end

function propagate(J::judiExtendedJacobian{T, :adjoint_born, O}, q::AbstractArray{T}) where {T, O}
function propagate(J::judiExtendedJacobian{T, :adjoint_born, O}, q::AbstractArray{T}, illum::Bool) where {T, O}
srcGeometry, srcData, recGeometry, recData, _ = make_input(J, q)
# Load full geometry for out-of-core geometry containers
recGeometry = Geometry(recGeometry)
Expand Down
9 changes: 5 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ nh = length(offsets)
J = judiExtendedJacobian(F(model0), q, offsets)

ssodm = J'*dD
@test size(ssodm, 3) == nh
@show size(ssodm)
@test size(ssodm, 1) == nh

ssor = zeros(Float32, size(ssodm)...)
for h=1:size(ssor, 3)
ssor[:, :, h] .= dm.data
for h=1:size(ssor, 1)
ssor[h, :, :] .= dm.data
end

dDe = J*ssor
Expand All @@ -76,4 +77,4 @@ a, b = dot(dD, dDe), dot(ssodm[:], ssor[:])
@test (a-b)/(a+b) 0 atol=sqrt(eps(1f0)) rtol=0

# Make sure zero offset is the rtm, remove the sumpadding
@test norm(rtm.data - ssodm[:, :, div(nh, 2)+1])/norm(rtm) 0f0 atol=1f-5 rtol=0
@test norm(rtm.data - ssodm[div(nh, 2)+1, :, :])/norm(rtm) 0f0 atol=1f-5 rtol=0

1 comment on commit 804f326

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/109972

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.10 -m "<description of version>" 804f326c02e70b0ca619021f80652ee7b0472eda
git push origin v0.2.10

Please sign in to comment.