MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / calculate_rms

Function calculate_rms

lib/matplotlib/testing/compare.py:383–392  ·  view source on GitHub ↗

Calculate the per-pixel errors, then compute the root mean square error.

(expected_image, actual_image)

Source from the content-addressed store, hash-verified

381
382
383def calculate_rms(expected_image, actual_image):
384 """
385 Calculate the per-pixel errors, then compute the root mean square error.
386 """
387 if expected_image.shape != actual_image.shape:
388 raise ImageComparisonFailure(
389 f"Image sizes do not match expected size: {expected_image.shape} "
390 f"actual size {actual_image.shape}")
391 # Convert to float to avoid overflowing finite integer types.
392 return np.sqrt(((expected_image - actual_image).astype(float) ** 2).mean())
393
394
395# NOTE: compare_image and save_diff_image assume that the image does not have

Callers

nothing calls this directly

Calls 2

sqrtMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…