function procTracks = linearisePhi(procTracks) %LINEARISEPHI takes the phi field of the input version of procTracks %(defined nematically, so between -90 and 90) and adds or subtracts %increments of 180 to each position in the track to ensure phi keeps track %of a single pole. % % INPUTS: % procTracks: The output of the tracking module of FAST, stored in % the 'Tracks.mat' file. % % OUTPUTS: % procTracks: Version of procTracks with a new 'fullPhi' field, which % contains the wrapped version of phi. % % Author: Oliver J. Meacock, (c) 2019 for i = 1:size(procTracks,2) phiDiff = diff(procTracks(i).phi); stepsUp = phiDiff < -90; stepsDown = phiDiff > 90; intSteps = cumsum(stepsUp - stepsDown); intSteps = [0; intSteps]; procTracks(i).fullPhi = procTracks(i).phi + intSteps*180; end