-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from ImperialCollegeLondon/vNext
Update software to v3.5.0
- Loading branch information
Showing
19 changed files
with
207 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
# App | ||
|
||
- Make sure to reset everything when "Reset" button is pressed | ||
|
||
# Software | ||
|
||
- Fix issue with exporting empty HK | ||
- Fix issue with plotting CPT data with no mode cycling information | ||
- Fix issue with `tiledlayout` spacing when tile indexing is column-major | ||
- Fix issue with naming HK close up figure | ||
- Make dependence on Parallel Computing Toolbox optional | ||
- Convert addition of missing row at end of file data into a processing step (`mag.process.Separate`) | ||
- Add `mag.process.Separate` to HK processing | ||
- Add export of whole science data | ||
- Fix issue with processing data ready time in `mag.process.Units` when not enough digits are present | ||
- Fix issue with plotting last event mode and range in `mag.graphics.view.HK` when data is cropped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
classdef Separate < mag.process.Step | ||
% SEPARATE Add row with missing data at end of tabular to separate | ||
% different files. Avoid continuous lines when gap between files is large. | ||
|
||
properties (Dependent) | ||
Name | ||
Description | ||
DetailedDescription | ||
end | ||
|
||
properties | ||
% DISCRIMINATIONVARIABLE Name of variable to increase in row. | ||
DiscriminationVariable (1, 1) string | ||
% VARIABLES Variables to be set to missing. | ||
Variables (1, :) string | ||
end | ||
|
||
methods | ||
|
||
function this = Separate(options) | ||
|
||
arguments | ||
options.?mag.process.Separate | ||
end | ||
|
||
this.assignProperties(options); | ||
end | ||
|
||
function value = get.Name(~) | ||
value = "Add Missing Row to Separate Files"; | ||
end | ||
|
||
function value = get.Description(this) | ||
value = "Add extra row with missing values for " + join(compose("""%s""", this.Variables), ", ") + "."; | ||
end | ||
|
||
function value = get.DetailedDescription(this) | ||
value = this.Description + " This is to avoid continuous lines when gap between files is large."; | ||
end | ||
|
||
function data = apply(this, data, ~) | ||
|
||
arguments | ||
this (1, 1) mag.process.Separate | ||
data tabular | ||
~ | ||
end | ||
|
||
if isequal(this.Variables, "*") | ||
|
||
locMissingCompatible = varfun(@this.isMissingCompatible, data, OutputFormat = "uniform"); | ||
variables = data.Properties.VariableNames(locMissingCompatible); | ||
|
||
variables(variables == this.DiscriminationVariable) = []; | ||
else | ||
variables = this.Variables; | ||
end | ||
|
||
finalRow = data(end, :); | ||
finalRow.(this.DiscriminationVariable) = finalRow.(this.DiscriminationVariable) + eps(); | ||
finalRow{:, variables} = missing(); | ||
|
||
data = [data; finalRow]; | ||
end | ||
end | ||
|
||
methods (Static, Access = private) | ||
|
||
function tf = isMissingCompatible(x) | ||
tf = isa(x, "single") | isa(x, "double") | isa(x, "duration") | isa(x, "calendarDuration") | isa(x, "datetime") | isa(x, "categorical") | isa(x, "string"); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function tf = useParallel() | ||
% USEPARALLEL Determine whether to use Parallel Computing Toolbox to | ||
% process data. Does not require Parallel Computing Toolbox to run. | ||
|
||
tf = license("test", "Distrib_Computing_Toolbox") && ~isempty(gcp("nocreate")); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
classdef tSeparate < MAGAnalysisTestCase | ||
% TSEPARATE Unit tests for "mag.process.Separate" classes. | ||
|
||
methods (Test) | ||
|
||
% Test that adding separation row with specific variables only | ||
% applies to those variables. | ||
function namedVariables(testCase) | ||
|
||
% Set up. | ||
data = testCase.createTestData(); | ||
|
||
missingVariables = ["Doubles", "Strings"]; | ||
nonMissingVariables = setdiff(data.Properties.VariableNames, missingVariables); | ||
|
||
% Exercise. | ||
separateStep = mag.process.Separate(DiscriminationVariable = "Discriminator", Variables = missingVariables); | ||
processedData = separateStep.apply(data); | ||
|
||
% Verify. | ||
testCase.assertSize(processedData, [height(data) + 1, width(data)], "Separation row should have been added."); | ||
|
||
testCase.verifyTrue(all(ismissing(processedData(end, missingVariables))), "Selected variables should be missing."); | ||
testCase.verifyFalse(any(ismissing(processedData(end, nonMissingVariables))), "Other variables should not be missing."); | ||
|
||
testCase.verifyGreaterThanOrEqual(data{end, "Discriminator"}, processedData{end, "Discriminator"}, "Discrimination variable should be increased."); | ||
end | ||
|
||
% Test that adding separation row with all variables only | ||
% applies to variables that support . | ||
function allVariables(testCase) | ||
|
||
% Set up. | ||
data = testCase.createTestData(); | ||
|
||
nonMissingVariables = ["Integers", "Logicals", "Discriminator"]; | ||
missingVariables = setdiff(data.Properties.VariableNames, nonMissingVariables); | ||
|
||
% Exercise. | ||
separateStep = mag.process.Separate(DiscriminationVariable = "Discriminator", Variables = "*"); | ||
processedData = separateStep.apply(data); | ||
|
||
% Verify. | ||
testCase.assertSize(processedData, [height(data) + 1, width(data)], "Separation row should have been added."); | ||
|
||
testCase.verifyTrue(all(ismissing(processedData(end, missingVariables))), "Selected variables should be missing."); | ||
testCase.verifyFalse(any(ismissing(processedData(end, nonMissingVariables))), "Other variables should not be missing."); | ||
|
||
testCase.verifyGreaterThanOrEqual(data{end, "Discriminator"}, processedData{end, "Discriminator"}, "Discrimination variable should be increased."); | ||
end | ||
end | ||
|
||
methods (Static, Access = protected) | ||
|
||
function data = createTestData() | ||
|
||
data = table(ones(3, 1), ones(3, 1, "uint32"), minutes([3; 2; 1]), true(3, 1), [datetime("yesterday"); datetime("today"); datetime("now")], ["A"; "B"; "C"], [1; 2; 3], ... | ||
VariableNames = ["Doubles", "Integers", "Durations", "Logicals", "Dates", "Strings", "Discriminator"]); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
classdef tUseParallel < matlab.unittest.TestCase | ||
% TUSEPARALLEL Unit tests for "mag.internal.useParallel" function. | ||
|
||
methods (Test) | ||
|
||
% Test that "mag.internal.useParallel" returns "false" when no | ||
% parallel pool is set up. | ||
function noParallelPool(testCase) | ||
testCase.verifyFalse(mag.internal.useParallel(), "Parallel Computing Toolbox should not be used if it is not installed."); | ||
end | ||
|
||
% Test that "mag.internal.useParallel" returns "false" when | ||
% Parallel Computing Toolbox is not installed. | ||
function noParallelToolbox(testCase) | ||
|
||
license("test", "Distrib_Computing_Toolbox", "disable"); | ||
testCase.addTeardown(@() license("test", "Distrib_Computing_Toolbox", "enable")); | ||
|
||
testCase.verifyFalse(mag.internal.useParallel(), "Parallel Computing Toolbox should not be used if it is not installed."); | ||
end | ||
end | ||
end |