Skip to content

Commit 140f31e

Browse files
authored
Add warning to ip_and_q if src_z!=rec_z (#238)
1 parent 70f1be1 commit 140f31e

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ v2.5.x
1010
""""""
1111

1212

13+
*latest*
14+
--------
15+
16+
- Modelling routines: Add warning to ``ip_and_q`` if ``src_z!=rec_z``; not
17+
thoroughly tested.
18+
19+
1320
v2.5.0 In-phase and quadrature
1421
------------------------------
1522

CREDITS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ certainly incomplete list (get in touch if you think you should appear here):
6767
- `María Carrizo Mascarell <https://github.com/mariacarrizo>`_
6868
- `Wouter Deleersnyder <https://github.com/WouterDls>`_
6969
- `Lukas Aigner <https://github.com/aignerlukas>`_
70+
- `Jan Thorbecke <https://github.com/JanThorbecke>`_

empymod/model.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,10 @@ def ip_and_q(**kwargs):
17861786
This function is only implemented for frequency-domain data of magnetic
17871787
sources and receivers.
17881788
1789+
Warning: Only the case where source and receiver are at the same height has
1790+
been tested; if you encounter any issues with other configurations, please
1791+
let us know!
1792+
17891793
17901794
Parameters
17911795
----------
@@ -1819,6 +1823,12 @@ def ip_and_q(**kwargs):
18191823
if kwargs.get('signal', None) is not None:
18201824
raise ValueError("Only implemented for frequency domain.")
18211825

1826+
# Warning that it has not been thoroughly tested.
1827+
verb = kwargs.get('verb', 2)
1828+
if verb > 0 and not np.allclose(kwargs['src'][2], kwargs['rec'][2]):
1829+
print("* WARNING :: `src_z != rec_z`: has not been tested; "
1830+
"please report back any issues you might encounter.")
1831+
18221832
# Get or set scale
18231833
scale = kwargs.pop('scale', 1e3)
18241834

tests/test_model.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ def test_dipole_k():
10731073
assert_allclose(w_res1, np.zeros(res['PJ1'].shape, dtype=np.complex128))
10741074

10751075

1076-
def test_ip_and_q():
1076+
def test_ip_and_q(capsys):
10771077
# Very simple tests; the function is only a wrapper, so we just test
10781078
# the functionality.
10791079

@@ -1120,6 +1120,11 @@ def test_ip_and_q():
11201120
assert_allclose(IP3, 0.0)
11211121
assert_allclose(Q3, 0.0)
11221122

1123+
_, _ = capsys.readouterr()
1124+
_, _ = model.ip_and_q(**model1, **{**system, 'src': [0, 0, 0]})
1125+
out, _ = capsys.readouterr()
1126+
assert 'has not been tested' in out
1127+
11231128

11241129
def test_fem():
11251130
# Just ensure functionality stays the same, with one example.

0 commit comments

Comments
 (0)