10000 TST: raise ImageComparisonFailure on size mismatch by tacaswell · Pull Request #6191 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

TST: raise ImageComparisonFailure on size mismatch #6191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
5 changes: 5 additions & 0 deletions lib/matplotlib/testing/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ def crop_to_same(actual_path, actual_image, expected_path, expected_image):

def calculate_rms(expectedImage, actualImage):
"Calculate the per-pixel errors, then compute the root mean square error."
if expectedImage.shape != actualImage.shape:
raise ImageComparisonFailure(
"image sizes do not match expected size: {0} "
"actual size {1}".format(expectedImage.shape, actualImage.shape))

num_values = np.prod(expectedImage.shape)
abs_diff_image = abs(expectedImage - actualImage)

Expand Down
0