[Top][All Lists]
[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: |
hasanimam |
Subject: |
Re: [Discuss-gnuradio] How to use the read_float_binary.m function |
Date: |
Thu, 27 Oct 2011 20:30:02 -0700 (PDT) |
Still no ray of hope.
I am pasting the complete code here.
---------------------------------------------------------------------------------------------------------------------------
collect_raw_data = gr.file_sink(self.fft_size, "observed_data")
numpy.fromfile("observed_data", dtype=numpy.complex64, count=-1,
sep='')
thingy = numpy.fromfile("observed_data", dtype=int, count=-1,
sep='')
file = open ("outputfile", "w")
for n in range(0, len(thingy)):
x = str(thingy[n].real) + " " + str(thingy[n].imag)+ "\n"
file.write(x)
file.close()
self.connect(self.u, s2v, c2mag, collect_raw_data)
---------------------------------------------------------------------------------------
What do you think what should be the output of the above alogrithm.
I am getting two output files for this algorithm.
One is "observed_data" which contains some unreadable characters. I think
this is a binary file. I have to convert this binary file to understand the
raw data.
The other one is "output" which contains nothing. I guess this file should
contain the converted data of "observed_data" file.
Still looking for some sort of help.
Thanks.
Marcus D. Leech wrote:
>
> 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
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
--
View this message in context:
http://old.nabble.com/How-to-use-the-read_float_binary.m-function-tp32729533p32735809.html
Sent from the GnuRadio mailing list archive at Nabble.com.
- [Discuss-gnuradio] How to use the read_float_binary.m function, hasanimam, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Marcus D. Leech, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, hasanimam, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Josh Blum, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Hasan Rajib Imam, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, hasanimam, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Marcus D. Leech, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Josh Blum, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, hasanimam, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Marcus D. Leech, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function,
hasanimam <=
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Marcus D. Leech, 2011/10/27
- Re: [Discuss-gnuradio] How to use the read_float_binary.m function, Marcus D. Leech, 2011/10/27
Re: [Discuss-gnuradio] How to use the read_float_binary.m function, wallen, 2011/10/28