vispy.testing.rendered_array_tester module#

Test utilities for comparing rendered arrays with expected array results.

vispy.testing.rendered_array_tester.compare_render(orig_data: ndarray, rendered_data: ndarray, previous_render: ndarray | None = None, atol: float | None = 1.0)#

Compare an expected original array with the rendered result.

Parameters:
orig_data

Expected output result array. This will be converted to an RGBA array to be compared against the rendered data.

rendered_data

Actual rendered result as an RGBA 8-bit unsigned array.

previous_render

Previous instance of a render that the current render should not be equal to.

atol

Absolute tolerance to be passed to numpy.testing.assert_allclose().

vispy.testing.rendered_array_tester.make_rgba(data_in: ndarray) ndarray#

Convert any array to an RGBA array.

RGBA arrays have 3 dimensions where the last represents the channels. If an Alpha channel needs to be added it will be made completely opaque.

Returns:
3D RGBA unsigned 8-bit array
vispy.testing.rendered_array_tester.max_for_dtype(input_dtype: Any)#

Get maximum value an image array should have for a specific dtype.

This is max int for each integer type or 1.0 for floating point types.