discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] How to use the read_float_binary.m function


From: Marcus D. Leech
Subject: Re: [Discuss-gnuradio] How to use the read_float_binary.m function
Date: Thu, 27 Oct 2011 23:17:56 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10

On 27/10/11 11:00 PM, hasanimam wrote:
> To Josh and Marcus,
>
> Well I tried all aspects.
> Here is what I did,
>
> a = numpy.fromfile("observed_data", dtype=numpy.complex64, count=-1, sep='')
> file = open ("outputfile", "w")
> for n in range(0,len(a)):
>    outstr = ("%f" % a[n]) + "\n"
>    file.write (outstr)
>
> file.close()
>
> The output file does not contain anything. I have really no idea why these
> things are happening.
> I thought that using numpy.formfile, I will be able to read the converted
> binary file..however..its not happening.
>
> Am a little bit sad.. 
>   
Is your input file non-zero length?

and since you're using complex64, assuming you've read your file into 'a':

f = open("outputfile", "w")
for n in range(0,len(a)):
    x = str(a[n].real) + " " + str(a[n].imag)+ "\n"
   f.write (x)

f.close()


Will produce a readable-text file for output.


-- 
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]