Skip to content

Commit

Permalink
Merge pull request #674 from aodn/hotfix_2.6.8
Browse files Browse the repository at this point in the history
Hotfix 2.6.8
  • Loading branch information
ocehugo authored Aug 13, 2020
2 parents 50a01b3 + e67cdcf commit 7b274d5
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 32 deletions.
6 changes: 3 additions & 3 deletions AutomaticQC/imosTiltVelocitySetQC.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@

if isempty(firstTiltThreshold) && auto
% couldn't find this instrument so quit the test
disp(['Warning: imosTiltVelositySetQC could not be performed on ' sample_data.toolbox_input_file ...
' instrument = "' instrument '" => Fill imosTiltVelositySetQC.txt with relevant make/model information if you wish to run this test on this dataset.']);
disp(['Warning: imosTiltVelocitySetQC could not be performed on ' sample_data.toolbox_input_file ...
' instrument = "' instrument '" => Fill imosTiltVelocitySetQC.txt with relevant make/model information if you wish to run this test on this dataset.']);
return;
end

Expand All @@ -188,7 +188,7 @@
names = {'firstTiltThreshold [deg]', 'firstFlagThreshold [imosQCFlag]', 'secondTiltThreshold [deg]', 'secondFlagThreshold [imosQCFlag]'};
values = {firstTiltThreshold, firstFlagThreshold, secondTiltThreshold, secondFlagThreshold};
funcs = {isdeg, isvalidQC, isdeg, isvalidQC};
results = uiNumericalBox(names,values,funcs,'title','imosTiltVelositySetQC - Threshold Limits','panelTitle',matchedName);
results = uiNumericalBox(names,values,funcs,'title','imosTiltVelocitySetQC - Threshold Limits','panelTitle',matchedName);
[firstTiltThreshold,firstFlagThreshold,secondTiltThreshold,secondFlagThreshold] = results{:};
end

Expand Down
27 changes: 16 additions & 11 deletions AutomaticQC/imosTimeSeriesSpikeQC.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,23 @@

if (is_profile || time_missing), return, end

has_burst_duration = false;
has_burst_interval = false;
try
has_burst_duration = sample_data.meta.instrument_burst_duration;
has_burst_interval = sample_data.meta.instrument_burst_interval;
catch
try
has_burst_duration = sample_data.instrument_burst_duration;
has_burst_interval = sample_data.meta.instrument_burst_interval;
end

if isfield(sample_data.meta,'instrument_burst_duration')
burst_duration = sample_data.meta.instrument_burst_duration;
valid_burst_duration = ~isempty(burst_duration) && ~isnan(burst_duration) && burst_duration>0;
elseif isfield(sample_data,'instrument_burst_duration')
burst_duration = sample_data.meta.instrument_burst_duration;
valid_burst_duration = ~isempty(burst_duration) && ~isnan(burst_duration) && burst_duration>0;
end
has_burst = has_burst_duration || has_burst_interval;
if isfield(sample_data.meta,'instrument_burst_interval')
burst_interval = sample_data.meta.instrument_burst_interval;
valid_burst_interval = ~isempty(burst_interval) && ~isnan(burst_interval) && burst_interval>0;
elseif isfield(sample_data,'instrument_burst_interval')
burst_interval = sample_data.meta.instrument_burst_interval;
valid_burst_interval = ~isempty(burst_interval) && ~isnan(burst_interval) && burst_interval>0;
end

has_burst = (valid_burst_duration) || (valid_burst_interval);

if has_burst
opts_file = ['AutomaticQC' filesep 'imosTimeSeriesSpikeQCBurst.txt'];
Expand Down
Binary file modified Java/ddb.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions Parser/netcdfParse.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@
sample_data.meta.instrument_make = '';
sample_data.meta.instrument_model = '';
sample_data.meta.instrument_serial_no = '';
sample_data.meta.instrument_sample_interval = NaN;
sample_data.meta.instrument_burst_duration = NaN;
sample_data.meta.instrument_burst_interval = NaN;
sample_data.meta.instrument_sample_interval = '';
sample_data.meta.instrument_burst_duration = '';
sample_data.meta.instrument_burst_interval = '';
sample_data.meta.featureType = '';

%special names mappings
Expand Down
93 changes: 93 additions & 0 deletions Util/CellUtils/inCellPartialMatchString.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
function [is_complete, indexes] = inCellPartialMatchString(xcell,ycell,first_match_only)
% function [indexes,is_complete] = inCellPartialMatchString(xcell, ycell,first_match_only)
%
% Check if each string entry in ycell is within any string entry in xcell.
%
% If all the content of a ycell{n} string
% is found within the string of xcell{m}
% the m index is stored.
%
% For simple partial string matching, use the contains function
%
% See examples for usage.
%
% Inputs:
%
% xcell - a cell with items as strings.
% ycell - a string or another cell with items as strings.
% first_match_only - a boolean to skip subsequent matches of ycell in xcell.
% - Default: false
%
% Output:
%
% is_complete - a boolean to indicate that all ycell items
% were matched.
% indexes - a cell of indexes where matches occur in xcell.
%
%
% Example:
% % complete match
% xnames = {'a','ab','abc','123'};
% ynames = {'a','3'};
% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames);
% assert(is_complete)
% assert(isequal({1,2,3,4},indexes))
% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames,true);
% assert(is_complete)
% assert(isequal({1,4},indexes))
%
% % incomplete match
% xnames = {'a','b','c','123'};
% ynames = {'x','y','z','3'};
% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames);
% assert(~is_complete)
% assert(isequal({4},indexes))
%
% % no match
% xnames = {'x','y','z'};
% ynames = {'a','b','c'};
% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames);
% assert(~is_complete)
% assert(isequal({},indexes))

%
% author: [email protected]
%
narginchk(2, 3)
if nargin<3
first_match_only = false;
end

if ~iscell(ycell)
ycell = {ycell};
end

indexes = cell(1,numel(ycell)*numel(xcell));
ydetection = zeros(1,numel(ycell));

c = 0;
for k = 1:numel(ycell)
if ~ischar(ycell{k})
error('The second argument index `ycell{%d}` is not a string', k);
end
for kk = 1:length(xcell)
if ~ischar(xcell{kk})
error('The first argument index `xcell{%d}` is not a string', k);
end
if contains(xcell{kk},ycell{k})
c = c + 1;
indexes{c} = kk;
ydetection(k) = true;
if first_match_only
break
end
end
end
end

indexes = indexes(1:c);
if isempty(indexes)
indexes = {};
end
is_complete = all(ydetection);
end
12 changes: 6 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def find_matlab_rootpath(arch_str):

def run(command: str):
"""Run a command at shell/cmdline."""
proc = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE, shell=True, check=True)
return proc.stdout.decode("utf-8").strip(), proc.stderr.decode("utf-8").strip()
return sp.run(command, shell=True, check=True)


def create_java_call_sig_compile(root_path: str) -> str:
Expand Down Expand Up @@ -287,14 +286,15 @@ def write_version(afile: str, version: str) -> None:
print(repo_info)

print(f"Calling {java_call}..")
stdout, stderr = run(java_call)
if stderr:
ok = run(java_call)
if not ok:
raise Exception(f"{jcall} failed")

print(f"Calling {mcc_call}...")
for mcall in mcc_call:
stdout, stderr = run(mcall)
if stderr:
print(f"Executing {mcall}")
ok = run(mcall)
if not ok:
raise Exception(f"{mcall} failed")

print(f"The toolbox architecture is {ARCH_NAMES[arch]}.")
Expand Down
27 changes: 18 additions & 9 deletions imosToolbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function imosToolbox(auto, varargin)
%

% Set current toolbox version
toolboxVersion = ['2.6.7 - ' computer];
toolboxVersion = ['2.6.8 - ' computer];

if nargin == 0, auto = 'manual'; end

Expand All @@ -49,16 +49,25 @@ function imosToolbox(auto, varargin)
path = '';
if ~isdeployed
[path, ~, ~] = fileparts(which('imosToolbox.m'));

% set Matlab path for this session (add all recursive directories to Matlab
% path)
searchPath = textscan(genpath(path), '%s', 'Delimiter', pathsep);
searchPath = searchPath{1};
iPathToRemove = ~cellfun(@isempty, strfind(searchPath, [filesep '.']));
searchPath(iPathToRemove) = [];
searchPath = cellfun(@(x)([x pathsep]), searchPath, 'UniformOutput', false);
searchPath = [searchPath{:}];
addpath(searchPath);
addpath(fullfile(path,'Util/Path'));
addpath(fullfile(path,'Util/CellUtils'));
addpath(fullfile(path,'Util/Schema'));

[~,subfolders] = FilesInFolder(path);
ignored_subfolders = {'.git','.mypy_cache','imos-toolbox/snapshot','imos-toolbox/data','imos-toolbox/dist'};
[~,ignore_indexes] = inCellPartialMatchString(subfolders,ignored_subfolders);
valid_subfolders = popFromCell(subfolders,subfolders([ignore_indexes{:}]));

rmpath(fullfile(path,'Util/Path'));
rmpath(fullfile(path,'Util/CellUtils'));
rmpath(fullfile(path,'Util/Schema'));

cell_of_folders_strings = cellfun(@genpath,valid_subfolders,'UniformOutput',false);
all_folders_as_string= cat(2,cell_of_folders_strings{:});
addpath(path);
addpath(all_folders_as_string);
end
if isempty(path), path = pwd; end

Expand Down
Binary file modified imosToolbox_Linux64.bin
Binary file not shown.
Binary file modified imosToolbox_Win64.exe
Binary file not shown.

0 comments on commit 7b274d5

Please sign in to comment.