# Phase unwrapping

**URL:** <https://www.ruby-forum.com/t/phase-unwrapping/230400>\
**Category:** GNU Radio\
**Created:** [June 16, 2014, 2:42pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400 "2014-06-16T14:42:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [June 16, 2014, 2:42pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400/1 "2014-06-16T14:42:11Z")

</div>

Hello,

I just started to work with GNU radio for my very basic needs, so please  
excuse my naive questions and probably my inappropriate use of the  
jargon.

My first trivial application of GNU radio is to simply measure the phase  
of a phase modulated signal with an Ettus R. USRP N210 and a LFRX  
daughter-board.

Everything works as expected, but I haven’t found a way to do phase  
unwrapping (removing the 2pi ambiguity in the phase obtained from the  
arctan function looking at discontinuities in the phase data). Is this  
functionality offered somewhere, and I missed it, or should I look into  
implementing it myself?

Thanks. Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [June 16, 2014, 3:46pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400/2 "2014-06-16T15:46:21Z")

</div>

Daniele,

The problem with phase unwrapping is that it is unbounded, and will tend  
to  
infinity. Once it gets very big, when you try to add a small number to  
a  
very big number, floating point loses precision. Eventually, adding  
small  
to extremely big returns the big number unchanged. This isn’t that  
useful.

Matt

On Mon, Jun 16, 2014 at 2:40 PM, Daniele N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [June 16, 2014, 7:49pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400/3 "2014-06-16T19:49:01Z")

</div>

Daniele,

I have worked on this problem for a specific case as well. I have a  
document with source code and a short description of what’s happening  
that  
can be found here (  
[Dropbox - Error - Simplify your life](https://www.dropbox.com/s/bcma7fqa7ip2own/unwrap_example.txt)).

Michael

On Mon, Jun 16, 2014 at 10:05 AM, Daniele N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [June 16, 2014, 7:06pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400/4 "2014-06-16T19:06:54Z")

</div>

Hello Matt,

thank for your answer. I’m aware of the problem and in my application I  
can keep phase bounded, but not bounded to (-pi, +pi] therefore I need  
unwrapping to make sense of my modulation data.

If such feature does not exist in GNU radio, I hope it is not too hard  
to code it myself.

Thanks. Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [June 16, 2014, 7:54pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400/5 "2014-06-16T19:54:21Z")

</div>

On 16/06/2014 19:47, Michael B. wrote:

> I have worked on this problem for a specific case as well. I have a  
> document with source code and a short description of what’s happening  
> that can be found here

Hello Michael,

thank for your example code, but the algorithm is trivial, what I don’t  
yet know is how to implement it in such a way that it can be used within  
the gnuradio framework. I’m having a look at the documentation now.

Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [June 16, 2014, 8:11pm UTC](https://www.ruby-forum.com/t/phase-unwrapping/230400/6 "2014-06-16T20:11:33Z")

</div>

If you take a look at the doc again, i updated it a little bit to show  
it  
working in an OOT work function.

Michael

On Mon, Jun 16, 2014 at 10:53 AM, Daniele N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
