noise_elements¶
-
odl.util.testutils.
noise_elements
(space, n=1)[source]¶ Create a list of
n
noise arrays and elements inspace
.The arrays contain white noise with standard deviation 1 in the case of floating point dtypes and uniformly spaced values between -10 and 10 in the case of integer dtypes.
The returned elements have the same values as the arrays.
For product spaces the method is called recursively for all sub-spaces.
- Parameters
- space
LinearSpace
Space in which to create an element. The LinearSpace.element method of the space needs to accept input of
numpy.ndarray
type.- nint, optional
Number of elements to create.
- space
- Returns
- arrays
numpy.ndarray
or tuple ofnumpy.ndarray
A single array if
n == 1
, otherwise a tuple of arrays.- elements
space
element or tuple ofspace
elements A single element if
n == 1
, otherwise a tuple of elements.
- arrays
See also
Notes
This method is intended for internal testing purposes. For more explicit example elements see
odl.phantoms
andLinearSpaceElement.examples
.Examples
Create single noise element:
>>> space = odl.rn(3) >>> arr, vector = noise_elements(space)
Create multiple noise elements:
>>> [arr1, arr2], [vector1, vector2] = noise_elements(space, n=2)