|
From: Ethan A M. <sf...@us...> - 2014-01-30 20:52:47
|
On Thursday, 30 January, 2014 19:17:36 Jon Gjengset wrote:
> > Yes.
> > The actual smoothing code will probably only require a few lines of C.
>
> I've attached two patches, one that merges cleanly against cvs, and one
> that works with 4.6 (minor change, but might come in useful).
>
> I have also attached a sample data file with real phase measurements,
> and a plot file that plots this data with and without unwrapping.
>
> > The trickier part may be deciding whether or not it needs to be
> > reexecuted on replot/refresh/zoom/unzoom.
>
> The patch only implements unwrapping for datasets, and not for
> continuous functions (I'm not entirely sure why it has no effect for
> functions; it is not an intentional limitation from my side).
To use smoothing with a function you need to modify your plot command
so that the function is treated as sampled data:
plot 'phase.log' using 1:(atan2($3,$2)) w lines ls 1 t 'Wrapped' \
,'phase.log' using 1:(atan2($3,$2)) w lines ls 3 t 'Unwrapped' smooth unwrap \
,'+' using 1:(x-(floor(x/6.28)*6.28)-3.14) ls 4 t 'Wrapped func' \
,'+' using 1:(x-(floor(x/6.28)*6.28)-3.14) ls 5 t 'Unwrapped func' smooth unwrap \
> It seems to work well with zoom/unzoom/pan/replot as far as I can see.
>
> I'd appreciate it if someone else could try this with their datasets too
> and see that it's not doing anything too silly.
>
> I could also implement a weighted unwrapper if anyone feels there's a
> need for it, but I think basic unwrap will get us quite far.
>
> Cheers,
> Jon
|