Where to begin? I originally asked for help (see link below) on how to make a blanket 360 degree flip based on a spec value however looking into a bit more thoroughly that won't work because the phase is wrapped. There is a process to unwrap the phase to a continuous form.
The process is as follows: (using Radian Values)
1) Start with the second sample from the left in the wrapped phase signal.
2) Calculate the difference between the current sample and its directly adjacent left-hand neighbour.
3) If the difference between the two is larger than +π, then subtract 2π from this sample and also from all the samples to the right of it.
4) If the difference between the two is smaller than -π, then add 2π to this sample and also to all the samples to the right of it.
5) Have all the samples been processed? If No then go back to step 2. If Yes then stop
I am looking for some assistance in performing this operation and have attached a sample data table for reference.
In this data table I need to unwrap by :RowCol, :channel, :teststate and refstate.
Thanks in advance
// You can plot the data according to the scripts below
// This is what i think is a wrapped phase
_dt = Current Data Table();
gb = _dt << Graph Builder(
Size( 1326, 1002 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :index ), Y( :radians ), Overlay( :RowCol_PartNo_Ch ) ),
Elements( Line( X, Y, Legend( 8 ) ) ),
Local Data Filter(
Add Filter(
columns( :teststate, :refstate, :channel, :RowCol ),
Where( :teststate == 11 ),
Where( :refstate == 1 ),
Where( :channel == {"0", "1", "2", "3"} ),
Where( :RowCol == "r3c1sr3sc1" ),
Display( :channel, N Items( 4 ) ),
Display( :RowCol, N Items( 15 ), Find( Set Text( "" ) ) )
)
),
SendToReport(
Dispatch(
{},
"index",
ScaleBox,
{Min( 4.3125 ), Max( 22.6875 ), Inc( 1 ), Minor Ticks( 4 )}
)
)
);
// This is what i think is a normal (continuous form)
_dt = Current Data Table();
gb = _dt << Graph Builder(
Size( 1326, 1002 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :index ), Y( :radians ), Overlay( :RowCol_PartNo_Ch ) ),
Elements( Line( X, Y, Legend( 8 ) ) ),
Local Data Filter(
Add Filter(
columns( :teststate, :refstate, :channel, :RowCol ),
Where( :teststate == 11 ),
Where( :refstate == 1 ),
Where( :channel == {"0", "1", "2", "3"} ),
Where( :RowCol == "r3c1sr3sc0" ),
Display( :channel, N Items( 4 ) ),
Display( :RowCol, N Items( 15 ), Find( Set Text( "" ) ) )
)
),
SendToReport(
Dispatch(
{},
"index",
ScaleBox,
{Min( 4.3125 ), Max( 22.6875 ), Inc( 1 ), Minor Ticks( 4 )}
)
)
);
Changing column values based on the column spec limit