Skip to content

Commit

Permalink
Merge pull request #74 from ImperialCollegeLondon/dev
Browse files Browse the repository at this point in the history
Update software to v4.6.1
  • Loading branch information
mfacchinelli authored Sep 3, 2024
2 parents 0422e02 + 8f74c13 commit 274562a
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 135 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
release: ${{ matrix.release }}
products: Signal_Processing_Toolbox Statistics_and_Machine_Learning_Toolbox Text_Analytics_Toolbox
- name: Run tests
uses: matlab-actions/run-build@v2.4.1
uses: matlab-actions/run-build@v2.5.0
with:
tasks: check test
- name: Report results
Expand All @@ -46,7 +46,7 @@ jobs:
if: github.ref == 'refs/heads/main'
needs: test
env:
VERSION: "4.6.0"
VERSION: "4.6.1"
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -55,11 +55,11 @@ jobs:
with:
release: R2023b
- name: Package toolbox
uses: matlab-actions/run-build@v2.4.1
uses: matlab-actions/run-build@v2.5.0
with:
tasks: package("${{ env.VERSION }}")
- name: Upload toolbox
uses: actions/upload-artifact@v4.3.6
uses: actions/upload-artifact@v4.4.0
with:
name: 'MAG Data Visualization.mltbx'
path: artifacts
Expand Down
5 changes: 1 addition & 4 deletions resources/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Software

- Add comparison view `mag.graphics.view.Comparison` for comparing science, I-ALiRT and SID5 data
- Add `RangeVariable` as option in `mag.process.Calibration`
- Improve management of compression in `mag.process.SignedInteger`
- Fix issues with processing of SID5 data (signedness, calibration)
- Remove `mag.graphics.view.IALiRT` in favor of `mag.graphics.view.Comparison`
123 changes: 97 additions & 26 deletions src/visualize/+mag/+graphics/+view/Comparison.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,83 @@ function visualize(this)
[primarySensor, secondarySensor] = this.getSensorNames();
sid5HK = this.getHKType("SCI");

if isempty(this.Results.HasData) || (isempty(this.Results.IALiRT) || ~this.Results.IALiRT.HasData) || (isempty(sid5HK) || ~sid5HK.HasData)
return;
end

primaryScience = this.Results.Primary;
secondaryScience = this.Results.Secondary;

primaryIALiRT = this.Results.IALiRT.Primary;
secondaryIALiRT = this.Results.IALiRT.Secondary;

primaryData = this.combineDataSources(primaryScience, primaryIALiRT, sid5HK, "FOB");
secondaryData = this.combineDataSources(secondaryScience, secondaryIALiRT, sid5HK, "FIB");

primaryCharts = this.generateComparisonGraph(primarySensor, "left");
secondaryCharts = this.generateComparisonGraph(secondarySensor, "right");

this.Figures = this.Factory.assemble( ...
primaryData, ...
primaryCharts, ...
secondaryData, ...
secondaryCharts, ...
Title = "Science Sources Comparison", ...
Name = "Science - I-AliRT - SID5 Comparison", ...
GlobalLegend = ["Science", "I-ALiRT", "SID5"], ...
Arrangement = [3, 2], ...
TileIndexing = "columnmajor", ...
LinkXAxes = true, ...
WindowState = "maximized");
hasScience = ~isempty(this.Results.HasData);
hasIALiRT = ~isempty(this.Results.IALiRT) && this.Results.IALiRT.HasData;
hasSID5 = ~isempty(sid5HK) && sid5HK.HasData;

if hasScience && hasIALiRT && hasSID5

primaryIALiRT = this.Results.IALiRT.Primary;
secondaryIALiRT = this.Results.IALiRT.Secondary;

primaryData = this.combineDataSources(primaryScience, primaryIALiRT, sid5HK, "FOB");
secondaryData = this.combineDataSources(secondaryScience, secondaryIALiRT, sid5HK, "FIB");

primaryCharts = this.generateOverlayGraph(primarySensor, "left");
secondaryCharts = this.generateOverlayGraph(secondarySensor, "right");

this.Figures(end + 1) = this.Factory.assemble( ...
primaryData, ...
primaryCharts, ...
secondaryData, ...
secondaryCharts, ...
Title = "Science Sources Comparison", ...
Name = "Science - I-AliRT - SID5 Comparison", ...
GlobalLegend = ["Science", "I-ALiRT", "SID5"], ...
Arrangement = [3, 2], ...
TileIndexing = "columnmajor", ...
LinkXAxes = true, ...
WindowState = "maximized");
end

if hasIALiRT

primaryIALiRT = this.Results.IALiRT.Primary;
secondaryIALiRT = this.Results.IALiRT.Secondary;

primaryIALiRTComparison = synchronize(timetable(primaryIALiRT.Time, primaryIALiRT.X, primaryIALiRT.Y, primaryIALiRT.Z, primaryIALiRT.Quality.isPlottable(), VariableNames = ["xc", "yc", "zc", "qc"]), ...
timetable(primaryScience.Time, primaryScience.X, primaryScience.Y, primaryScience.Z, primaryScience.Quality.isPlottable(), VariableNames = ["xs", "ys", "zs", "qs"]), "first", "nearest");
secondaryIALiRTComparison = synchronize(timetable(secondaryIALiRT.Time, secondaryIALiRT.X, secondaryIALiRT.Y, secondaryIALiRT.Z, secondaryIALiRT.Quality.isPlottable(), VariableNames = ["xc", "yc", "zc", "qc"]), ...
timetable(secondaryScience.Time, secondaryScience.X, secondaryScience.Y, secondaryScience.Z, secondaryScience.Quality.isPlottable(), VariableNames = ["xs", "ys", "zs", "qs"]), "first", "nearest");

primaryGraphs = this.generateComparisonGraph(primaryIALiRTComparison, "left");
secondaryGraphs = this.generateComparisonGraph(secondaryIALiRTComparison, "right");

this.Figures(end + 1) = this.Factory.assemble( ...
primaryIALiRTComparison, primaryGraphs, secondaryIALiRTComparison, secondaryGraphs, ...
Name = "Science vs. I-ALiRT (Closest Vector)", ...
Arrangement = [9, 2], ...
GlobalLegend = ["Science", "I-ALiRT"], ...
LinkXAxes = true, ...
TileIndexing = "columnmajor", ...
WindowState = "maximized");
end

if hasSID5

sid5HK.Data(ismissing(sid5HK.FOBT), :) = [];
sid5HK.Data(ismissing(sid5HK.FIBT), :) = [];

primarySID5Comparison = synchronize(timetable(sid5HK.FOBT, sid5HK.FOBX, sid5HK.FOBY, sid5HK.FOBZ, true(height(sid5HK.Data), 1), VariableNames = ["xc", "yc", "zc", "qc"]), ...
timetable(primaryScience.Time, primaryScience.X, primaryScience.Y, primaryScience.Z, primaryScience.Quality.isPlottable(), VariableNames = ["xs", "ys", "zs", "qs"]), "first", "nearest");
secondarySID5Comparison = synchronize(timetable(sid5HK.FIBT, sid5HK.FIBX, sid5HK.FIBY, sid5HK.FIBZ, true(height(sid5HK.Data), 1), VariableNames = ["xc", "yc", "zc", "qc"]), ...
timetable(secondaryScience.Time, secondaryScience.X, secondaryScience.Y, secondaryScience.Z, secondaryScience.Quality.isPlottable(), VariableNames = ["xs", "ys", "zs", "qs"]), "first", "nearest");

primaryGraphs = this.generateComparisonGraph(primarySID5Comparison, "left");
secondaryGraphs = this.generateComparisonGraph(secondarySID5Comparison, "right");

this.Figures(end + 1) = this.Factory.assemble( ...
primarySID5Comparison, primaryGraphs, secondarySID5Comparison, secondaryGraphs, ...
Name = "Science vs. SID5 (Closest Vector)", ...
Arrangement = [9, 2], ...
GlobalLegend = ["Science", "SID5"], ...
LinkXAxes = true, ...
TileIndexing = "columnmajor", ...
WindowState = "maximized");
end
end
end

Expand Down Expand Up @@ -81,7 +130,7 @@ function visualize(this)
data = outerjoin(data, sid5);
end

function charts = generateComparisonGraph(sensorName, yAxisLocation)
function charts = generateOverlayGraph(sensorName, yAxisLocation)

arguments (Input)
sensorName (1, 1) string
Expand All @@ -103,5 +152,27 @@ function visualize(this)

charts(1).Title = sensorName;
end

function charts = generateComparisonGraph(comparisonData, yAxisLocation)

arguments (Input)
comparisonData timetable
yAxisLocation (1, 1) string {mustBeMember(yAxisLocation, ["left", "right"])}
end

arguments (Output)
charts (1, 6) mag.graphics.style.Default
end

defaultColors = colororder();

charts = [ ...
mag.graphics.style.Default(YLabel = "x [nT]", YAxisLocation = yAxisLocation, Layout = [2, 1], Charts = [mag.graphics.chart.Plot(YVariables = "xs", Marker = "o", Filter = comparisonData.qs), mag.graphics.chart.Plot(YVariables = "xc", Marker = "x", Filter = comparisonData.qc)]), ...
mag.graphics.style.Default(YLabel = "\Deltax [nT]", YAxisLocation = yAxisLocation, Charts = mag.graphics.chart.Plot(YVariables = mag.graphics.operation.Subtract(Minuend = "xs", Subtrahend = "xc"), Colors = defaultColors(3, :), Filter = comparisonData.qs & comparisonData.qc)), ...
mag.graphics.style.Default(YLabel = "y [nT]", YAxisLocation = yAxisLocation, Layout = [2, 1], Charts = [mag.graphics.chart.Plot(YVariables = "ys", Marker = "o", Filter = comparisonData.qs), mag.graphics.chart.Plot(YVariables = "yc", Marker = "x", Filter = comparisonData.qc)]), ...
mag.graphics.style.Default(YLabel = "\Deltay [nT]", YAxisLocation = yAxisLocation, Charts = mag.graphics.chart.Plot(YVariables = mag.graphics.operation.Subtract(Minuend = "ys", Subtrahend = "yc"), Colors = defaultColors(3, :), Filter = comparisonData.qs & comparisonData.qc)), ...
mag.graphics.style.Default(YLabel = "z [nT]", YAxisLocation = yAxisLocation, Layout = [2, 1], Charts = [mag.graphics.chart.Plot(YVariables = "zs", Marker = "o", Filter = comparisonData.qs), mag.graphics.chart.Plot(YVariables = "zc", Marker = "x", Filter = comparisonData.qc)]), ...
mag.graphics.style.Default(YLabel = "\Deltaz [nT]", YAxisLocation = yAxisLocation, Charts = mag.graphics.chart.Plot(YVariables = mag.graphics.operation.Subtract(Minuend = "zs", Subtrahend = "zc"), Colors = defaultColors(3, :), Filter = comparisonData.qs & comparisonData.qc))];
end
end
end
99 changes: 0 additions & 99 deletions src/visualize/+mag/+graphics/+view/IALiRT.m

This file was deleted.

6 changes: 4 additions & 2 deletions src/visualize/+mag/+graphics/sftPlots.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@
end

% Show I-ALiRT.
if ~isempty(croppedAnalysis.Results.IALiRT)
views(end + 1) = mag.graphics.view.IALiRT(croppedAnalysis.Results);
if ~isempty(croppedAnalysis.Results.IALiRT) && croppedAnalysis.Results.IALiRT.HasData

tempInstrument = mag.Instrument(Science = croppedAnalysis.Results.IALiRT.Science);
views(end + 1) = mag.graphics.view.Field(tempInstrument);
end

% Show science comparison.
Expand Down

0 comments on commit 274562a

Please sign in to comment.