Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 125d235

Browse files
committed
Do not divide RMS by 10000 when testing against tolerance.
This was arbitrary and made no sense. Increased all tolerances by a factor of 10000. Note that some are ridiculously large (e.g., 200 out of 255).
1 parent 82ecfcf commit 125d235

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def compare_images( expected, actual, tol, in_decorator=False ):
314314

315315
diff_image = make_test_filename(actual, 'failed-diff')
316316

317-
if ( (rms / 10000.0) <= tol ):
317+
if rms <= tol:
318318
if os.path.exists(diff_image):
319319
os.unlink(diff_image)
320320
return None
@@ -347,7 +347,7 @@ def compare_images( expected, actual, tol, in_decorator=False ):
347347
else:
348348
# old-style call from mplTest directory
349349
msg = " Error: Image files did not match.\n" \
350-
" RMS Value: " + str( rms / 10000.0 ) + "\n" \
350+
" RMS Value: " + str( rms ) + "\n" \
351351
" Expected:\n " + str( expected ) + "\n" \
352352
" Actual:\n " + str( actual ) + "\n" \
353353
" Difference:\n " + str( diff_image ) + "\n" \

lib/matplotlib/testing/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def do_test():
165165

166166
yield (do_test,)
167167

168-
def image_comparison(baseline_images=None, extensions=None, tol=1e-3,
168+
def image_comparison(baseline_images=None, extensions=None, tol=10,
169169
freetype_version=None, remove_text=False,
170170
savefig_kwarg=None):
171171
"""

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def test_imshow():
501501

502502
ax.imshow(r)
503503

504-
@image_comparison(baseline_images=['imshow_clip'], tol=1e-2)
504+
@image_comparison(baseline_images=['imshow_clip'], tol=100)
505505
def test_imshow_clip():
506506
# As originally reported by Gellule Xg <[email protected]>
507507

@@ -543,7 +543,7 @@ def test_polycollection_joinstyle():
543543
ax.set_ybound(0, 3)
544544

545545
@image_comparison(baseline_images=['fill_between_interpolate'],
546-
tol=1e-2, remove_text=True)
546+
tol=100, remove_text=True)
547547
def test_fill_between_interpolate():
548548
x = np.arange(0.0, 2, 0.02)
549549
y1 = np.sin(2*np.pi*x)
@@ -612,7 +612,7 @@ def test_symlog2():
612612
ax.grid(True)
613613
ax.set_ylim(-0.1, 0.1)
614614

615-
@image_comparison(baseline_images=['pcolormesh'], tol=0.02,
615+
@image_comparison(baseline_images=['pcolormesh'], tol=200,
616616
remove_text=True)
617617
def test_pcolormesh():
618618
n = 12

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def compare_figure(fname):
5757

5858
expected = os.path.join(result_dir, "expected_%s" % fname)
5959
shutil.copyfile(os.path.join(baseline_dir, fname), expected)
60-
err = compare_images(expected, actual, tol=5e-3)
60+
err = compare_images(expected, actual, tol=50)
6161
if err:
6262
raise ImageComparisonFailure('images not close: %s vs. %s' % (actual, expected))
6363

lib/matplotlib/tests/test_compare_images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_image_compare_basic():
4141
# a small RMS.
4242
im1 = 'cosine_peak-nn-img.png'
4343
im2 = 'cosine_peak-nn-img-minorchange.png'
44-
image_comparison_expect_rms(im1, im2, tol=1e-3, expect_rms=None)
44+
image_comparison_expect_rms(im1, im2, tol=10, expect_rms=None)
4545

4646
# Now test with no tolerance.
4747
image_comparison_expect_rms(im1, im2, tol=0, expect_rms=2.99949)

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_interp_nearest_vs_none():
5656
ax2.set_title('interpolation nearest')
5757

5858

59-
@image_comparison(baseline_images=['figimage-0', 'figimage-1'], extensions=['png'], tol=1.5e-3)
59+
@image_comparison(baseline_images=['figimage-0', 'figimage-1'], extensions=['png'], tol=15)
6060
def test_figimage():
6161
'test the figimage method'
6262

@@ -159,7 +159,7 @@ def test_image_clip():
159159

160160
im = ax.imshow(d, extent=(-pi,pi,-pi/2,pi/2))
161161

162-
@image_comparison(baseline_images=['imshow'], tol=1.5e-3, remove_text=True)
162+
@image_comparison(baseline_images=['imshow'], tol=15, remove_text=True)
163163
def test_imshow():
164164
import numpy as np
165165
import matplotlib.pyplot as plt

lib/matplotlib/tests/test_legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import matplotlib.pyplot as plt
55
import matplotlib as mpl
66

7-
@image_comparison(baseline_images=['legend_auto1'], tol=1.5e-3, remove_text=True)
7+
@image_comparison(baseline_images=['legend_auto1'], tol=15, remove_text=True)
88
def test_legend_auto1():
99
'Test automatic legend placement'
1010
fig = plt.figure()

lib/matplotlib/tests/test_simplification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_clipping():
2828
ax.plot(t, s, linewidth=1.0)
2929
ax.set_ylim((-0.20, -0.28))
3030

31-
@image_comparison(baseline_images=['overflow'], tol=1e-2, remove_text=True)
31+
@image_comparison(baseline_images=['overflow'], tol=100, remove_text=True)
3232
def test_overflow():
3333
x = np.array([1.0,2.0,3.0,2.0e5])
3434
y = np.arange(len(x))

0 commit comments

Comments
 (0)