# Stream tag samples

**URL:** <https://www.ruby-forum.com/t/stream-tag-samples/237138>\
**Category:** GNU Radio\
**Created:** [October 25, 2013, 9:07pm UTC](https://www.ruby-forum.com/t/stream-tag-samples/237138 "2013-10-25T21:07:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [October 25, 2013, 9:07pm UTC](https://www.ruby-forum.com/t/stream-tag-samples/237138/1 "2013-10-25T21:07:23Z")

</div>

* * *

Hi,  
I’m using stream tags to time tag my data. In particular, I’m reading  
in one-second files and tagging the first sample read in with the time.  
I’m concerned with how the tag will be handled during decimation,  
filtering etc. I have read the documentation and understand that the  
tag is reassigned based on the relative\_rate. For this particular data  
set though, it is important that the tags stay with the specific samples  
to which they were assigned, even if some of the tags are lost during  
decimation, filtering, etc.

---

<div class="post-metadata">

**Author:** ![Jenny\_Galasso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@Jenny\_Galasso](https://www.ruby-forum.com/u/Jenny_Galasso)\
**Post date:** [October 25, 2013, 9:24pm UTC](https://www.ruby-forum.com/t/stream-tag-samples/237138/2 "2013-10-25T21:24:20Z")

</div>

From: discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid  
[[mailto:discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid](mailto:discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid)] On  
Behalf Of Jenny Galasso  
Sent: Friday, October 25, 2013 3:06 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Discuss-gnuradio] stream tag samples

Today at 1:02 PM  
Hi,  
I’m using stream tags to time tag my data. In particular, I’m reading in  
one-second files and tagging the first sample read in with the time. I’m  
concerned with how the tag will be handled during decimation, filtering  
etc. I have read the documentation and understand that the tag is  
reassigned based on the relative\_rate. For this particular data set  
though, it is important that the tags stay with the specific samples to  
which they were assigned, even if some of the tags are lost during  
decimation, filtering, etc.  
Is this even possible? Are there any recommendations or tricks to get it  
to behave this way?  
Thanks!  
Jenny

Hi Jenny,

If you decimate by N, you’re getting rid of N-1 out of every N samples.  
So naturally you would want the tag to stick with the sample that  
doesn’t get thrown out. Similarly, if you interpolate by M, you  
introduce M-1 samples into the stream for every input sample; you’d  
naturally want the tag associated with input sample /i/ to be placed on  
the first sample of the corresponding batch of M output samples. The  
propagate\_tags method in gnuradio/gnuradio-runtime/lib/block\_executor.cc  
handles this by default. You can override this behavior in your own  
blocks by calling “set\_tag\_propagation\_policy(TPP\_DONT)” in your block’s  
constructor and then handling tags yourself in your work method.

Sean

---

<div class="post-metadata">

**Author:** ![Jenny\_Galasso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@Jenny\_Galasso](https://www.ruby-forum.com/u/Jenny_Galasso)\
**Post date:** [October 25, 2013, 9:42pm UTC](https://www.ruby-forum.com/t/stream-tag-samples/237138/3 "2013-10-25T21:42:27Z")

</div>

From: discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid  
[[mailto:discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid](mailto:discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid)] On  
Behalf Of Nowlan, Sean  
Sent: Friday, October 25, 2013 3:23 PM  
To: Jenny Galasso; removed\_email\_address@domain.invalid  
Subject: Re: [Discuss-gnuradio] stream tag samples

From:  
discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid[mailto:discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid](mailto:discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid)  
[[mailto:discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid](mailto:discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid)] On  
Behalf Of Jenny Galasso  
Sent: Friday, October 25, 2013 3:06 PM  
To: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Discuss-gnuradio] stream tag samples

Today at 1:02 PM  
Hi,  
I’m using stream tags to time tag my data. In particular, I’m reading in  
one-second files and tagging the first sample read in with the time. I’m  
concerned with how the tag will be handled during decimation, filtering  
etc. I have read the documentation and understand that the tag is  
reassigned based on the relative\_rate. For this particular data set  
though, it is important that the tags stay with the specific samples to  
which they were assigned, even if some of the tags are lost during  
decimation, filtering, etc.  
Is this even possible? Are there any recommendations or tricks to get it  
to behave this way?  
Thanks!  
Jenny

Hi Jenny,

If you decimate by N, you’re getting rid of N-1 out of every N samples.  
So naturally you would want the tag to stick with the sample that  
doesn’t get thrown out. Similarly, if you interpolate by M, you  
introduce M-1 samples into the stream for every input sample; you’d  
naturally want the tag associated with input sample /i/ to be placed on  
the first sample of the corresponding batch of M output samples. The  
propagate\_tags method in gnuradio/gnuradio-runtime/lib/block\_executor.cc  
handles this by default. You can override this behavior in your own  
blocks by calling “set\_tag\_propagation\_policy(TPP\_DONT)” in your block’s  
constructor and then handling tags yourself in your work method.

Sean

I don’t think there’s a way to tell GNU Radio blocks derived from  
sync\_decimator and sync\_interpolator to quit propagating tags as  
described above (unless you write blocks that inherit from these classes  
yourself). It’s the only way that really makes sense when changing rate  
domains by a rational factor.

Sean
