noise_elements
- odl.core.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.
Notes
This method is intended for internal testing purposes. For more explicit example elements see
odl.core.phantomsandLinearSpaceElement.examples.Parameters
- space
LinearSpace Space in which to create an element. The
odl.core.set.space.LinearSpace.elementmethod of the space needs to accept input ofnumpy.ndarraytype.- nint, optional
Number of elements to create.
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.
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)
See Also
noise_array noise_element
- space