Skip to content

Commit

Permalink
Fix manual QC selection in DepthProfile graphing mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggalibert committed Apr 5, 2017
1 parent 9175756 commit 07a81bf
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 117 deletions.
23 changes: 2 additions & 21 deletions Graph/DepthProfile/getSelectedDepthProfileGeneric.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
function dataIdx = getSelectedDepthProfileGeneric( ...
sample_data, var, ax, highlight, click )
function dataIdx = getSelectedDepthProfileGeneric( sample_data, var, ax, highlight )
%GETSELECTEDDEPTHPROFILEGENERIC Returns the indices of the currently selected
% (highlighted) data on the given axis.
%
Expand Down Expand Up @@ -50,22 +49,4 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.
%
narginchk(4,4);

if ~isstruct(sample_data), error('sample_data must be a struct'); end
if ~isnumeric(var), error('var must be numeric'); end
if ~ishandle(ax), error('ax must be a graphics handle'); end
if ~ishandle(highlight), error('highlight must be a graphics handle'); end

depth = getVar(sample_data.dimensions, 'DEPTH');
if depth ~= 0
depth = sample_data.dimensions{depth};
else
depth = getVar(sample_data.variables, 'DEPTH');
depth = sample_data.variables{depth};
end

highlightY = get(highlight, 'YData');

% find the indices of the selected points
dataIdx = find(ismember(depth.data, highlightY));
dataIdx = getSelectedTimeSeriesGeneric(sample_data, var, ax, highlight);
11 changes: 2 additions & 9 deletions Graph/TimeSeries/getSelectedTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
function dataIdx = getSelectedTimeSeriesGeneric( ...
sample_data, var, ax, highlight )
function dataIdx = getSelectedTimeSeriesGeneric( sample_data, var, ax, highlight )
%GETSELECTEDTIMESERIESGENERIC Returns the indices of the currently selected
% (highlighted) data on the given axis.
%
Expand Down Expand Up @@ -54,10 +53,4 @@
if ~ishandle(ax), error('ax must be a graphics handle'); end
if ~ishandle(highlight), error('highlight must be a graphics handle'); end

iTimeDim = getVar(sample_data.dimensions, 'TIME');
time = sample_data.dimensions{iTimeDim};

highlightX = get(highlight, 'XData');

% find the indices of the selected points
dataIdx = find(ismember(time.data, highlightX));
dataIdx = get(highlight, 'UserData');
29 changes: 1 addition & 28 deletions Graph/TimeSeries/getSelectedTimeSeriesTimeDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,4 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.
%
narginchk(4, 4);

if ~isstruct(sample_data), error('sample_data must be a struct'); end
if ~isnumeric(var), error('var must be numeric'); end
if ~ishandle(ax), error('ax must be a graphics handle'); end
if ~ishandle(highlight), error('highlight must be a graphics handle'); end

dataIdx = [];

iTimeDim = getVar(sample_data.dimensions, 'TIME');
depth = sample_data.variables{var}.dimensions(2);

time = sample_data.dimensions{iTimeDim} .data;
depth = sample_data.dimensions{depth}.data;

highlightX = get(highlight, 'XData');
highlightY = get(highlight, 'YData');

% turn the highlight into data indices
for k = 1:length(highlightX)

% get the indices, on each dimension, of each point in the highlight
timeIdx = find(time == highlightX(k));
depthIdx = find(depth == highlightY(k));

% 'flatten' those indices
dataIdx = [dataIdx ((depthIdx - 1) * length(time) + timeIdx)];
end
dataIdx = getSelectedTimeSeriesGeneric(sample_data, var, ax, highlight);
29 changes: 1 addition & 28 deletions Graph/TimeSeries/getSelectedTimeSeriesTimeFrequency.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,4 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.
%
narginchk(4, 4);

if ~isstruct(sample_data), error('sample_data must be a struct'); end
if ~isnumeric(var), error('var must be numeric'); end
if ~ishandle(ax), error('ax must be a graphics handle'); end
if ~ishandle(highlight), error('highlight must be a graphics handle'); end

dataIdx = [];

iTimeDim = getVar(sample_data.dimensions, 'TIME');
freq = sample_data.variables{var}.dimensions(4);

time = sample_data.dimensions{iTimeDim}.data;
freq = sample_data.dimensions{freq}.data;

highlightX = get(highlight, 'XData');
highlightY = get(highlight, 'YData');

% turn the highlight into data indices
for k = 1:length(highlightX)

% get the indices, on each dimension, of each point in the highlight
timeIdx = find(time == highlightX(k));
freqIdx = find(freq == highlightY(k));

% 'flatten' those indices
dataIdx = [dataIdx ((freqIdx - 1) * length(time) + timeIdx)];
end
dataIdx = getSelectedTimeSeriesGeneric(sample_data, var, ax, highlight);
22 changes: 11 additions & 11 deletions Graph/TimeSeries/highlightTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@
% figure out indices of all the points to be highlighted
idx = xidx & yidx;

% return nothing if no points to plot
if ~any(idx), highlight = [];

% create the highlight
if ~any(idx)
% return nothing if no points to plot
highlight = [];
else

highlight = line(xdata(idx),ydata(idx),...
'Parent', gca,...
'LineStyle', 'none',...
'Marker', 'o',...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white');
% create the highlight
highlight = line(xdata(idx),ydata(idx), ...
'UserData', idx, ...
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white');
end
20 changes: 10 additions & 10 deletions Graph/TimeSeries/highlightTimeSeriesTimeDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@

end

if ~any(any(idx)), highlight = [];

if ~any(any(idx))
highlight = [];
else

highlight = line(Xdata(idx), Ydata(idx),...
'Parent', gca,...
'LineStyle', 'none',...
'Marker', 'o',...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white',...
'MarkerSize', 3);
highlight = line(Xdata(idx), Ydata(idx), ...
'UserData', idx, ...
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white', ...
'MarkerSize', 3);
end
20 changes: 10 additions & 10 deletions Graph/TimeSeries/highlightTimeSeriesTimeFrequencyDirection.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@

end

if ~any(any(idx)), highlight = [];

if ~any(any(idx))
highlight = [];
else

highlight = line(Xdata(idx),Ydata(idx),...
'Parent', gca,...
'LineStyle', 'none',...
'Marker', 'o',...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white',...
'MarkerSize', 3);
highlight = line(Xdata(idx), Ydata(idx), ...
'UserData', idx, ...
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white', ...
'MarkerSize', 3);
end

0 comments on commit 07a81bf

Please sign in to comment.