Merge branch 'dev' into 'main'

Added more UI features to ease usage

See merge request sta-git/propulsion/stahr/plotting-tool!3
This commit is contained in:
Max Heckmann 2023-01-20 12:27:03 +00:00
commit 9ac8f98570
6 changed files with 79 additions and 19 deletions

Binary file not shown.

View File

@ -9,7 +9,7 @@ This is an attempt to standardize data plotting in Space Team Aachen, or at leas
Currently, the plotting tool covers the following functionalities: Currently, the plotting tool covers the following functionalities:
- Process "tdms" and "csv" files - Process "tdms", "csv" and "txt" files
- Process multiple files at once - Process multiple files at once
- generate time values with increment - generate time values with increment
- Automatically creates a folder-structure for the results - Automatically creates a folder-structure for the results
@ -114,14 +114,8 @@ One last disclaimer: If there is a mistake in the data set, if you use a comma i
There are numerous functionalities still missing. The following list provides an overview of all important functions, that should be added as soon as possible (more or less). The order of precedence represents the priority. There are numerous functionalities still missing. The following list provides an overview of all important functions, that should be added as soon as possible (more or less). The order of precedence represents the priority.
1. Support the file format TXT 1. Merge plots (more than one data set in a single plot) Maybe another tool for that?
2. Merge plots (more than one data set in a single plot) Maybe another tool for that? 2. Get the custom x-Axis label to work on the fourier plot
3. Select/ Unselect all checkboxes in one column with a button 3. Add try and catch statements around every user input
4. “Set all” button for start and end time
5. Choose the order of the move mean filter
6. Add a custom x-axis label
7. Add the option for a derivation plot
8. Allow multiple loads (Load different folder in one session)
9. Add try and catch statements around every user input
You are very welcome to help develop this tool further. If you are planning to do so, please send me a message (Max Heckmann) and I give you a short introduction in the already existing code. This probably saves you some time. You are very welcome to help develop this tool further. If you are planning to do so, please send me a message (Max Heckmann) and I give you a short introduction in the already existing code. This probably saves you some time.

67
diffPlotFnc.m Normal file
View File

@ -0,0 +1,67 @@
function diffPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path)
%Iterate through all channels
for channel = 1:width(data)
%If Graph is checked
if checkboxes{channel}.Value == 1
%Convert start and ending time
beginning = str2double(start{channel}.Value);
ending = str2double(stop{channel}.Value);
%if first row increment is not checked
if fileSettings{2}.Value == 0
[timeArray, yData] = timeAxisWithIncrement(data, fileSettings{3}.Value, beginning, ending, channel);
else
if ending == 0
timeArray = data(:,1);
yData = data(:, channel);
else
timeIndex = 1;
while data(timeIndex,1) < str2double(start{channel}.Value)
timeIndex = timeIndex + 1;
end
startIndex = timeIndex;
while data(timeIndex, 1) <= str2double(stop{channel}.Value) || timeIndex >= length(data)
timeArray(timeIndex - startIndex + 1) = data(timeIndex,1);
timeIndex = timeIndex + 1;
end
endIndex = timeIndex;
for timeIndex = startIndex:endIndex - 1
yData(timeIndex - startIndex + 1) = data(timeIndex, channel);
end
end
end
%Plot the channel
figure(channel)
plot(timeArray, yData, '-b');
hold all
%shorten time array to match lost value from diff
timeArray(end) = [];
plot(timeArray, diff(yData), '-r');
ylabel(yAxis{channel}.Value);
xlabel(xAxis{channel}.Value);
legend('Original', 'Derivative')
title(channels{channel});
%Save plot
saveFigs('derivative', figure(channel), channels(channel), path, fileSettings{1}.Value)
%reset
hold off
close all;
end
end
end

View File

@ -1,4 +1,4 @@
function fourierPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path) function fourierPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path)
%Iterate through all channels %Iterate through all channels
for channel = 1:width(data) for channel = 1:width(data)
@ -47,7 +47,7 @@ function fourierPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, chan
Nspec = 1024; Nspec = 1024;
end end
wspec = hamming(Nspec); wspec = hamming(Nspec);
Noverlap = Nspec/2; Noverlap = int16(Nspec/2);
hold on hold on
figure(channel) figure(channel)

View File

@ -1,4 +1,4 @@
function graphPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path) function graphPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path)
%Iterate through all channels %Iterate through all channels
for channel = 1:width(data) for channel = 1:width(data)
@ -46,7 +46,7 @@ function graphPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channe
figure(channel) figure(channel)
plot(timeArray, yData); plot(timeArray, yData);
ylabel(yAxis{channel}.Value); ylabel(yAxis{channel}.Value);
xlabel('Time [s]'); xlabel(xAxis{channel}.Value);
title(channels{channel}); title(channels{channel});
%Save plot %Save plot

View File

@ -1,4 +1,4 @@
function meanPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path) function meanPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path, order)
%Iterate through all channels %Iterate through all channels
for channel = 1:width(data) for channel = 1:width(data)
@ -39,15 +39,14 @@ function meanPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channel
end end
end end
%Plot the channel %Plot the channel
figure(channel) figure(channel)
plot(timeArray, yData, '-b'); plot(timeArray, yData, '-b');
hold all hold all
plot(timeArray, movmean(yData, 20), '-r'); plot(timeArray, movmean(yData, str2double(order)), '-r');
ylabel(yAxis{channel}.Value); ylabel(yAxis{channel}.Value);
xlabel('Time [s]'); xlabel(xAxis{channel}.Value);
legend('Without movmean','With movmean (20th order)') legend('Without movmean', strcat('With movmean (', order, 'th order)'))
title(channels{channel}); title(channels{channel});
%Save plot %Save plot