noise_elements¶
- odl.util.testutils.noise_elements(space, n=1)[source]¶
Create a list of
nnoise 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.ndarraytype.- nint, optional
Number of elements to create.
- space
- Returns:
- arrays
numpy.ndarrayor tuple ofnumpy.ndarray A single array if
n == 1, otherwise a tuple of arrays.- elements
spaceelement or tuple ofspaceelements 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.phantomsandLinearSpaceElement.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)