Skip to content

Commit 8efa7b6

Browse files
committed
merge with dev
2 parents 09a132b + dbb0b93 commit 8efa7b6

10 files changed

Lines changed: 52 additions & 18 deletions

+nla/+net/+result/NetworkResultPlotParameter.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
significance_type = "nla.gfx.SigType.DECREASING";
8080
% determine colormap and operate on values if it's -log10
8181
switch obj.updated_test_options.prob_plot_method
82-
case "nla.gfx.ProbPlotMethod.LOG"
82+
case "LOG" % FUCK Matlab and their enums
8383
color_map = nla.net.result.NetworkResultPlotParameter.getLogColormap(obj.default_discrete_colors,...
8484
statistic_input, p_value_max);
8585
% Here we take a -log10 and change the maximum value to show on the plot
86-
case "nla.gfx.ProbPlotMethod.NEGATIVE_LOG_10"
86+
case "NEGATIVE_LOG_10"
8787
color_map = parula(obj.default_discrete_colors);
8888

8989
statistic_matrix = nla.TriMatrix(obj.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);

+nla/+net/unittests/NetworkResultPlotParameterTestCase.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function plotProbabilityParametersDefaultPlottingTest(testCase)
9898
expected_plot = nla.TriMatrix(plot_parameters.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);
9999
expected_plot.v = permutation_result.full_connectome.(strcat("uncorrected_", probability)).v .*...
100100
(plot_parameters.default_discrete_colors / (plot_parameters.default_discrete_colors + 1));
101-
expected_significance_type = nla.gfx.SigType.DECREASING;
101+
expected_significance_type = "nla.gfx.SigType.DECREASING"; % Supposedly this evaluates as a string without the quotes, but NOPE
102102
expected_color_map = [flip(parula(plot_parameters.default_discrete_colors)); [1 1 1]];
103103

104104
testCase.verifyEqual(expected_p_value_max, probability_parameters.p_value_plot_max);
@@ -126,19 +126,23 @@ function plotProbabilityParametersLogPlottingTest(testCase)
126126
expected_plot = nla.TriMatrix(plot_parameters.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);
127127
expected_plot.v = permutation_result.full_connectome.(strcat("uncorrected_", probability)).v .*...
128128
(plot_parameters.default_discrete_colors / (plot_parameters.default_discrete_colors + 1));
129-
expected_significance_type = nla.gfx.SigType.DECREASING;
129+
expected_significance_type = "nla.gfx.SigType.DECREASING";
130130

131131
expected_log_minimum = log10(min(nonzeros(permutation_result.full_connectome.(strcat("uncorrected_", probability)).v)));
132132
expected_log_minimum = max([-40, expected_log_minimum]);
133133
color_map_base = parula(plot_parameters.default_discrete_colors);
134134
expected_color_map = flip(color_map_base(ceil(logspace(expected_log_minimum, 0, plot_parameters.default_discrete_colors) .*...
135135
plot_parameters.default_discrete_colors), :));
136-
expected_color_map = [expected_color_map; [1 1 1]];
136+
if expected_p_value_max ~= 0
137+
expected_color_map = [expected_color_map; [1 1 1]];
138+
else
139+
expected_color_map = [1 1 1];
140+
end
137141

138142
testCase.verifyEqual(expected_p_value_max, probability_parameters.p_value_plot_max);
139143
testCase.verifyEqual(expected_plot.v, probability_parameters.statistic_plot_matrix.v);
140144
testCase.verifyEqual(expected_significance_type, probability_parameters.significance_type);
141-
testCase.verifyEqual(expected_color_map, probability_parameters.color_map);
145+
testCase.verifyEqual(expected_color_map, probability_parameters.color_map)
142146
end
143147

144148
function plotProbabilityParametersNegLogTest(testCase)
@@ -159,7 +163,7 @@ function plotProbabilityParametersNegLogTest(testCase)
159163
expected_p_value_max = 2;
160164
expected_plot = nla.TriMatrix(plot_parameters.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);
161165
expected_plot.v = -log10(permutation_result.full_connectome.(strcat("uncorrected_", probability)).v);
162-
expected_significance_type = nla.gfx.SigType.INCREASING;
166+
expected_significance_type = "nla.gfx.SigType.INCREASING";
163167
expected_color_map = parula(plot_parameters.default_discrete_colors);
164168

165169
testCase.verifyEqual(expected_p_value_max, probability_parameters.p_value_plot_max);

+nla/unittests/TestPoolTest.m

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,43 @@ function spearmanEdgeTest(testCase)
7070
edge_result = testCase.tests.runEdgeTestPerm(testCase.edge_test_options, testCase.permutations, 0);
7171

7272
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "spearman_result.mat")));
73-
testCase.verifyEqual(expected_result.edge_result, edge_result);
73+
property_names = properties(edge_result);
74+
for prop_name = property_names
75+
testCase.verifyEqual(expected_result.edge_result.(prop_name{1}), edge_result.(prop_name{1}));
76+
end
7477
end
7578

7679
function pearsonEdgeTest(testCase)
7780
testCase.tests.edge_test = nla.edge.test.Pearson();
7881
edge_result = testCase.tests.runEdgeTestPerm(testCase.edge_test_options, testCase.permutations, 0);
7982

8083
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "pearson_result.mat")));
81-
testCase.verifyEqual(expected_result.edge_result, edge_result);
84+
property_names = properties(edge_result);
85+
for prop_name = property_names
86+
testCase.verifyEqual(expected_result.edge_result.(prop_name{1}), edge_result.(prop_name{1}));
87+
end
8288
end
8389

8490
function kendallBTest(testCase)
8591
testCase.tests.edge_test = nla.edge.test.KendallB();
8692
edge_result = testCase.tests.runEdgeTestPerm(testCase.edge_test_options, testCase.permutations, 0);
8793

8894
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "kendallb_result.mat")));
89-
testCase.verifyEqual(expected_result.edge_result, edge_result);
95+
property_names = properties(edge_result);
96+
for prop_name = property_names
97+
testCase.verifyEqual(expected_result.edge_result.(prop_name{1}), edge_result.(prop_name{1}));
98+
end
9099
end
91100

92101
function spearmanEstimatorTest(testCase)
93102
testCase.tests.edge_test = nla.edge.test.SpearmanEstimator();
94103
edge_result = testCase.tests.runEdgeTestPerm(testCase.edge_test_options, testCase.permutations, 0);
95104

96105
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "spearman_estimator_result.mat")));
97-
testCase.verifyEqual(expected_result.edge_result, edge_result);
106+
property_names = properties(edge_result);
107+
for prop_name = property_names
108+
testCase.verifyEqual(expected_result.edge_result.(prop_name{1}), edge_result.(prop_name{1}));
109+
end
98110
end
99111

100112
function chiSquaredTest(testCase)
@@ -103,7 +115,10 @@ function chiSquaredTest(testCase)
103115
network_result = testCase.tests.runNetTestsPerm(testCase.network_test_options, testCase.edge_test_options.net_atlas, edge_result.edge_result);
104116

105117
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "chi_squared_result.mat")));
106-
testCase.verifyEqual(expected_result.network_result, network_result{1});
118+
property_names = properties(network_result{1});
119+
for prop_name = property_names
120+
testCase.verifyEqual(expected_result.network_result.(prop_name{1}), network_result{1}.(prop_name{1}));
121+
end
107122
end
108123

109124
function hyperGeometricTest(testCase)
@@ -112,7 +127,10 @@ function hyperGeometricTest(testCase)
112127
network_result = testCase.tests.runNetTestsPerm(testCase.network_test_options, testCase.edge_test_options.net_atlas, edge_result.edge_result);
113128

114129
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "hypergeometric_result.mat")));
115-
testCase.verifyEqual(expected_result.network_result, network_result{1});
130+
property_names = properties(network_result{1});
131+
for prop_name = property_names
132+
testCase.verifyEqual(expected_result.network_result.(prop_name{1}), network_result{1}.(prop_name{1}));
133+
end
116134
end
117135

118136
function kolmogorovSmirnovTest(testCase)
@@ -121,7 +139,10 @@ function kolmogorovSmirnovTest(testCase)
121139
network_result = testCase.tests.runNetTestsPerm(testCase.network_test_options, testCase.edge_test_options.net_atlas, edge_result.edge_result);
122140

123141
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "kolmogorov_smirnov_result.mat")));
124-
testCase.verifyEqual(expected_result.network_result, network_result{1});
142+
property_names = properties(network_result{1});
143+
for prop_name = property_names
144+
testCase.verifyEqual(expected_result.network_result.(prop_name{1}), network_result{1}.(prop_name{1}));
145+
end
125146
end
126147

127148
function studentTTest(testCase)
@@ -130,7 +151,10 @@ function studentTTest(testCase)
130151
network_result = testCase.tests.runNetTestsPerm(testCase.network_test_options, testCase.edge_test_options.net_atlas, edge_result.edge_result);
131152

132153
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "student_t_result.mat")));
133-
testCase.verifyEqual(expected_result.network_result, network_result{1});
154+
property_names = properties(network_result{1});
155+
for prop_name = property_names
156+
testCase.verifyEqual(expected_result.network_result.(prop_name{1}), network_result{1}.(prop_name{1}));
157+
end
134158
end
135159

136160
function welchTTest(testCase)
@@ -139,7 +163,10 @@ function welchTTest(testCase)
139163
network_result = testCase.tests.runNetTestsPerm(testCase.network_test_options, testCase.edge_test_options.net_atlas, edge_result.edge_result);
140164

141165
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "welch_t_result.mat")));
142-
testCase.verifyEqual(expected_result.network_result, network_result{1});
166+
property_names = properties(network_result{1});
167+
for prop_name = property_names
168+
testCase.verifyEqual(expected_result.network_result.(prop_name{1}), network_result{1}.(prop_name{1}));
169+
end
143170
end
144171

145172
function wilcoxonTest(testCase)
@@ -148,7 +175,10 @@ function wilcoxonTest(testCase)
148175
network_result = testCase.tests.runNetTestsPerm(testCase.network_test_options, testCase.edge_test_options.net_atlas, edge_result.edge_result);
149176

150177
expected_result = load(strcat(testCase.root_path, fullfile("+nla", "unittests", "wilocoxon_result.mat")));
151-
testCase.verifyEqual(expected_result.network_result, network_result{1});
178+
property_names = properties(network_result{1});
179+
for prop_name = property_names
180+
testCase.verifyEqual(expected_result.network_result.(prop_name{1}), network_result{1}.(prop_name{1}));
181+
end
152182
end
153183
end
154184
end
-6 Bytes
Binary file not shown.
-559 Bytes
Binary file not shown.
1 Byte
Binary file not shown.
-1 Bytes
Binary file not shown.

+nla/unittests/welch_t_result.mat

-1 Bytes
Binary file not shown.
-6 Bytes
Binary file not shown.

NLAResult_exported.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ function SaveSummaryTableButtonPushed(app, event)
583583
prog = uiprogressdlg(app.UIFigure, 'Title', 'Saving summary table', 'Message', sprintf('Saving to %s', file), 'Indeterminate', true);
584584
drawnow;
585585

586-
app.results.saveSummaryTable([path file]);
586+
app.results.SaveSummaryTableMenu([path file]);
587587

588588
close(prog);
589589
end

0 commit comments

Comments
 (0)