[Numpy-discussion] saving complex vector

Robert Kern robert.kern@gmail....
Wed Jul 15 10:49:03 CDT 2009


On Wed, Jul 15, 2009 at 09:05, Neal Becker<ndbecker2@gmail.com> wrote:
> 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?

np.column_stack([mod_out.real, mod_out.imag])

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list