yt.visualization.image_writer.multi_image_composite

yt.visualization.image_writer.multi_image_composite(fn, red_channel, blue_channel, green_channel=None, alpha_channel=None)[source]

Write an image with different color channels corresponding to different quantities.

Accepts at least a red and a blue array, of shape (N,N) each, that are optionally scaled and composited into a final image, written into fn. Can also accept green and alpha.

Parameters:

fn : string

Filename to save

red_channel : array_like or tuple of image info

Array, of shape (N,N), to be written into the red channel of the output image. If not already uint8, will be converted (and scaled) into uint8. Optionally, you can also specify a tuple that includes scaling information, in the form of (array_to_plot, min_value_to_scale, max_value_to_scale).

blue_channel : array_like or tuple of image info

Array, of shape (N,N), to be written into the blue channel of the output image. If not already uint8, will be converted (and scaled) into uint8. Optionally, you can also specify a tuple that includes scaling information, in the form of (array_to_plot, min_value_to_scale, max_value_to_scale).

green_channel : array_like or tuple of image info, optional

Array, of shape (N,N), to be written into the green channel of the output image. If not already uint8, will be converted (and scaled) into uint8. If not supplied, will be left empty. Optionally, you can also specify a tuple that includes scaling information, in the form of (array_to_plot, min_value_to_scale, max_value_to_scale).

alpha_channel : array_like or tuple of image info, optional

Array, of shape (N,N), to be written into the alpha channel of the output image. If not already uint8, will be converted (and scaled) into uint8. If not supplied, will be made fully opaque. Optionally, you can also specify a tuple that includes scaling information, in the form of (array_to_plot, min_value_to_scale, max_value_to_scale).

Examples

>>> red_channel = np.log10(frb["Temperature"])
>>> blue_channel = np.log10(frb["Density"])
>>> multi_image_composite("multi_channel1.png", red_channel, blue_channel)