-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
640 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
```@meta | ||
EditURL = "<unknown>/fwi/born_tutorial.jl" | ||
``` | ||
|
||
```@example born_tutorial | ||
using Test | ||
using GeoPhyInv | ||
using LinearMaps | ||
using Misfits | ||
using LinearAlgebra | ||
``` | ||
|
||
### SeisInvExpt | ||
|
||
```@example born_tutorial | ||
pa=SeisInvExpt(FdtdBorn(), LS(), :pizza, rfields=[:P, :Vz]); # use linearized modeling attribute | ||
F=LinearMap(pa); # generate LinearMap | ||
nothing #hide | ||
``` | ||
|
||
### Linearity test | ||
|
||
```@example born_tutorial | ||
x1=randn(size(F,2)); # random input 1 | ||
x2=randn(size(F,2)); # random input 2 | ||
x12=x1.+x2; # sum | ||
nothing #hide | ||
``` | ||
|
||
```@example born_tutorial | ||
d12=F*x12; | ||
d1=F*x1; # | ||
d2=F*x2; | ||
d12new=d1.+d2; | ||
nothing #hide | ||
``` | ||
|
||
```@example born_tutorial | ||
@test Misfits.error_squared_euclidean!(nothing, d12, d12new, nothing, norm_flag=true)<1e-25 | ||
``` | ||
|
||
### Adjoint test | ||
|
||
```@example born_tutorial | ||
x=randn(size(F,2)); # random x | ||
y=randn(size(F,1)); # random y | ||
a=LinearAlgebra.dot(y,F*x); | ||
b=LinearAlgebra.dot(x,adjoint(F)*y); | ||
c=LinearAlgebra.dot(x, transpose(F)*F*x); | ||
nothing #hide | ||
``` | ||
|
||
```@example born_tutorial | ||
println("adjoint test: ", a, "\t", b) | ||
@test isapprox(a,b,rtol=1e-5) | ||
``` | ||
|
||
```@example born_tutorial | ||
println("x*transpose(F)*F*x be positive: ", c) | ||
@test c>0.0 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
```@meta | ||
EditURL = "<unknown>/fwi/doc.jl" | ||
``` | ||
|
||
```@example doc | ||
using BenchmarkTools | ||
using GeoPhyInv | ||
using Test | ||
``` | ||
|
||
# Intro | ||
|
||
```@docs | ||
SeisInvExpt | ||
Base.getindex(::GeoPhyInv.PFdtd, ::Symbol) | ||
``` | ||
|
||
# Methods | ||
```@docs | ||
update!(::GeoPhyInv.PFWI) | ||
LinearMaps.LinearMap(::GeoPhyInv.PFWI) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
```@meta | ||
EditURL = "<unknown>/fwi/pizza.jl" | ||
``` | ||
|
||
```@example pizza | ||
using GeoPhyInv | ||
using Plots; gr(); | ||
nothing #hide | ||
``` | ||
|
||
### Medium | ||
|
||
```@example pizza | ||
medium_true=Medium(:pizza) | ||
``` | ||
|
||
### SeisInvExpt | ||
|
||
```@example pizza | ||
pa=SeisInvExpt(Fdtd(), LS(), :pizza); | ||
nothing #hide | ||
``` | ||
|
||
### Initial plotting | ||
|
||
```@example pizza | ||
p1=heatmap(pa.mediumm, :vp, title="Initial vp") | ||
scatter!(pa.ageom, SSrcs()) | ||
scatter!(pa.ageom, Recs()) | ||
p2=heatmap(medium_true, :vp, title="True vp") | ||
scatter!(pa.ageom, SSrcs()) | ||
scatter!(pa.ageom, Recs()) | ||
plot(p2, p1, size=(700,300)) | ||
``` | ||
|
||
### Final plotting | ||
|
||
```@example pizza | ||
update!(pa,solver=:ipopt); | ||
nothing #hide | ||
``` | ||
|
||
### Plotting #1 | ||
|
||
```@example pizza | ||
p1=heatmap(pa.mediumm, :vp, title="Inverted vp") | ||
scatter!(pa.ageom, SSrcs()) | ||
scatter!(pa.ageom, Recs()) | ||
p2=heatmap(medium_true, :vp, title="True vp") | ||
scatter!(pa.ageom, SSrcs()) | ||
scatter!(pa.ageom, Recs()) | ||
plot(p2, p1, size=(700,300)) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.