Skip to content

Commit d368b9f

Browse files
[NET-161] Remove "Import nla.*" from functions (#14)
* removed as many import nla.* as I could find and attempted to wrap lines longer than 120 * Exported mlapp files * found a few places for nla.helpers * fixed some missed imports --------- Co-authored-by: Github Action <action@github.com>
1 parent 0be0727 commit d368b9f

85 files changed

Lines changed: 706 additions & 657 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

+nla/+edge/+result/Base.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
methods
1717
function obj = Base(size, prob_max)
18-
import nla.* % required due to matlab package system quirks
18+
import nla.TriMatrix
19+
1920
if nargin ~= 0
2021
obj.coeff = TriMatrix(size);
2122
obj.prob = TriMatrix(size);
@@ -25,7 +26,6 @@
2526
end
2627

2728
function output(obj, net_atlas, flags, prob_label)
28-
import nla.* % required due to matlab package system quirks
2929

3030
coeff_label = sprintf('Edge-level %s', obj.coeff_name);
3131
prob_label_appended = '';
@@ -34,8 +34,8 @@ function output(obj, net_atlas, flags, prob_label)
3434
prob_label_appended = sprintf(' (%s)', obj.behavior_name);
3535
end
3636

37-
fig = gfx.createFigure();
38-
matrix_plot = gfx.plots.MatrixPlot(fig, coeff_label, obj.coeff, net_atlas.nets, gfx.FigSize.LARGE, 'lower_limit', obj.coeff_range(1),...
37+
fig = nla.gfx.createFigure();
38+
matrix_plot = nla.gfx.plots.MatrixPlot(fig, coeff_label, obj.coeff, net_atlas.nets, nla.gfx.FigSize.LARGE, 'lower_limit', obj.coeff_range(1),...
3939
'upper_limit', obj.coeff_range(2));
4040
matrix_plot.displayImage();
4141
w = matrix_plot.image_dimensions("image_width");
@@ -45,7 +45,7 @@ function output(obj, net_atlas, flags, prob_label)
4545
if ~exist('prob_label', 'var')
4646
prob_label = [sprintf('Edge-level Significance (P < %g)', obj.prob_max), prob_label_appended];
4747
end
48-
matrix_plot2 = gfx.plots.MatrixPlot(fig, prob_label, obj.prob_sig, net_atlas.nets, gfx.FigSize.LARGE,...
48+
matrix_plot2 = nla.gfx.plots.MatrixPlot(fig, prob_label, obj.prob_sig, net_atlas.nets, nla.gfx.FigSize.LARGE,...
4949
'draw_legend', false, 'draw_colorbar', false, 'color_map', [[1,1,1];[0,0,0]], 'x_position', w, 'lower_limit', 0, 'upper_limit', 1);
5050
w2 = matrix_plot2.image_dimensions("image_width");
5151
h2 = matrix_plot2.image_dimensions("image_height");
@@ -58,7 +58,7 @@ function output(obj, net_atlas, flags, prob_label)
5858
%prob_log.v = -1 * log10(obj.prob.v);
5959
cm_base = parula(1000);
6060
cm = flip(cm_base(ceil(logspace(-3, 0, 256) .* 1000), :));
61-
matrix_plot2 = gfx.plots.MatrixPlot(fig, prob_label, obj.prob, net_atlas.nets, gfx.FigSize.LARGE,...
61+
matrix_plot2 = nla.gfx.plots.MatrixPlot(fig, prob_label, obj.prob, net_atlas.nets, nla.gfx.FigSize.LARGE,...
6262
'draw_legend', false, 'color_map', cm, 'x_position', w, 'lower_limit', 0, 'upper_limit', 1);
6363
w2 = matrix_plot2.image_dimensions("image_width");
6464
h2 = matrix_plot2.image_dimensions("image_height");

+nla/+edge/+result/Precalculated.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
methods
55
function obj = Precalculated(size, prob_max)
6-
import nla.* % required due to matlab package system quirks
7-
% hack because superclass constructor can't be optional??
86
if nargin == 0
97
size = 2;
108
prob_max = -1;

+nla/+edge/+result/WelchT.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
methods
99
function obj = WelchT(size, prob_max, group_names)
10-
import nla.* % required due to matlab package system quirks
11-
% hack because superclass constructor can't be optional??
1210
if nargin == 0
1311
size = 2;
1412
prob_max = -1;
@@ -18,7 +16,7 @@
1816
obj@nla.edge.result.Base(size, prob_max);
1917

2018
if nargin ~= 0
21-
obj.dof = TriMatrix(size);
19+
obj.dof = nla.TriMatrix(size);
2220
obj.behavior_name = sprintf("%s > %s", group_names{1}, group_names{2});
2321
obj.coeff_range = [-3 3];
2422
end

+nla/+edge/+test/KendallB.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77

88
methods
99
function obj = KendallB()
10-
import nla.* % required due to matlab package system quirks
1110
obj@nla.edge.BaseTest();
1211
end
1312

1413
function result = run(obj, input_struct)
15-
import nla.* % required due to matlab package system quirks
16-
[tau_vec, p_vec] = mex.run('kendallTauB', input_struct.behavior, input_struct.func_conn.v');
14+
[tau_vec, p_vec] = nla.mex.run('kendallTauB', input_struct.behavior, input_struct.func_conn.v');
1715
result = obj.composeResult(input_struct.net_atlas, tau_vec', p_vec', input_struct.prob_max);
1816
end
1917
end

+nla/+edge/+test/Pearson.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
methods
99
function obj = Pearson()
10-
import nla.* % required due to matlab package system quirks
1110
obj@nla.edge.BaseTest();
1211
end
1312

+nla/+edge/+test/Precalculated.m

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
methods
99
function obj = Precalculated()
10-
import nla.* % required due to matlab package system quirks
1110
obj@nla.edge.BaseTest();
1211
end
1312

@@ -31,10 +30,19 @@
3130

3231
methods (Static)
3332
function inputs = requiredInputs()
34-
import nla.* % required due to matlab package system quirks
35-
npairs_x_nperms = [inputField.DimensionType.NROIPAIRS, inputField.DimensionType.NPERMS];
36-
npairs_x_1 = [inputField.DimensionType.NROIPAIRS, 1];
37-
inputs = {inputField.NumberWithoutDefault('coeff_min', 'Coeff minimum', -Inf, Inf), inputField.NumberWithoutDefault('coeff_max', 'Coeff maximum', -Inf, Inf), inputField.NetworkAtlas(), inputField.EdgeLevelMatrix('precalc_obs_p', 'Precalculated observed significance (thresholded p-value)', npairs_x_1), inputField.EdgeLevelMatrix('precalc_obs_coeff', 'Precalculated observed coeff', npairs_x_1), inputField.EdgeLevelMatrix('precalc_perm_p', 'Precalculated permuted significance (thresholded p-value)', npairs_x_nperms), inputField.EdgeLevelMatrix('precalc_perm_coeff', 'Precalculated permuted coeff', npairs_x_nperms)};
33+
import nla.inputField.DimensionType nla.inputField.NumberWithoutDefault nla.inputField.EdgeLevelMatrix
34+
35+
npairs_x_nperms = [DimensionType.NROIPAIRS,DimensionType.NPERMS];
36+
npairs_x_1 = [DimensionType.NROIPAIRS, 1];
37+
inputs = {...
38+
NumberWithoutDefault('coeff_min', 'Coeff minimum', -Inf, Inf),...
39+
NumberWithoutDefault('coeff_max', 'Coeff maximum', -Inf, Inf),...
40+
inputField.NetworkAtlas(),...
41+
EdgeLevelMatrix('precalc_obs_p', 'Precalculated observed significance (thresholded p-value)', npairs_x_1),...
42+
EdgeLevelMatrix('precalc_obs_coeff', 'Precalculated observed coeff', npairs_x_1),...
43+
EdgeLevelMatrix('precalc_perm_p', 'Precalculated permuted significance (thresholded p-value)', npairs_x_nperms),...
44+
EdgeLevelMatrix('precalc_perm_coeff', 'Precalculated permuted coeff', npairs_x_nperms)...
45+
};
3846
end
3947
end
4048
end

+nla/+edge/+test/Spearman.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
methods
99
function obj = Spearman()
10-
import nla.* % required due to matlab package system quirks
1110
obj@nla.edge.BaseTest();
1211
end
1312

+nla/+edge/+test/SpearmanEstimator.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121

2222
methods
2323
function obj = SpearmanEstimator()
24-
import nla.* % required due to matlab package system quirks
2524
obj@nla.edge.BaseTest();
2625
end
2726

2827
function result = run(obj, input_struct)
29-
import nla.* % required due to matlab package system quirks
3028
%% input
3129
y = input_struct.func_conn.v';
3230

@@ -78,7 +76,7 @@
7876
ok = (abs(rho_vec) < 1);
7977
t(ok) = rho_vec(ok) .* sqrt((n - 2) ./ (1 - rho_vec(ok) .^ 2));
8078

81-
result = obj.composeResult(input_struct.net_atlas, fisherR2Z(rho_vec), (2 * tcdf(-abs(t), n - 2)), input_struct.prob_max);
79+
result = obj.composeResult(input_struct.net_atlas, nla.fisherR2Z(rho_vec), (2 * tcdf(-abs(t), n - 2)), input_struct.prob_max);
8280
end
8381
end
8482
end

+nla/+edge/+test/WelchT.m

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99

1010
methods
1111
function obj = WelchT()
12-
import nla.* % required due to matlab package system quirks
1312
obj@nla.edge.BaseTest();
1413
end
1514

1615
function result = run(obj, input_struct)
17-
import nla.* % required due to matlab package system quirks
1816
% This function calculates the t-test between 2 sets of data using the
1917
% Welch method that does not assume equal mean or variance or samples. The
2018
% function returns the t-statistic, p-value, and degrees of freedom.
@@ -48,17 +46,16 @@
4846

4947
methods (Static)
5048
function inputs = requiredInputs()
51-
import nla.* % required due to matlab package system quirks
5249
inputs = requiredInputs@nla.edge.BaseTest();
5350

5451
% disable adding/modifying covariates in behavior
55-
behavior_handle = helpers.firstInstanceOfClass(inputs, 'nla.inputField.Behavior');
52+
behavior_handle = nla.helpers.firstInstanceOfClass(inputs, 'nla.inputField.Behavior');
5653
behavior_handle.covariates_enabled = nla.inputField.CovariatesEnabled.ONLY_FC;
5754

58-
inputs{end + 1} = inputField.String('group1_name', 'Group 1 name:', 'Group1');
59-
inputs{end + 1} = inputField.Number('group1_val', 'Group 1 behavior value:', -Inf, 1, Inf);
60-
inputs{end + 1} = inputField.String('group2_name', 'Group 2 name:', 'Group2');
61-
inputs{end + 1} = inputField.Number('group2_val', 'Group 2 behavior value:', -Inf, 0, Inf);
55+
inputs{end + 1} = nla.inputField.String('group1_name', 'Group 1 name:', 'Group1');
56+
inputs{end + 1} = nla.inputField.Number('group1_val', 'Group 1 behavior value:', -Inf, 1, Inf);
57+
inputs{end + 1} = nla.inputField.String('group2_name', 'Group 2 name:', 'Group2');
58+
inputs{end + 1} = nla.inputField.Number('group2_val', 'Group 2 behavior value:', -Inf, 0, Inf);
6259
end
6360
end
6461
end

+nla/+edge/BaseTest.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
methods
99
function obj = BaseTest()
10-
import nla.* % required due to matlab package system quirks
1110
end
1211
end
1312

@@ -33,8 +32,8 @@
3332

3433
methods (Static)
3534
function inputs = requiredInputs()
36-
import nla.* % required due to matlab package system quirks
37-
inputs = {inputField.Number('prob_max', 'Edge-level P threshold <', 0, 0.05, 1), inputField.NetworkAtlasFuncConn(), inputField.Behavior()};
35+
inputs = {nla.inputField.Number('prob_max', 'Edge-level P threshold <', 0, 0.05, 1),...
36+
nla.inputField.NetworkAtlasFuncConn(), nla.inputField.Behavior()};
3837
end
3938
end
4039
end

0 commit comments

Comments
 (0)