_tocomplex(arr)
The input is returned as a complex array of the smallest type that will fit the original data: types like single, byte, short, etc. become csingle, while others become cdouble.
A copy of the input is always made.
An array with the same input data as the input but in complex form.
Convert its input :None:None:`arr`
to a complex array.
First, consider an input of type short:
>>> a = np.array([1,2,3],np.short)
>>> ac = np.lib.scimath._tocomplex(a); ac array([1.+0.j, 2.+0.j, 3.+0.j], dtype=complex64)
>>> ac.dtype dtype('complex64')
If the input is of type double, the output is correspondingly of the complex double type as well:
>>> b = np.array([1,2,3],np.double)
>>> bc = np.lib.scimath._tocomplex(b); bc array([1.+0.j, 2.+0.j, 3.+0.j])
>>> bc.dtype dtype('complex128')
Note that even if the input was complex to begin with, a copy is still made, since the astype() method always copies:
>>> c = np.array([1,2,3],np.csingle)
>>> cc = np.lib.scimath._tocomplex(c); cc array([1.+0.j, 2.+0.j, 3.+0.j], dtype=complex64)
>>> c *= 2; c array([2.+0.j, 4.+0.j, 6.+0.j], dtype=complex64)
>>> cc array([1.+0.j, 2.+0.j, 3.+0.j], dtype=complex64)See :
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them