yt.data_objects.image_array.
ImageArray
[source]¶A custom Numpy ndarray used for images.
This differs from ndarray in that you can optionally specify an info dictionary which is used later in saving, and can be accessed with ImageArray.info.
Parameters: | input_array: array_like :
|
---|---|
Returns: | obj: ImageArray object : |
Other Parameters: | |
info: dictionary :
|
|
Raises: | None : |
See also
numpy.ndarray
Examples
These are written in doctest format, and should illustrate how to use the function. Use the variables ‘ds’ for the dataset, ‘pc’ for a plot collection, ‘c’ for a center, and ‘L’ for a vector.
>>> im = np.zeros([64,128,3])
>>> for i in range(im.shape[0]):
... for k in range(im.shape[2]):
... im[i,:,k] = np.linspace(0.,0.3*k, im.shape[1])
>>> myinfo = {'field':'dinosaurs', 'east_vector':np.array([1.,0.,0.]),
... 'north_vector':np.array([0.,0.,1.]), 'normal_vector':np.array([0.,1.,0.]),
... 'width':0.245, 'units':'cm', 'type':'rendering'}
>>> im_arr = ImageArray(im, info=myinfo)
>>> im_arr.save('test_ImageArray')
Numpy ndarray documentation appended:
Methods