Skip to content

Commit

Permalink
Fix #4 avoid OOB in born due to double offset
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jun 2, 2023
1 parent 24c4818 commit d0f4bf6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 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.5"
version = "0.2.6"

This comment has been minimized.

Copy link
@mloubout

mloubout Jun 2, 2023

Author Member

[deps]
JUDI = "f3b833dc-6b2e-5b9c-b940-873ed6319979"
Expand Down
2 changes: 1 addition & 1 deletion examples/layers_sscig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ wavelet = ricker_wavelet(timeD, dtD, f0)
q = diff(judiVector(srcGeometry, wavelet))

###################################################################################################
opt = Options(space_order=12, isic=false, sum_padding=true)
opt = Options(space_order=4, isic=false, sum_padding=true)
# Setup operators
F = judiModeling(model, srcGeometry, recGeometry; options=opt)
J0 = judiJacobian(F(model0), q)
Expand Down
11 changes: 7 additions & 4 deletions src/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ def cig_lin(model, src_coords, wavelet, rec_coords, dm_ext, offsets, ic="as", sp
op.cfunction

# Remove edge for offsets
dim_kw = make_kw(oh, DimensionTuple(*u.shape[1:], getters=model.grid.dimensions))
dim_kw = make_kw(oh, DimensionTuple(*u.shape[1:], getters=model.grid.dimensions),
born=True)
op(dt=model.critical_dt, rcvul=rcvl, **dim_kw)

# Output
return rcvl.data

Expand Down Expand Up @@ -149,9 +151,10 @@ def _shift(u, oh):
return uh


def make_kw(ohs, shape):
def make_kw(ohs, shape, born=False):
kw = dict()
scale = 2 if born else 1
for d, v in ohs.items():
kw['%s_m' % d.name] = -np.min(v.data.view(np.ndarray))
kw['%s_M' % d.name] = shape[d] - np.max(v.data.view(np.ndarray))
kw['%s_m' % d.name] = -scale*np.min(v.data.view(np.ndarray))
kw['%s_M' % d.name] = shape[d] - scale*np.max(v.data.view(np.ndarray))
return kw

1 comment on commit d0f4bf6

@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/84721

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.6 -m "<description of version>" d0f4bf6dabead7c698cba9a1aa64d676b4c76658
git push origin v0.2.6

Please sign in to comment.