Skip to content
Snippets Groups Projects
Commit 69b991ff authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Add comments, remove some commandline outputs

parent 1514c3e6
No related branches found
No related tags found
2 merge requests!13PreRelease_V0.1,!12PreRelease_V0.1
Pipeline #564170 canceled
...@@ -29,7 +29,7 @@ if numel(figure) > 1 ...@@ -29,7 +29,7 @@ if numel(figure) > 1
warning(msg); warning(msg);
end end
%read config file %% read config file
try try
txt = fileread('config.json'); txt = fileread('config.json');
config = jsondecode(txt); config = jsondecode(txt);
...@@ -41,6 +41,7 @@ catch ...@@ -41,6 +41,7 @@ catch
configError = true; configError = true;
end end
%% storage location
switch options.Location switch options.Location
case 'local' case 'local'
if contains(options.ParentFolder, {'/','\'}) if contains(options.ParentFolder, {'/','\'})
...@@ -66,7 +67,7 @@ elseif mkdir(fullfile(storPath,folderName)) ...@@ -66,7 +67,7 @@ elseif mkdir(fullfile(storPath,folderName))
else else
error('Directory could not be created - check remote path and permissions'); error('Directory could not be created - check remote path and permissions');
end end
disp('Publishing started'); disp(['publishing of ', ID, ' started']);
%% Create a Copy of the script, config and user functions(optional) %% Create a Copy of the script, config and user functions(optional)
% script % script
......
...@@ -2,7 +2,6 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type) ...@@ -2,7 +2,6 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type)
% Creates a copy of the files (can be used for multiple paths in a cell array) % Creates a copy of the files (can be used for multiple paths in a cell array)
% folderName is the name of the exporting folder % folderName is the name of the exporting folder
% returns the storage paths were files were stored % returns the storage paths were files were stored
disp(['start to copy ', type]);
if ~iscell(filePaths) if ~iscell(filePaths)
%fixes Issue if Filepath is a char and not a cell array %fixes Issue if Filepath is a char and not a cell array
...@@ -74,6 +73,7 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type) ...@@ -74,6 +73,7 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type)
warning([type,' export was not sucessful']) warning([type,' export was not sucessful'])
if exist('errorMSG') if exist('errorMSG')
error(errorMSG); error(errorMSG);
end %try
end end
end %try
end %function
...@@ -3,38 +3,30 @@ ...@@ -3,38 +3,30 @@
%% Clear Environment %% Clear Environment
clear; clc; close all; clear; clc; close all;
addpath('CI_files'); % Test scripts
try try
delete testdata2.h5; delete testdata2.h5;
end end
%% Set ProjectID %% Set ProjectID
% ProjectID can also be set in the config file % ProjectID can also be set in the config file
% TODO: decide how projectID and optionally ORCID will be implemented
% ORCID placed on startup (alternative?) - projectID as persistent
% otherwise dialogue?
% Leave empty for using the ID from the config file % Leave empty for using the ID from the config file
ProjectID = 'FST03'; ProjectID = 'Example';
%% Data %% Data
% Creating Random Data to use as data-file % only necessary for this example
x = linspace(0,7); % Creating Random Data to use as data-file
y = rand(1,100)+2; x = linspace(0,7); y = rand(1,100)+2;
dataset1 = 'test_data.mat'; dataset1 = 'test_data.mat';
% Use absolute paths for good practise % Use absolute paths for good practise
dataset1 = fullfile(pwd,dataset1); dataset1 = fullfile(pwd,dataset1);
save(dataset1,'x','y'); save(dataset1,'x','y');
% some data for the .h5 file
% some data as .h5 x1 = linspace(0,2*pi); y1 = sin(x1)+2;
x1 = linspace(0,2*pi);
y1 = sin(x1)+2;
% define filepath & name % define filepath & name
dataset2 = 'testdata2.h5'; dataset2 = 'testdata2.h5';
...@@ -49,14 +41,14 @@ h5write(fpath, "/y1", y1) ...@@ -49,14 +41,14 @@ h5write(fpath, "/y1", y1)
%% function calls %% function calls
% Place for post-processing of the data, or additional related code. % Place for post-processing of the data, or additional related code.
a = 1;
% example_fcn is a dummy function to show the functionality % example_fcn is a dummy function to show the functionality
a = example_fcn(a); a = 1; a = example_fcn(a);
%p = betacdf(0.5,1,1); % to test Toolboxes %p = betacdf(0.5,1,1); % to test toolboxes
%% Plotting %% Plotting
% This is still part of a normal script to produce plots. % This is still part of a normal script to produce plots.
% Make sure to save each figure in a variable to pass to PlotID-functions. % Make sure to save each figure in a variable
% to pass it to PlotID-functions.
fig(1) = figure; fig(1) = figure;
plot(x,y,'-k'); plot(x,y,'-k');
box off; hold on; box off; hold on;
...@@ -73,17 +65,19 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]); ...@@ -73,17 +65,19 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]);
%% Publishing %% Publishing
% Second part of plotID % Second part of plotID
% The functions needs the file location, the location of the data and the % The functions needs the file location of the script, the location of the
% figure and can take several options. % data and the figure and can take several options (see readme).
% TODO add explanations for Options
path.script = mfilename('fullpath'); % filename of the m.script path.script = mfilename('fullpath'); % filename of the m.script
% file names of the datasets % file names of the datasets
%(defined above:) dataset1 = 'test_data.mat'; dataset2 = 'testdata2.h5'
path.rdata = {dataset1,dataset2} ; % don't forget the extension path.rdata = {dataset1,dataset2} ; % don't forget the extension
%call publishing
PlotID.Publish(path, ID, fig(1), 'Location', 'local' ,'Method','individual') PlotID.Publish(path, ID, fig(1), 'Location', 'local' ,'Method','individual')
%% Example 2: multiple plots plot, all based on data-set2 (hdf5) %% Example 2: multiple plots plot, all based on dataset2 (hdf5)
% for individual data-sets, use an appropriate array % for individual data-sets, use an appropriate array
fig(2) = figure; fig(2) = figure;
...@@ -100,13 +94,18 @@ path.script = mfilename('fullpath'); % filename of the m.script ...@@ -100,13 +94,18 @@ path.script = mfilename('fullpath'); % filename of the m.script
% file names of the datasets % file names of the datasets
path.rdata = {dataset2} ; % don't forget the extension path.rdata = {dataset2} ; % don't forget the extension
% publsihing via for-loop % publsihing via a for-loop
for i=1: numel(fig) for i=1: numel(fig)
PlotID.Publish(path, IDs{i}, fig(i), 'Location', 'server','Method','individual'); PlotID.Publish(path, IDs{i}, fig(i), 'Location', 'local',...
'Method','individual');
end end
%% Second Plot with identical data to test centralized method %% Second Plot with identical data to test centralized method
% ToDO Add better description % A central data folder is used for saving the research data files, the
% subfolders contain linked hdf5-files (if hdf5 is used). This is
% recommended, if many plots are made from the same data set. Attention,
% the linked HDF5 will not work when a subfolder was moved or the data
% folder was deleted
fig2 =figure; fig2 =figure;
plot(x,y,'-k'); plot(x,y,'-k');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment