GithubHelp home page GithubHelp logo

slimgroup / timeprobeseismic.jl Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 2.0 2.12 MB

Memory efficient seismic inversion via trace estimation

License: MIT License

Julia 100.00%
seismic-inversion unbiased fwi devito judi

timeprobeseismic.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Probing judiJacobian only does single source

MFE is attached. adjoint(judiJacobian(F0,q,ps,dD))*dD seems only to do RTM probing on the first source (while F0,q include multiple sources). lsrtm_objective works well!

using Pkg
Pkg.activate("TimeProbeSeismic")
Pkg.add(url="https://github.com/slimgroup/JUDI.jl.git",rev="pyload")
Pkg.update()
Pkg.instantiate()
using DrWatson
@quickactivate :TimeProbeSeismic
using JLD2, FFTW, DSP

# Set up model structure
n = (1200, 200)   # (x,y,z) or (x,z)
d = (10., 10.)
o = (0., 0.)

# Velocity [km/s]
v = ones(Float32,n) .+ 0.5f0
v[:,30:end] .= 3.5f0

# Slowness squared [s^2/km^2]
m = (1f0 ./ v).^2
m0 = convert(Array{Float32,2},imfilter(m, Kernel.gaussian(3)))
dm = vec(m - m0)

# Setup info and model structure
nsrc = 2	# number of sources
model = Model(n, d, o, m)
model0 = Model(n, d, o, m0)

# Set up receiver geometry
nxrec = 480
xrec = range(3000f0, stop=9000f0, length=nxrec)
yrec = 0f0
zrec = range(50f0, stop=50f0, length=nxrec)

# receiver sampling and recording time
timeR = 1000f0   # receiver recording time [ms]
dtR = 2f0    # receiver sampling interval [ms]

# Set up receiver structure
recGeometry = Geometry(xrec, yrec, zrec; dt=dtR, t=timeR, nsrc=nsrc)

# Set up source geometry (cell array with source locations for each shot)
xsrc = convertToCell(range(5000f0, stop=7000f0, length=nsrc))
ysrc = convertToCell(range(0f0, stop=0f0, length=nsrc))
zsrc = convertToCell(range(200f0, stop=200f0, length=nsrc))

# source sampling and number of time steps
timeS = 1000f0  # ms
dtS = 2f0   # ms

# Set up source structure
srcGeometry = Geometry(xsrc, ysrc, zsrc; dt=dtS, t=timeS)

# setup wavelet
f0 = 0.015f0     # kHz
wavelet = ricker_wavelet(timeS, dtS, f0)
q = judiVector(srcGeometry, wavelet)

# Set up info structure for linear operators
ntComp = get_computational_nt(srcGeometry, recGeometry, model)
info = Info(prod(n), nsrc, ntComp)

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

# Write shots as segy files to disk
opt = Options(isic=true)

# Setup operators
Pr = judiProjection(info, recGeometry)
F0 = judiModeling(info, model0; options=opt)
Ps = judiProjection(info, srcGeometry)
F0 = Pr*F0*adjoint(Ps)
J = judiJacobian(F0, q)

# Linearized modeling
dD = J*dm
# Adjoint jacobian
println("conventional RTM")
@time rtm = adjoint(J)*dD
# probing RTM

println("32 probing vectors")
@time rtm_32 = adjoint(judiJacobian(F0,q,32,dD))*dD

figure();imshow(rtm.data',aspect=3,cmap="Greys",vmin=-0.1*norm(rtm.data,Inf),vmax=0.1*norm(rtm.data,Inf));title("conventional RTM")
figure();imshow(rtm_32.data',aspect=3,cmap="Greys",vmin=-0.1*norm(rtm.data,Inf),vmax=0.1*norm(rtm.data,Inf));title("RTM w/ 32 probing vectors")

f, g = JUDI.lsrtm_objective(model0, q, dD, 0f0 .* dm; nlind=false, options=opt)
f_32, g_32 = JUDI.lsrtm_objective(model0, q, dD, 0f0 .* dm, 32; nlind=false, options=opt)

figure();imshow(-g',aspect=3,cmap="Greys",vmin=-0.1*norm(rtm.data,Inf),vmax=0.1*norm(rtm.data,Inf));title("conventional RTM (by lsrtm_objective)")
figure();imshow(-g_32',aspect=3,cmap="Greys",vmin=-0.1*norm(rtm.data,Inf),vmax=0.1*norm(rtm.data,Inf));title("RTM w/ 32 probing vectors (by lsrtm_objective)")

MFErtmprob
MFErtm

Compilation issue

(base) francisyin@ipsec-172-16-85-30 scripts % julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.0 (2020-08-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> pwd()
"/Users/francisyin/.julia/dev/TimeProbeSeismic/scripts"

julia> using Pkg

julia> Pkg.activate("/Users/francisyin/.julia/dev/TimeProbeSeismic")
 Activating environment at `~/.julia/dev/TimeProbeSeismic/Project.toml`

julia> Pkg.instantiate()
   Updating registry at `~/.julia/registries/General`
   Updating registry at `~/.julia/registries/SLIMregistryJL`
   Updating git-repo `https://github.com/slimgroup/SLIMregistryJL.git`
    Cloning git-repo `https://GitHub.com/slimgroup/JUDI.jl.git`
ERROR: TypeError: in typeassert, expected VersionNumber, got a value of type Pkg.Types.VersionSpec
Stacktrace:
 [1] load_urls(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:503
 [2] #download_source#54 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:679 [inlined]
 [3] download_source at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:678 [inlined]
 [4] instantiate(::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Pkg.BinaryPlatforms.MacOS, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:868
 [5] instantiate(::Pkg.Types.Context) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:796
 [6] #instantiate#169 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:792 [inlined]
 [7] instantiate() at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:792
 [8] top-level scope at REPL[4]:1

Add seed as an optional input to the operators

Maybe for future reference, we can add seed as an input to lsrtm_objective, fwi_objective, judiJacobian, etc so that we have more control of randomization of probing vectors. Now seed is only in qr_data and not included by any operator.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.