fresnel.util¶
Overview
fresnel.util.array |
Map internal fresnel buffers as numpy arrays. |
fresnel.util.image_array |
Map internal fresnel image buffers as numpy arrays. |
Details
Utility classes and methods.
-
class
fresnel.util.
array
(buf, geom)¶ Map internal fresnel buffers as numpy arrays.
fresnel.util.array
provides a python interface to access internal data of memory buffers stored and managed by fresnel. These buffers may exist on the CPU or GPU depending on the device configuration, sofresnel.util.array
only allows certain operations: read/write of array data, and read-only querying of array properties.You can access a
fresnel.util.array
as if it were a numpy array (with limited operations).Write to an array with
array[slice] = v
where v is a numpy array or anything that numpy can convert to an array. When v is a contiguous numpy array of the appropriate data type, the data is copied directly from v into the internal buffer.Read from an array with
v = array[slice]
. This returns a copy of the data as a numpy array because the array references internal data structures in fresnel that may exist on the GPU.-
shape
¶ tuple – Dimensions of the array.
-
dtype
¶ Numpy data type
-
-
class
fresnel.util.
image_array
(buf, geom)¶ Map internal fresnel image buffers as numpy arrays.
Inherits from
array
and provides all of its functionality, plus some additional convenience methods specific to working with images. Images are represented as WxHx4 numpy arrays of unsigned chars in RGBA format.Specifically, when a
image_array
is the result of an image in a Jupyter notebook cell, Jupyter will display the image.