discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Saving PMTs as Python Dictionaries to .Mat File


From: Martin Braun
Subject: Re: [Discuss-gnuradio] Saving PMTs as Python Dictionaries to .Mat File
Date: Thu, 09 Oct 2014 10:16:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

We have functions to convert PMTs to corresponding Python types. Have
you tried those? to_python()?

M

On 10/09/2014 02:57 AM, Jonathan Fox wrote:
> I have a series of collected metadata files. I have taken both the
> gr_read_file_metadata.py and parse_file_metadata.py scripts and hacked
> them to my own needs. What I would like to do is convert the PMT to
> python dictionary (already done in the vanilla files) and save the
> dicitonary as a Matlab .mat file format. SciPy has the necessary
> libraries and functions to save with the savemat command, the problem
> is, at least I believe it is the PMTs are being problematic.
> 
> For example I convert all headers to a dictionary and try to save just
> that and I get this error:
> 
> /usr/lib64/python2.6/site-packages/scipy/io/matlab/mio.py:165:
> FutureWarning: Using oned_as default value ('column') This will change
> to 'row' in future versions
>   oned_as=oned_as)
> Traceback (most recent call last):
>   File "./parser_mat.py", line 71, in <module>
>     main(filename, options.savefile, options.detached, options.computer)
>   File "./parser_mat.py", line 51, in main
>     scipy.io.savemat(savefile, dict(info))
>   File "/usr/lib64/python2.6/site-packages/scipy/io/matlab/mio.py", line
> 168, in savemat
>     MW.put_variables(mdict)
>   File "/usr/lib64/python2.6/site-packages/scipy/io/matlab/mio5.py",
> line 1217, in put_variables
>     mat_writer.write()
>   File "/usr/lib64/python2.6/site-packages/scipy/io/matlab/mio5.py",
> line 897, in write
>     self._write_items()
>   File "/usr/lib64/python2.6/site-packages/scipy/io/matlab/mio5.py",
> line 941, in _write_items
>     MW = MWG.matrix_writer_factory(self.file_stream, el[f])
>   File "/usr/lib64/python2.6/site-packages/scipy/io/matlab/mio5.py",
> line 1094, in matrix_writer_factory
>     % (arr, type(arr)))
> TypeError: Could not convert
> _30320b0200000000_p_boost__intrusive_ptrT_pmt__pmt_base_t (type <type
> 'SwigPyObject'>) to array
> 
> The snippet of code to save is this:
> 
> scip.io.savemat(savefile, dict(info))
> 
> savefile is a string that is a user set arguement. info is the dictionary.
> 
> I don't know if anyone on this list has tried to do what I am doing but
> I would appreciate any insight on where this is going wrong, especially
> if the problem is on my end.
> 
> Thanks
> 
> Jonathan Fox
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 




reply via email to

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