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

Started work on centralized method

parent 8b97af47
No related branches found
No related tags found
No related merge requests found
File deleted
% test skript % test skript
clear; clc; close all; clear; clc; close all;
addpath('fcn_core','fcn_help');
try try
delete testdata_2.h5; delete testdata_2.h5;
end end
ProjectID = 'JL01'; ProjectID = 'JL01';
%% Data %% Data
% some random data % some random data
...@@ -47,7 +49,7 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]); ...@@ -47,7 +49,7 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]);
% The functions needs the file location, the location of the data and the % The functions needs the file location, the location of the data and the
% figure % figure
path.script = mfilename('fullpath'); % filename of the m.script path.script = mfilename('fullpath') % filename of the m.script
% file name of the data (should be extended to handle arrays) % file name of the data (should be extended to handle arrays)
path.rdata = {dataset1,dataset2} ; % don't forget the extension path.rdata = {dataset1,dataset2} ; % don't forget the extension
......
File moved
function Publish(DataPaths, ID, figures, options) function Publish(DataPaths, ID, figures, options)
%Publishes Saves Plot, Data and Measuring script %Publishes Saves Plot, Data and Measuring script
% Detailed explanation goes here % Detailed explanation goes here
% Location sets the storage location. local is in the current folder (an
% export folder will be created), server is a remote Path
% 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
arguments arguments
DataPaths DataPaths
ID (1,:) {mustBeNonzeroLengthText} % ID must be provided ID (1,:) {mustBeNonzeroLengthText} % ID must be provided
figures (1,:) {mustBeFigure} % Checks if Figures are figures figures (1,:) {mustBeFigure} % Checks if Figures are figures
options.Location {mustBeMember(options.Location ,['local','server'])} = 'local' % storage path options.Location {mustBeMember(options.Location ,['local','server'])} = 'local' % storage path
options.Method {mustBeMember(options.Method ,['individual','centraliced'])} = 'individual'
end end
switch options.Location switch options.Location
...@@ -39,7 +46,17 @@ try ...@@ -39,7 +46,17 @@ try
catch catch
warning('Script export was not sucessful') warning('Script export was not sucessful')
end end
%% Create a copy of the research data %% Research data handeling
switch options.Method
case 'centralized' % Work in progresss!!!
%check if data folder exists
if ~isfolder(fullfile(StorPath,'data'))
mkdir(fullfile(StorPath,'data'));
end
case 'individual'
% Create a copy of the research data
disp('Start to copy research data ...'); disp('Start to copy research data ...');
try try
for i = 1:numel(DataPaths.rdata) for i = 1:numel(DataPaths.rdata)
...@@ -47,7 +64,7 @@ try ...@@ -47,7 +64,7 @@ try
[~,~,ext] = fileparts(DataPaths.rdata{i}); % get the extension [~,~,ext] = fileparts(DataPaths.rdata{i}); % get the extension
newbackup=sprintf([ID,'_data',ext]); newbackup=sprintf([ID,'_data',ext]);
% Write a Copy of the Plotting Script % Write a Copy
RemotePath = fullfile(StorPath,FolderName, newbackup); RemotePath = fullfile(StorPath,FolderName, newbackup);
copyfile(FileNameAndLocation,RemotePath); copyfile(FileNameAndLocation,RemotePath);
end end
...@@ -55,7 +72,7 @@ try ...@@ -55,7 +72,7 @@ try
catch catch
warning('Research data export was not sucessful') warning('Research data export was not sucessful')
end end
end
%% Export the Plots %% Export the Plots
%try %try
for i=1:numel(figures) for i=1:numel(figures)
......
File moved
function [status] = fileCompare(filename1,filename2)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
[~,~,ext1] = fileparts(filename1);
[~,~,ext2] = fileparts(filename2);
if ~isequal(ext1,ext2)
warning('File extension are not identical');
status = false;
return
end
if ispc
filename2 = 'export\JL01-60DB3572\JL01-60DB3572_data.h5';
filename1 = 'export\JL01-60DB3576\JL01-60DB3576_data.h5';
[status,result] = system(['fc ' filename1 ' ' filename2]);
elseif isunix %untested!
filename2 = 'export/JL01-60DB3572/JL01-60DB3572_data.h5';
filename1 = 'export/JL01-60DB3576/JL01-60DB3576_data.h5';
[status,result] = system(['diff ' filename1 ' ' filename2]);
else
warning('Platform not supported')
end
end
function [IDf, Str] = FriendlyID(ID) function [IDf,PrjID, Str] = FriendlyID(ID)
%FriendlyID Changes the Hex Number to a human friendly datetime and dateStr %FriendlyID Changes the Hex Number to a human friendly datetime and dateStr
% IDf ID as DateTime Object, PrjID returns the ProjectID, Str returns the
% timestamp as String
%Remove Prefix %Remove Prefix
if contains(ID,'-') if contains(ID,'-')
IDarray = split(ID, '-'); IDarray = split(ID, '-');
PrjID = IDarray{1};
ID = IDarray(2); %keep only the second part ID = IDarray(2); %keep only the second part
else
PrjID = '';
end end
ID = hex2dec(ID); % get it back as dec ID = hex2dec(ID); % get it back as dec
......
function [status] = createLinkedHDF5(SourceFile,TargetPath,ID)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
plist_id = 'H5P_DEFAULT';
% Work in Progress... Problem mit dem Pfad...
try
fid = H5F.create(fullfile(TargetPath,[ID,'_data.h5']));
%create External Link to Sourcefile in the Group linkToExternal
H5L.create_external(SourceFile,'/',fid,'linkToExternal',plist_id,plist_id);
H5F.close(fid);
status = 1;
catch
warning('No linked HDF file was created');
status = 0;
end
end
No preview for this file type
No preview for this file type
import h5py
#Shows how to create an externalLink (symbolic) to a hdf5 File
#Documentation available at: https://docs.h5py.org/en/stable/high/group.html#external-links
myfile = h5py.File('./example.h5','w')
myfile['ext link'] = h5py.ExternalLink("testdata_2.h5", "/")
myfile.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment