unwrap.phase: Phase Unwrapping Function

Description Usage Arguments Value Author(s) Examples

View source: R/unwrap.phase.R

Description

This unwrap function removes pi or 2*pi phase jumps from an input dataset.

Usage

1
unwrap.phase(Data, tol = pi, step = (2 * pi))

Arguments

Data

Phase data to be unwrapped as a vector.

tol

is the amount between steps which is considered large enough to be a jump, default value is pi.

step

indicates the amount size of the jump in the phase data inputted, default value is 2*pi.

Value

Returns the unwrapped dataset as a vector.

Author(s)

S.J.Berry

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (Data, tol = pi, step = (2 * pi)) 
{
    Data_Length <- length(Data)
    for (a in 1:(Data_Length - 1)) {
        b <- a + 1
        Data_Difference <- Data[a] - Data[b]
        if (Data_Difference <= (-tol)) {
            for (c in b:Data_Length) {
                Data[c] <- Data[c] - step
            }
        }
        if (Data_Difference >= (tol)) {
            for (c in b:Data_Length) {
                Data[c] <- Data[c] + step
            }
        }
    }
    return(Data)
  }

tjconstant/photonMonkey documentation built on Feb. 19, 2018, 7:05 a.m.