Hi Tom,
Thanks for looking at this. The answer is "yes," as can be seen from the
output below. The rx_freq field is not something that I added. I did add
the "dumm" field, however.
Sincerely,
Dan Marlow
marlow@phy-gr2:~/pulsar/DAQ$ gr_read_file_metadata meta_test.dat.hdr
HEADER 0
Version Number: 0
Sample Rate: 4000000.00 sps
Seconds: 0.184295
Item size: 4
Data Type: float (5)
Complex? False
Header Length: 189 bytes
Extra Length: 40
Extra Header? True
Size of Data: 65536 bytes
16384 items
Extra Header:
rx_freq:
1.2e+09
dumm:
1408561917746092
On Aug 21, 2014, at 6:03 PM, Tom Rondeau wrote:
> On Tue, Aug 19, 2014 at 3:13 PM, Daniel Marlow <[email protected]> wrote:
> Hello,
>
> I am trying to add some extra information to the standard metadata file
> header.
>
> Following the information posted on
> http://gnuradio.org/doc/doxygen/page_metadata.html , I am able to write and
> read the standard metadata. I have attempted to add extra metadata with
> the following lines in my flowgraph:
>
> # add some extra meta data
> key = pmt.pmt_intern("dummy")
> val = pmt.pmt_from_long(77)
> extras = pmt.pmt_make_dict()
> extras = pmt.pmt_dict_add(extras, key, val)
> extras_str = pmt.pmt_serialize_str(extras)
>
> nItems = 1024*size
> self.blocks_file_meta_sink_0 =
> blocks.file_meta_sink(gr.sizeof_float*1,"./meta_test.dat",
> samp_rate, 1, blocks.GR_FILE_FLOAT, False, nItems,
> extras_str, True)
> self.blocks_file_meta_sink_0.set_unbuffered(False)
>
> I think that the writing is going OK, since the length of the header
> increases by a reasonable amount and a Unix hexdump indicates that the
> "dummy" data is present. However, I am stuck when it comes to getting at
> the extra data using the parse_file_metadata functions. In particular, when
> I try to read the data using:
>
> cHeader = c[0:185] # character array read from file
> pmt_dict = pmt.pmt_deserialize_str(cHeader)
> p = parse_file_metadata.parse_header(pmt_dict,False)
> p_extra = parse_file_metadata.parse_extra_dict(pmt_dict,info,True)
>
> The first parse_file_metadata line successfully provides the standard
> metadata, but the second parse_file_metadata does not provide the extra
> "dummy" data. I suspect that it has to do with my poor understanding of
> what should go in the info argument.
>
> Any help would be greatly appreciated.
>
> Sincerely,
> Dan Marlow
>
>
> Dan,
>
> What happens when you run gr_read_metadata on the file that's created? Does
> that show your extra header info?
>
> Tom
>
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio