From 4edd7e41ce660eff01f1010957715717e9634b96 Mon Sep 17 00:00:00 2001 From: Jan Lemmer <jan.lemmer@fst.tu-darmstadt.de> Date: Tue, 10 Aug 2021 09:05:25 +0200 Subject: [PATCH] Implements #13 Removes unecessary files --- .gitignore | 1 + example.m | 2 +- fcn_core/Publish.m | 37 ------------------------------ fcn_core/TagPlot.m | 42 +++++++++++++++++++++++++++++++--- fcn_help/createFileCopy.m | 47 ++++++++++++++++++++++++++++++++++++++ test123_data.h5 | Bin 896 -> 0 bytes test_data.mat | Bin 1529 -> 0 bytes testdata_2.h5 | Bin 3064 -> 0 bytes 8 files changed, 88 insertions(+), 41 deletions(-) create mode 100644 fcn_help/createFileCopy.m delete mode 100644 test123_data.h5 delete mode 100644 test_data.mat delete mode 100644 testdata_2.h5 diff --git a/.gitignore b/.gitignore index 06d6bb3..3d5fc69 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ export/* # Octave session info octave-workspace +test_data.mat diff --git a/example.m b/example.m index 9686cb4..4a775d1 100644 --- a/example.m +++ b/example.m @@ -58,7 +58,7 @@ path.script = mfilename('fullpath'); % filename of the m.script % file name of the data path.rdata = {dataset1,dataset2} ; % don't forget the extension -Publish(path, ID, figs, 'Location', 'local','Method','individual') +Publish(path, ID, figs, 'Location', 'local','Method','centraliced') %% Second Plot with identical data to test centralized method % diff --git a/fcn_core/Publish.m b/fcn_core/Publish.m index 6ab522b..75473df 100644 --- a/fcn_core/Publish.m +++ b/fcn_core/Publish.m @@ -95,43 +95,6 @@ disp(['publishing of ', ID , ' done']); end %function -function [] = createFileCopy(filePaths,folderName,storPath,ID,type) -% Creates a copy of the files (can used for multiple paths in a cell array) -% folderName is the name of the exporting folder - disp(['start to copy ', type]); - -% try - for i = 1:numel(filePaths) - FileNameAndLocation = filePaths{i}; - [~,name,ext] = fileparts(filePaths{i}); % get the extension - - switch type - case 'data' - sufix = '_data'; - newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]); - case 'dataCentral' - %keep original name - newfile = sprintf([name,ext]); - case 'script' - sufix = '_script'; - newfile = sprintf([ID, sufix ,ext]); - case 'userFcn' - %keep original name - newfile = sprintf([name,ext]); - otherwise - error([type,' is not a valid type for createFileCopy']) - end %switch - - % Write the file - RemotePath = fullfile(storPath,folderName, newfile); - copyfile(FileNameAndLocation,RemotePath); - end - disp([type, ' sucessfully published']); -% catch -% warning([type,' export was not sucessful']) -% end %try -end - function tf = mustBeFigure(h) %checks if input is a figure object tf = strcmp(get(h, 'type'), 'figure') & isa(h, 'matlab.ui.Figure'); diff --git a/fcn_core/TagPlot.m b/fcn_core/TagPlot.m index 3c42626..4fac128 100644 --- a/fcn_core/TagPlot.m +++ b/fcn_core/TagPlot.m @@ -1,16 +1,50 @@ -function [figs, ID] = TagPlot(figs, prefix) +function [figs, ID] = TagPlot(figs, prefix, 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 +% prefix is the project number (string or char) +% +% The ID is placed on the 'east' per default, if you want it somwhere +% else, use the 'Location' option. 'north','east','south','west' are +% predefined, otherwise use the 'custom' option and provide the desired +% 'Position' (relative to your x- and y-axis limits) arguments figs (1,:) {mustBeFigure} prefix (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') end +switch options.Location + case 'north' + options.Position = [0.4,0.95]; + options.Rotation = 0; + case 'east' + options.Position = [1,0.4]; + options.Rotation = 90; + case 'south' + options.Position = [0.4,.02]; + options.Rotation = 0; + case 'west' + options.Position = [.05,0.4]; + options.Rotation = 90; + case 'custom' + % Check if Position is valid + if ~all(0 <= options.Position & options.Position <= 1) + options.Position = [1,0.4]; + warning('options.Position is not valid, TagPlot default values instead'); + end + otherwise % set default position + warning([options.Location, ' is not a defined location, TagPlot uses location east instead']); + options.Location = 'east'; options.Position = [1,0.4]; +end + for n = 1:numel(figs) ID = CreateID; % Create ID ID = [prefix,'-',ID]; % add Prefix @@ -19,8 +53,10 @@ for n = 1:numel(figs) ylim =get(axes,'YLim'); xlim =get(axes,'XLim'); %ID - text(axes,xlim(2),0.4*ylim(2), ID,'Fontsize',8,'Rotation',90,'VerticalAlignment','bottom',... - 'Color', 0.65*[1 1 1],'BackgroundColor','w'); + position = [options.Position(1)*xlim(2), options.Position(2)*ylim(2)]; + text(axes,position(1),position(2), ID,'Fontsize',options.Fontsize,... + 'Rotation',options.Rotation, 'VerticalAlignment','bottom','Color',... + 0.65*[1 1 1],'BackgroundColor','w'); set(figs(n),'Tag', ID); end diff --git a/fcn_help/createFileCopy.m b/fcn_help/createFileCopy.m new file mode 100644 index 0000000..67b1620 --- /dev/null +++ b/fcn_help/createFileCopy.m @@ -0,0 +1,47 @@ +function [] = createFileCopy(filePaths,folderName,storPath,ID,type) +% Creates a copy of the files (can used for multiple paths in a cell array) +% folderName is the name of the exporting folder + disp(['start to copy ', type]); + +% try + for i = 1:numel(filePaths) + FileNameAndLocation = filePaths{i}; + [~,name,ext] = fileparts(filePaths{i}); % get the extension + + switch type + case 'data' + sufix = '_data'; + newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]); + case 'dataCentral' + %keep original name + newfile = sprintf([name,ext]); + case 'script' + sufix = '_script'; + newfile = sprintf([ID, sufix ,ext]); + case 'userFcn' + %keep original name + newfile = sprintf([name,ext]); + otherwise + error([type,' is not a valid type for createFileCopy']) + end %switch + + % Write the file + RemotePath = fullfile(storPath,folderName, newfile); + + % Check if remote file already exists (not working) +% count = 0; +% while isfile(RemotePath) && ismember(type,{'data','dataCentral'}) +% % Add a Sufix number to file name +% count = count + 1; +% [~,name,ext] = fileparts(RemotePath); +% RemotePath = fullfile(storPath,folderName,... +% [name,'_',num2str(count),ext]); +% end + copyfile(FileNameAndLocation,RemotePath); + end + disp([type, ' sucessfully published']); +% catch +% warning([type,' export was not sucessful']) +% end %try +end + diff --git a/test123_data.h5 b/test123_data.h5 deleted file mode 100644 index c85a96e642cca94a1b7fc824f2b0014fab90c50e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 896 zcmeD5aB<`1lHy_j0S*oZ76t(j3y%LoK?5^H2+I8r;W02Iz!*4aMg|rJMg|5338=gP z)O-b~c`*GUL9VVKB{1`0G)Qa|kA{GUt78Bt6e2(b0|NsGls>@(Wk4xVS_3h`ia`tt zF%vxH!cruRh8WDnzyVI*5FP^q8-oUz$;jcrTasE_l9E`G7;mJPVJgVLfWl|c2de`B DA!<QY diff --git a/test_data.mat b/test_data.mat deleted file mode 100644 index 33fbe1ef1a97e81ad944afeb8bcf68356d7d626a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1529 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w+L}(NS<NN=+<DO;O0t zvr-5tO;vC#O;=DbRxmWSGP1NXHdHV&Ffvpi5-`93qo*%F0|SFB69YrV9NWpY9wLDv zNAJJeA-`_-yEkv%Y)^0%5oB4|A^3yOMZi_*pRz<yhd_rytBVsyAWKq*f}5f%hm%MW zhmwn+r{W?GHxZ?Xln%v3TOzxceZ9APx}0&$y)(7X=Y5u57Qzvj&iOFhRAa@fr;qo# z-_>1Kb)+=3`|95FLjS{mKQ-RmJ=4&$G)PV^M|!rM$>HDMKixTd?E2S!`%j-;GkeQ< zlb;yx|F1RM>Y4xYS^Em_ciCLr9dmd0o>PCbjXtKlUa`J(?)lskho(ngoOMWT{(r^r zYlrX7RsX!^b8y`axetBixf}24TS{u|-}v*H`D?K!#o^p}oB#FIZ27-q(yznCWl!%W z>xZ>heXF<^|MS(tJb?u}nWnOTb>Yw0Cw_k3tEa3#HxxLWJ{zTA?^<CHxX@3evF2yO z^$b<}6Z7TE@9hf_W>T2X_-5W!{U(L|juJEbk|w+txF+S~rN#0ozUkT0o%?<Zt1gg9 z)Y<Z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x-2d$ zG_RWdYyGqL2_FhWJD*P%WD2f%lHoXuVe0SJNO^~c7I)V6u1PDfF@Mncor!UwU-<P& znw(sp<kag7jx_1;ZaI}5VUil<R3Y4+6~6B0UKXa%zacMw7wRlJCuzF;Da$SUu(;VP z9$Z}2Z8f>5v2nj%(&a5-a$k)fhn{!S2-$YO`d5yQNpIJ(udPhquEfOOoa?*bea7C{ zN&W#Ru5UluD%_+0W|8{#LWj+(Q#bV<<+^`iQxbpUma+%)iy!6vkF3pkJ#SOM*%dRd z*0m)3oBQ;jZ969$)A@bDM$Jj-X98~oRZb~Ae@7=<&0@or&8jI4hunWhzI|eFR6E1a GRR;j%iq`f3 diff --git a/testdata_2.h5 b/testdata_2.h5 deleted file mode 100644 index 8415c693f833bd3db2dc2ca3c7e614efdbc98080..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3064 zcmeD5aB<`1lHy_j0S*oZ76t(j3y%Lo!4GbT5S05L!ed}afH82;j0|iHj0_A65>R;o zsQCsg5CIPe#SjwY>I!1Q%!kn+u~9r40v@i80iaNb01*rf3>;AU1QV12r9f#7!~`n_ zF(|~a^b1bJ3=9m63>sh)8JQq9rGR-LaR>vQ&&(hJ)+(rA4|THxg9$f-$$w^udR7Jw zusjnJ#6S+HdS=EQtPm9nP?Zp#5Y!Zq?R~18i3|)G5D7YwOz@lx%b_qD;s7qFe;_;t z23UUYfcnM&Dlu^3dIOqt23NSULCZx(0Y;_@LxkIq#VZXfprs}>5E&R4CQ5nNgxhbh zhtLP?Z!RyeVvaun<zKKjeHa_9>wg6*e#5>tuUYbD-W{m?1N+CdSF)YlA3@bUv2SyE z?j;fa466Qxy$<&;&39?9p!(j}pTEe%d8F(eRR0Hit26vxe4IZ*&G}^Cqd)Vpx%X$N zd0*`BO;Wn76#Nxx?l*gbZ>taSMt_Hz|HHmH(sa|0q@PfGe%W8yvv1+!tlv=k{@AN4 zcuYK3^cQOHKl_U2iw!%g{zL6&a7ZoIwFo-M-~e$4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