sme.SimulationResult.concentration_image

property SimulationResult.concentration_image

an image of the species concentrations at this timepoint

An array of RGB integer values for each voxel in the image of the compartments in this model, which can be displayed using e.g. matplotlib.pyplot.imshow

Examples

do a short simulation and get the concentration image from the last timepoint:

>>> import sme
>>> model = sme.open_example_model()
>>> results = model.simulate(10, 1)
>>> concentration_image = results[-1].concentration_image

the image is a 4d (depth x height x width x 3) array of integers:

>>> type(concentration_image)
<class 'numpy.ndarray'>
>>> concentration_image.dtype
dtype('uint8')
>>> concentration_image.shape
(1, 100, 100, 3)

each voxel in the image has a triplet of RGB integer values in the range 0-255:

>>> concentration_image[0, 34, 36]
array([33, 23,  9], dtype=uint8)

the image can be displayed using matplotlib:

>>> import matplotlib.pyplot as plt
>>> imgplot = plt.imshow(concentration_image[0])
Type:

numpy.ndarray