[Numpy-discussion] saving complex vector
Dave
dave.hirschfeld at gmail.com
Wed Jul 15 11:43:16 EDT 2009
Neal Becker <ndbecker2 <at> gmail.com> writes:
>
> Simple question. I want to save a complex vector as text in format
>
> real_0 imag_0\n
> real_1 imag_1\n
> ...
>
> I thought to use something like:
> np.savetxt ('gen_qpsk.txt', (mod_out.real, mod_out.imag), fmt='%g %g\n')
>
> I need a way to reinterpret the complex data as an array with 2 columns to
> make this work. Ideas?
>
Something like?
gen_qpsk = (array([[1,1j]])*np.loadtxt('gen_qpsk.txt')).sum(1)
HTH,
Dave
More information about the NumPy-Discussion
mailing list