Skip to content

Instantly share code, notes, and snippets.

View arturgower's full-sized avatar

Art Gower arturgower

View GitHub Profile
@ssfrr
ssfrr / unwrap.jl
Created December 16, 2013 21:46
Julia implementation of a phase unwrap function
function unwrap(v, inplace=false)
# currently assuming an array
unwrapped = inplace ? v : copy(v)
for i in 2:length(v)
while unwrapped[i] - unwrapped[i-1] >= pi
unwrapped[i] -= 2pi
end
while unwrapped[i] - unwrapped[i-1] <= -pi
unwrapped[i] += 2pi
end