Skip to content

Commit

Permalink
Make magnitude and derivatives dependent properties of mag.Science
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Jan 31, 2024
1 parent d75dbd6 commit 7a1da67
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/analyze/+mag/@IMAPTestingAnalysis/IMAPTestingAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [ ...
Expand Down
20 changes: 19 additions & 1 deletion src/data/+mag/Science.m
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/data/+mag/TimeSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
properties (Dependent)
% TIME Timestamp of data.
Time (:, 1) datetime
% DT Time derivative.
dT (:, 1) duration
IndependentVariable
DependentVariables
end
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/visualize/+mag/+graphics/+view/RampMode.m
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...
Expand Down

0 comments on commit 7a1da67

Please sign in to comment.