Skip to content

Commit

Permalink
Fix remaining inner1d errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Sep 16, 2024
1 parent 559249e commit 21f25ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 6 additions & 7 deletions sfs/fd/wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def plot(d, selection, secondary_source):
"""
import numpy as _np
from numpy.core.umath_tests import inner1d as _inner1d
from scipy.special import hankel2 as _hankel2

from . import secondary_source_line as _secondary_source_line
Expand Down Expand Up @@ -91,7 +90,7 @@ def line_2d(omega, x0, n0, xs, *, c=None):
k = _util.wavenumber(omega, c)
ds = x0 - xs
r = _np.linalg.norm(ds, axis=1)
d = -1j/2 * k * _inner1d(ds, n0) / r * _hankel2(1, k * r)
d = -1j/2 * k * _util._inner1d(ds, n0) / r * _hankel2(1, k * r)
selection = _util.source_selection_line(n0, x0, xs)
return d, selection, _secondary_source_line(omega, c)

Expand Down Expand Up @@ -147,7 +146,7 @@ def _point(omega, x0, n0, xs, *, c=None):
k = _util.wavenumber(omega, c)
ds = x0 - xs
r = _np.linalg.norm(ds, axis=1)
d = 1j * k * _inner1d(ds, n0) / r ** (3 / 2) * _np.exp(-1j * k * r)
d = 1j * k * _util._inner1d(ds, n0) / r ** (3 / 2) * _np.exp(-1j * k * r)
selection = _util.source_selection_point(n0, x0, xs)
return d, selection, _secondary_source_point(omega, c)

Expand Down Expand Up @@ -234,7 +233,7 @@ def point_25d(omega, x0, n0, xs, xref=[0, 0, 0], c=None, omalias=None):
preeq_25d(omega, omalias, c) *
_np.sqrt(8 * _np.pi) *
_np.sqrt((r * s) / (r + s)) *
_inner1d(n0, ds) / s *
_util._inner1d(n0, ds) / s *
_np.exp(-1j * k * s) / (4 * _np.pi * s))
selection = _util.source_selection_point(n0, x0, xs)
return d, selection, _secondary_source_point(omega, c)
Expand Down Expand Up @@ -316,7 +315,7 @@ def point_25d_legacy(omega, x0, n0, xs, xref=[0, 0, 0], c=None, omalias=None):
r = _np.linalg.norm(ds, axis=1)
d = (
preeq_25d(omega, omalias, c) *
_np.sqrt(_np.linalg.norm(xref - x0)) * _inner1d(ds, n0) /
_np.sqrt(_np.linalg.norm(xref - x0)) * _util._inner1d(ds, n0) /
r ** (3 / 2) * _np.exp(-1j * k * r))
selection = _util.source_selection_point(n0, x0, xs)
return d, selection, _secondary_source_point(omega, c)
Expand Down Expand Up @@ -499,7 +498,7 @@ def _focused(omega, x0, n0, xs, ns, *, c=None):
k = _util.wavenumber(omega, c)
ds = x0 - xs
r = _np.linalg.norm(ds, axis=1)
d = 1j * k * _inner1d(ds, n0) / r ** (3 / 2) * _np.exp(1j * k * r)
d = 1j * k * _util._inner1d(ds, n0) / r ** (3 / 2) * _np.exp(1j * k * r)
selection = _util.source_selection_focused(ns, x0, xs)
return d, selection, _secondary_source_point(omega, c)

Expand Down Expand Up @@ -569,7 +568,7 @@ def focused_25d(omega, x0, n0, xs, ns, *, xref=[0, 0, 0], c=None,
r = _np.linalg.norm(ds, axis=1)
d = (
preeq_25d(omega, omalias, c) *
_np.sqrt(_np.linalg.norm(xref - x0)) * _inner1d(ds, n0) /
_np.sqrt(_np.linalg.norm(xref - x0)) * _util._inner1d(ds, n0) /
r ** (3 / 2) * _np.exp(1j * k * r))
selection = _util.source_selection_focused(ns, x0, xs)
return d, selection, _secondary_source_point(omega, c)
Expand Down
11 changes: 5 additions & 6 deletions sfs/td/wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def plot(d, selection, secondary_source, t=0):
"""
import numpy as _np
from numpy.core.umath_tests import inner1d as _inner1d

from . import apply_delays as _apply_delays
from . import secondary_source_point as _secondary_source_point
Expand Down Expand Up @@ -119,8 +118,8 @@ def plane_25d(x0, n0, n=[0, 1, 0], xref=[0, 0, 0], c=None):
n = _util.normalize_vector(n)
xref = _util.asarray_1d(xref)
g0 = _np.sqrt(2 * _np.pi * _np.linalg.norm(xref - x0, axis=1))
delays = _inner1d(n, x0) / c
weights = 2 * g0 * _inner1d(n, n0)
delays = _util._inner1d(n, x0) / c
weights = 2 * g0 * _util._inner1d(n, n0)
selection = _util.source_selection_plane(n0, n)
return delays, weights, selection, _secondary_source_point(c)

Expand Down Expand Up @@ -208,7 +207,7 @@ def point_25d(x0, n0, xs, xref=[0, 0, 0], c=None):
g0 *= _np.sqrt((x0xs_n*x0xref_n)/(x0xs_n+x0xref_n))

delays = x0xs_n/c
weights = g0*_inner1d(x0xs, n0)
weights = g0 * _util._inner1d(x0xs, n0)
selection = _util.source_selection_point(n0, x0, xs)
return delays, weights, selection, _secondary_source_point(c)

Expand Down Expand Up @@ -296,7 +295,7 @@ def point_25d_legacy(x0, n0, xs, xref=[0, 0, 0], c=None):
ds = x0 - xs
r = _np.linalg.norm(ds, axis=1)
delays = r/c
weights = g0 * _inner1d(ds, n0) / (2 * _np.pi * r**(3/2))
weights = g0 * _util._inner1d(ds, n0) / (2 * _np.pi * r**(3/2))
selection = _util.source_selection_point(n0, x0, xs)
return delays, weights, selection, _secondary_source_point(c)

Expand Down Expand Up @@ -379,7 +378,7 @@ def focused_25d(x0, n0, xs, ns, xref=[0, 0, 0], c=None):
g0 = _np.sqrt(_np.linalg.norm(xref - x0, axis=1)
/ (_np.linalg.norm(xref - x0, axis=1) + r))
delays = -r/c
weights = g0 * _inner1d(ds, n0) / (2 * _np.pi * r**(3/2))
weights = g0 * _util._inner1d(ds, n0) / (2 * _np.pi * r**(3/2))
selection = _util.source_selection_focused(ns, x0, xs)
return delays, weights, selection, _secondary_source_point(c)

Expand Down

0 comments on commit 21f25ac

Please sign in to comment.