Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion empymod/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,
- ``atol``: absolute tolerance (default: 1e-30)
- ``nquad``: order of Gaussian quadrature (default: 51)
- ``maxint``: maximum number of partial integral intervals
(default: 40)
(default: 100)
- ``pts_per_dec``: points per decade; (default: 0)

- If 0, no interpolation is used.
Expand Down
2 changes: 1 addition & 1 deletion empymod/scripts/fdesign.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def _call_qc_transform_pairs(n, ispacing, ishift, fI, fC, r, r_def, reim):

# Plot QC
fig, axs = plt.subplots(figsize=(9.5, 6), nrows=2, ncols=2,
num="Transform pairs")
num="Transform pairs", clear=True)
axs = axs.ravel()
plt.subplots_adjust(wspace=.3, hspace=.4)

Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ per-file-ignores = [

[tool.coverage.run]
relative_files = true

[tool.pytest.ini_options]
minversion = "6.0"
filterwarnings = [
"ignore:Unknown pytest.mark.mpl_image_compare",
]
Binary file modified tests/baseline/test_call_qc_transform_pairs1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_call_qc_transform_pairs2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_call_qc_transform_pairs3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_plot_inversion1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_plot_inversion2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_plot_result1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_plot_result2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_plot_result3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions tests/test_fdesign.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_save_load_filter(tmpdir):
@pytest.mark.skipif(not plt, reason="Matplotlib not installed.")
class TestFiguresMatplotlib:

@pytest.mark.mpl_image_compare(remove_text=True, tolerance=18) # IMPROVE!
@pytest.mark.mpl_image_compare(remove_text=True)
def test_plot_result1(self):
switch_off_matplotlib_agg_warning()
# Quick run `design` with all verb/plot on, just to check that no
Expand All @@ -148,6 +148,7 @@ def test_plot_result1(self):

# plot_result for min amplitude
dat1 = DATA['case1'][()]
plt.close('all')
fdesign.plot_result(dat1[1], dat1[2], prntres=True)
return plt.gcf()

Expand All @@ -156,6 +157,7 @@ def test_plot_result2(self):
switch_off_matplotlib_agg_warning()
# plot_result one shift several spacings
dat5 = DATA['case5'][()]
plt.close('all')
fdesign.plot_result(dat5[1], dat5[2])
return plt.gcf()

Expand All @@ -164,10 +166,11 @@ def test_plot_result3(self):
switch_off_matplotlib_agg_warning()
# plot_result several shifts one spacing for max r
dat6 = DATA['case6'][()]
plt.close('all')
fdesign.plot_result(dat6[1], dat6[2])
return plt.gcf()

@pytest.mark.mpl_image_compare(remove_text=True, tolerance=8)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=6)
def test_call_qc_transform_pairs1(self):
switch_off_matplotlib_agg_warning()
# plot_transform_pair "normal" case
Expand All @@ -176,6 +179,7 @@ def test_call_qc_transform_pairs1(self):
fC = (fdesign.j0_3(5), fdesign.j1_3(5))
fC[0].rhs = fC[0].rhs(r)
fC[1].rhs = fC[1].rhs(r)
plt.close('all')
fdesign._call_qc_transform_pairs(101, (0.06, 0.07, 0.01), (-1, 1, 0.3),
fI, fC, r, (0, 0, 2), np.real)
return plt.gcf()
Expand All @@ -188,11 +192,12 @@ def test_call_qc_transform_pairs2(self):
fI = (fdesign.j0_1(5), fdesign.j1_1(5))
fC = fdesign.empy_hankel('j2', 950, 1000, 1, 1)
fC.rhs = fC.rhs(r)
plt.close('all')
fdesign._call_qc_transform_pairs(101, (0.06, 0.07, 0.01), (-1, 1, 0.3),
fI, [fC, ], r, (0, 0, 2), np.imag)
return plt.gcf()

@pytest.mark.mpl_image_compare(remove_text=True, tolerance=6)
@pytest.mark.mpl_image_compare(remove_text=True)
def test_call_qc_transform_pairs3(self):
switch_off_matplotlib_agg_warning()
# plot_transform_pair Sine/Cosine
Expand All @@ -201,6 +206,7 @@ def test_call_qc_transform_pairs3(self):
fC = (fdesign.sin_2(), fdesign.cos_2())
fC[0].rhs = fC[0].rhs(r)
fC[1].rhs = fC[1].rhs(r)
plt.close('all')
fdesign._call_qc_transform_pairs(101, (0.06, 0.07, 0.01), (-1, 1, 0.3),
fI, fC, r, (0, 0, 2), np.imag)
return plt.gcf()
Expand All @@ -223,6 +229,7 @@ def test_plot_inversion1(self):
rhs = np.dot(f.lhs(k), filt.j0)/r
rel_error = np.abs((rhs - f.rhs)/f.rhs)
imin = np.where(rel_error > 0.01)[0][0]
plt.close('all')
fdesign._plot_inversion(f, rhs, r, k, imin, spacing, shift, cvar)
return plt.gcf()

Expand All @@ -247,6 +254,7 @@ def test_plot_inversion2(self):
rhs = rhs0 + rhs1
rel_error = np.abs((rhs - f.rhs)/f.rhs)
imin = np.where(rel_error > 0.01)[0][0]
plt.close('all')
fdesign._plot_inversion(f, rhs, r, k, imin, spacing, shift, cvar)
return plt.gcf()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_hankel(htype): # 1. DLF / 2. QWE / 3. QUAD
assert_allclose(np.squeeze(wvnr0), np.squeeze(freq0))

# # # 1. Spline; One angle # # #
_, htarg = utils.check_hankel(htype, {'pts_per_dec': 80}, 0)
_, htarg = utils.check_hankel(htype, {'pts_per_dec': 100}, 0)
if htype == 'quad': # Lower atol to ensure convergence
_, htarg = utils.check_hankel('quad', {'rtol': 1e-8}, 0)
elif htype == 'dlf': # Adjust htarg for dlf
Expand Down
Loading