Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
pawbz committed Aug 22, 2019
1 parent c24954b commit 58b7c0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions docs/src/tut1.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ depending on `bfrac`. Their amplitudes are determined by `afrac`.
gobs=zeros(ntg,nr) # allocate
FBD.toy_direct_green!(gobs, c=4.0, bfrac=0.20, afrac=1.0); # add arrival 1
FBD.toy_reflec_green!(gobs, c=1.5, bfrac=0.35, afrac=-0.6); # add arrival 2
#plotg=(x;args...)->heatmap(x, size=(250,500), yflip=true, ylabel="time", xlabel="channel";args...) # define a plot recipe
#p1=plotg(gobs, title="True g")
plotg=(x,args...)->spy(x, Guide.xlabel("channel"), Guide.ylabel("time"),args...) # define a plot recipe
p1=plotg(gobs, Guide.title("True g"))
```

The source signature `s` for the experiment is arbitrary: we simply use a Gaussian random signal.

```@example tut1
sobs=randn(nts)
#plot(sobs, label="arbitrary source", size=(1000,200))
plot(x=1:10, y=randn(10))
plot(y=sobs,x=1:nts,Geom.line, Guide.title("arbitrary source"), Guide.xlabel("time"))
```

The next task is to generate synthetic observed records `dobs`:
Expand Down Expand Up @@ -66,7 +65,7 @@ FBD.lsbd!(pa)
We extract `g` from `pa` and plot to notice that it doesn't match `gobs`.

```@example tut1
#p2=plotg(pa[:g], title="LSBD g")
p2=plotg(pa[:g], Guide.title("LSBD g"))
```

Instead, we perform FBD that uses the focusing functionals to regularize `lsbd!`.
Expand All @@ -78,7 +77,6 @@ FBD.fbd!(pa)
Notice that the extract impulse responses are closer to `gobs`, except for a scaling factor and an overall translation in time.

```@example tut1
#p3=plotg(pa[:g], title="FBD g")
#plot(p1,p2,p3, size=(750,500), layout=(1,3))
p3=plotg(pa[:g], Guide.title("FBD g"))
```

12 changes: 5 additions & 7 deletions test/tut1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ nts=nt # samples in `s`
gobs=zeros(ntg,nr) # allocate
FBD.toy_direct_green!(gobs, c=4.0, bfrac=0.20, afrac=1.0); # add arrival 1
FBD.toy_reflec_green!(gobs, c=1.5, bfrac=0.35, afrac=-0.6); # add arrival 2
#plotg=(x;args...)->heatmap(x, size=(250,500), yflip=true, ylabel="time", xlabel="channel";args...) # define a plot recipe
#p1=plotg(gobs, title="True g")
plotg=(x,args...)->spy(x, Guide.xlabel("channel"), Guide.ylabel("time"),args...) # define a plot recipe
p1=plotg(gobs, Guide.title("True g"))

# The source signature `s` for the experiment is arbitrary: we simply use a Gaussian random signal.
sobs=randn(nts)
#plot(sobs, label="arbitrary source", size=(1000,200))
plot(x=1:10, y=randn(10))
plot(y=sobs,x=1:nts,Geom.line, Guide.title("arbitrary source"), Guide.xlabel("time"))

# The next task is to generate synthetic observed records `dobs`:
# first lets construct a linear operator `S`; then applying `S` on `g` will result in measurements `d`.
Expand All @@ -43,14 +42,13 @@ FBD.lsbd!(pa)
#+

# We extract `g` from `pa` and plot to notice that it doesn't match `gobs`.
#p2=plotg(pa[:g], title="LSBD g")
p2=plotg(pa[:g], Guide.title("LSBD g"))

# Instead, we perform FBD that uses the focusing functionals to regularize `lsbd!`.
FBD.fbd!(pa)
#+

# Notice that the extract impulse responses are closer to `gobs`, except for a scaling factor and an overall translation in time.
#p3=plotg(pa[:g], title="FBD g")
#plot(p1,p2,p3, size=(750,500), layout=(1,3))
p3=plotg(pa[:g], Guide.title("FBD g"))


0 comments on commit 58b7c0b

Please sign in to comment.