From 7a1da67b9e78b9da975d3c7815dff3e7142629d8 Mon Sep 17 00:00:00 2001 From: mfacchinelli Date: Wed, 31 Jan 2024 14:02:32 +0000 Subject: [PATCH] Make magnitude and derivatives dependent properties of `mag.Science` --- .../IMAPTestingAnalysis.m | 4 +--- src/data/+mag/Science.m | 20 ++++++++++++++++++- src/data/+mag/TimeSeries.m | 6 ++++++ src/visualize/+mag/+graphics/+view/RampMode.m | 4 ++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/analyze/+mag/@IMAPTestingAnalysis/IMAPTestingAnalysis.m b/src/analyze/+mag/@IMAPTestingAnalysis/IMAPTestingAnalysis.m index a4505af7..9b7962fe 100644 --- a/src/analyze/+mag/@IMAPTestingAnalysis/IMAPTestingAnalysis.m +++ b/src/analyze/+mag/@IMAPTestingAnalysis/IMAPTestingAnalysis.m @@ -36,12 +36,10 @@ ScienceProcessing (1, :) mag.process.Step = [ mag.process.Filter(OnRangeChange = [seconds(1), seconds(1)]), ... mag.process.Range(), ... - mag.process.Calibration(), ... - mag.process.Magnitude()] + mag.process.Calibration()] % RAMPPROCESSING Steps needed to process only ramp mode data. RampProcessing (1, :) mag.process.Step = [ ... mag.process.Unwrap(Variables = ["x", "y", "z"]), ... - mag.process.Derivative(Variables = ["x", "y", "z"]), ... mag.process.Ramp()] % HKPROCESSING Steps needed to process imported HK data. HKProcessing (1, :) mag.process.Step = [ ... diff --git a/src/data/+mag/Science.m b/src/data/+mag/Science.m index 67bf24d7..50dd888c 100644 --- a/src/data/+mag/Science.m +++ b/src/data/+mag/Science.m @@ -12,6 +12,12 @@ XYZ (:, 3) double % B Magnitude of the magnetic field. B (:, 1) double + % DX x-axis derivative of the magnetic field. + dX (:, 1) double + % DY y-axis derivative of the magnetic field. + dY (:, 1) double + % DZ z-axis derivative of the magnetic field. + dZ (:, 1) double % RANGE Range values of sensor. Range (:, 1) uint8 % SEQUENCE Sequence number of vectors. @@ -50,7 +56,19 @@ end function b = get.B(this) - b = this.Data.B; + b = vecnorm(this.XYZ, 2, 2); + end + + function dx = get.dX(this) + dx = [diff(this.X); missing()]; + end + + function dy = get.dY(this) + dy = [diff(this.Y); missing()]; + end + + function dz = get.dZ(this) + dz = [diff(this.Z); missing()]; end function range = get.Range(this) diff --git a/src/data/+mag/TimeSeries.m b/src/data/+mag/TimeSeries.m index 5759c0d3..0bc3aa98 100644 --- a/src/data/+mag/TimeSeries.m +++ b/src/data/+mag/TimeSeries.m @@ -9,6 +9,8 @@ properties (Dependent) % TIME Timestamp of data. Time (:, 1) datetime + % DT Time derivative. + dT (:, 1) duration IndependentVariable DependentVariables end @@ -19,6 +21,10 @@ time = this.Data.(this.Data.Properties.DimensionNames{1}); end + function dt = get.dT(this) + dt = [diff(this.Time); duration(missing())]; + end + function independentVariable = get.IndependentVariable(this) independentVariable = this.Time; end diff --git a/src/visualize/+mag/+graphics/+view/RampMode.m b/src/visualize/+mag/+graphics/+view/RampMode.m index fd068e3f..3db32804 100644 --- a/src/visualize/+mag/+graphics/+view/RampMode.m +++ b/src/visualize/+mag/+graphics/+view/RampMode.m @@ -43,8 +43,8 @@ function visualize(this) secondarySample.crop(timerange(secondarySample.Time(1) + rampSampleOffset, secondarySample.Time(1) + rampSampleOffset + rampSampleDuration), :); this.Figures(2) = mag.graphics.visualize( ... - primarySample.Data, mag.graphics.style.Stackedplot(Title = primarySensor, YLabels = ["dx [-]", "dy [-]", "dz [-]"], Charts = mag.graphics.chart.Stackedplot(YVariables = ["dx", "dy", "dz"], Marker = "o")), ... - secondarySample.Data, mag.graphics.style.Stackedplot(Title = secondarySensor, YLabels = ["dx [-]", "dy [-]", "dz [-]"], Charts = mag.graphics.chart.Stackedplot(YVariables = ["dx", "dy", "dz"], Marker = "o")), ... + primarySample, mag.graphics.style.Stackedplot(Title = primarySensor, YLabels = ["dx [-]", "dy [-]", "dz [-]"], Charts = mag.graphics.chart.Stackedplot(YVariables = ["dX", "dY", "dZ"], Marker = "o")), ... + secondarySample, mag.graphics.style.Stackedplot(Title = secondarySensor, YLabels = ["dx [-]", "dy [-]", "dz [-]"], Charts = mag.graphics.chart.Stackedplot(YVariables = ["dX", "dY", "dZ"], Marker = "o")), ... Title = sprintf("Sample %s", rampSampleDuration), ... Name = "Ramp Mode (Derivative)", ... LinkXAxes = false, ...