8000 Merge pull request #7395 from anntzer/drop-numpy-pre16-compat · matplotlib/matplotlib@00b3b8f · GitHub
[go: up one dir, main page]

Skip to content

Commit 00b3b8f

Browse files
authored
Merge pull request #7395 from anntzer/drop-numpy-pre16-compat
MNT: Drop code that supports numpy pre-1.6.
2 parents b81f5d5 + 0ea60e2 commit 00b3b8f

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,22 +254,11 @@ def calculate_rms(expectedImage, actualImage):
254254
raise ImageComparisonFailure(
255255
"image sizes do not match expected size: {0} "
256256
"actual size {1}".format(expectedImage.shape, actualImage.shape))
257-
258257
num_values = np.prod(expectedImage.shape)
259258
abs_diff_image = abs(expectedImage - actualImage)
260-
261-
# On Numpy 1.6, we can use bincount with minlength, which is much
262-
# faster than using histogram
263-
expected_version = version.LooseVersion("1.6")
264-
found_version = version.LooseVersion(np.__version__)
265-
if found_version >= expected_version:
266-
histogram = np.bincount(abs_diff_image.ravel(), minlength=256)
267-
else:
268-
histogram = np.histogram(abs_diff_image, bins=np.arange(257))[0]
269-
259+
histogram = np.bincount(abs_diff_image.ravel(), minlength=256)
270260
sum_of_squares = np.sum(histogram * np.arange(len(histogram)) ** 2)
271261
rms = np.sqrt(float(sum_of_squares) / num_values)
272-
273262
return rms
274263

275264

0 commit comments

Comments
 (0)
0