Numpy: Creating a complex array from 2 real ones?
Posted
by Duncan Tait
on Stack Overflow
See other posts from Stack Overflow
or by Duncan Tait
Published on 2010-04-08T09:22:49Z
Indexed on
2010/04/08
9:53 UTC
Read the original article
Hit count: 267
I swear this should be so easy... Why is it not? :(
In fact, I want to combine 2 parts of the same array to make a complex array:
Data[:,:,:,0] , Data[:,:,:,1]
These don't work:
x = np.complex(Data[:,:,:,0], Data[:,:,:,1])
x = complex(Data[:,:,:,0], Data[:,:,:,1])
Am I missing something? Does numpy not like performing array functions on complex numbers? Here's the error:
TypeError: only length-1 arrays can be converted to Python scalars
Cheers
© Stack Overflow or respective owner