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

Closes #23, fixes Bugs

parent c20cc78e
No related branches found
No related tags found
3 merge requests!13PreRelease_V0.1,!12PreRelease_V0.1,!5Resolve "Feature: ProjectID als persistent Variable, ORCID/ PersonalID in startup/config?"
......@@ -41,7 +41,7 @@ plot(x1,y1,'-r');
%% Tag the plot
try
[figs, ID] = TagPlot(fig, ProjectID);
[figs, ID] = TagPlot(fig,'ProjectID', ProjectID);
%% call a dummy function
a=1;
......
{
"ProjectID": "JL01",
"ProjectID": "JL01",
"ServerPath": "\\\\FST-220\\Jans-50GB-SMB\\Lemmer"
}
\ No newline at end of file
......@@ -12,13 +12,14 @@ end
%% Set ProjectID
% ProjectID
% 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?
ProjectID = 'JL01';
% Leave empty for using the ID from the config file
ProjectID = '';
%% Data
......@@ -65,7 +66,7 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]);
% PlotID Implementation starts here.
% TagPlot adds a visible ID to the figure(s) and to the figures property
% 'Tag'
[fig, ID] = TagPlot(fig, ProjectID);
[fig, ID] = TagPlot(fig, 'ProjectID', ProjectID);
%% Publishing
% Second part of plotID
......@@ -79,7 +80,7 @@ path.rdata = {dataset1,dataset2} ; % don't forget the extension
Publish(path, ID, fig(1), 'Location', 'local','Method','centraliced')
%% Example 2 : multiple plots plot, all based on two data-set2
%% Example 2: multiple plots plot, all based on data-set2 (hdf5)
% for individual data-sets, use an appropriate array
fig(2) = figure;
......@@ -89,7 +90,7 @@ plot(x1,y1,'--k');
set(gca, 'TickDir', 'out', 'YLim', [0,4]);
% tag both plots
[fig, IDs] = TagPlot(fig, ProjectID);
[fig, IDs] = TagPlot(fig,'ProjectID', ProjectID);
% data locations
path.script = mfilename('fullpath'); % filename of the m.script
......@@ -110,6 +111,6 @@ plot(x,y,'-k');
hold on
plot(x1,y1,'-r');
[fig2, ID] = TagPlot(fig2, ProjectID);
[fig2, ID] = TagPlot(fig2,'ProjectID', ProjectID);
Publish(path, ID, fig2, 'Location', 'local','Method','centraliced')
\ No newline at end of file
......@@ -10,7 +10,7 @@ switch method
case 1 % UNIX Time in seconds as HEX
ID = posixtime(datetime('now')); %get current Unix time
ID = dec2hex(int32(ID)); % get it as Hex
pause(0.5); %Pausing for unique IDs
pause(1); %Pausing for unique IDs
case 2 % random UUID from Java 128 bit
%Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
% The UUID is generated using a cryptographically strong pseudo
......
......@@ -2,7 +2,7 @@ function Publish(DataPaths, ID, figure, options)
%Publishes saves plot, data and measuring script
% Location sets the storage location. 'local' sets the storage location
% to the current folder (an export folder will be created), 'server' is a
% remote path.
% remote path, that is defined in the config file.
% Two Methods are implemented 'individual' stores the data for
% each plot while 'centralized' uses a data folder and uses reference links
% to the original data (hdf5 only).
......@@ -28,15 +28,17 @@ end
switch options.Location
case 'local'
storPath = fullfile(pwd,'export');
case 'server'
storPath = '\\FST-220\Jans-50GB-SMB\Lemmer';
case 'server' %from config File
txt = fileread('config.json');
config = jsondecode(txt);
storPath = config.ServerPath;
case 'CI-Test'
storPath = fullfile(pwd,'CI_files','export');
end
folderName = char(ID);
%% Create Data-Directory
addpath(storPath);
addpath(storPath); % ToDo necessary? -
if isfolder(fullfile(storPath,folderName))
error(['Folder ',folderName, ' exists - Plot was already published ']);
elseif mkdir(fullfile(storPath,folderName))
......
function [figs, IDs] = TagPlot(figs, prefix, options)
function [figs, IDs] = TagPlot(figs, options)
%TagPlot adds IDs to figures
% The ID is placed visual on the figure window and as Tag (property of figure)
% TagPlot can tag multiple figures at once.
% If a single Plot is taged IDs is a char, otherwise it is a cell array of
% chars
% prefix is the project number (string or char)
% options.ProjectID is the project number (string or char), if empty the ID from the
% config file is used
%
% The ID is placed on the 'east' per default, if you want it somwhere
% else, use the 'Location' option. 'north','east','south','west' are
......@@ -12,15 +13,21 @@ function [figs, IDs] = TagPlot(figs, prefix, options)
% 'Position' (relative to your x- and y-axis limits)
arguments
figs (1,:) {mustBeFigure}
prefix (1,:) {mustBeText}= ''
options.ProjectID (1,:) {mustBeText}= ''
options.Fontsize (1,1) {mustBeInteger} = 8
options.Location (1,:) {mustBeText} = 'east'
options.Position (1,2) {mustBeVector} = [1,0.4] % default for east
options.Rotation (1,1) {mustBeInteger} = 0
end
if isempty(prefix)
warning('no project prefix defined')
if isempty(options.ProjectID)
txt = fileread('config.json');
config = jsondecode(txt);
if ~isempty(config.ProjectID)
options.ProjectID = config.ProjectID;
else
warning('no project options.ProjectID defined')
end
end
switch options.Location
......@@ -51,7 +58,7 @@ IDs = cell(numel(figs),1);
for n = 1:numel(figs)
IDs{n} = CreateID; % Create ID
IDs{n} = [prefix,'-',IDs{n}]; % add Prefix
IDs{n} = [options.ProjectID,'-',IDs{n}]; % add options.ProjectID
axes = get(figs(n),'CurrentAxes'); % Axes object for text annotation
% Limits for relative Positioning
ylim =get(axes,'YLim');
......
......@@ -15,7 +15,7 @@ end
id = zeros(height(fileList),1);
for i=1:height(fileList)
[~,~,ext2] = fileparts(fileList.name{i});
[~,~,ext2] = fileparts(fileList{i,'name'});
if ~isequal(ext1,ext2)
%warning('File extension are not identical');
......@@ -23,9 +23,9 @@ for i=1:height(fileList)
continue
end
filepath = fullfile(fileList.folder{i},fileList.name{i});
filepath = fullfile(fileList{i,'folder'},fileList{i,'name'});
if ispc
[status,~] = system(['fc ' filename ' ' filepath]);
[status,~] = system(['fc ' filename ' ' char(filepath)]);
% 0 -> identical, 1 -> not identical
status = ~status; % false (not identical), true(identical)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment