Add the program
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Wed, 19 Jun 2024 09:26:28 +0000 (11:26 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Wed, 19 Jun 2024 09:30:05 +0000 (11:30 +0200)
This program was created by Tereza Trávníčková.
As no version control was used prior to this commit, the whole project
has to be commited at once.

.gitignore [new file with mode: 0644]
Bubliny2023.m [new file with mode: 0755]
README.txt [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..c1fca28
--- /dev/null
@@ -0,0 +1,5 @@
+*.png
+*.fig
+*.xls*
+*.csv
+Thumbs.db
diff --git a/Bubliny2023.m b/Bubliny2023.m
new file mode 100755 (executable)
index 0000000..3c777dd
--- /dev/null
@@ -0,0 +1,447 @@
+\r
+close all;                                                                  % deletes all figures whose handles are not hidden\r
+clear all;                                                                  % removes all variables from memory\r
+clc;                                                                        % clears the Command Window display\r
+\r
+%% vstupni data T:\00-Orvalho\Travnickova\Bubble column\r
+% \r
+\r
+%%\r
+% User dialog for the data directory used for files\r
+\r
+DirectoryPath='T:\00-Orvalho\Travnickova\Bubble column\';\r
+DirectoryName = uigetdir(DirectoryPath,'Select the data folder');           % returns the name and path of the file selected in the dialog box\r
+disp(['The data directory used for files is ', DirectoryName]);             % displays the name of selected file in Command Window\r
+\r
+DDirectory = dir(DirectoryName);                                            % Loads directories or subdirectories to struct FFiles(1).name, FFiles(1).folder, FFiles(1).date - i s casem\r
+list={DDirectory.name};\r
+[Selected,OK] = listdlg('ListString',list,'ListSize',[200 500]);\r
+SelectedDirectory = list(Selected)';                                   \r
+if isempty(SelectedDirectory)                                               % handles the error, when no spreadsheet is selected  \r
+    error('No experiment selected.')\r
+end\r
+nSelectedDirectory = numel(SelectedDirectory);                              % Counts directories\r
+\r
+[one,Path]=size(DirectoryPath);\r
+ResFile = [DirectoryPath DirectoryName(Path+1:end) '.xlsm'];\r
+\r
+\r
+%%\r
+% load of all directories in cycles\r
+for iii=1:1:nSelectedDirectory  % Cycles for directories with files\r
+\r
+\r
+%%\r
+% read names of all files\r
+\r
+    FileType = '*.png';                                                     % extension of image file\r
+    FileName=([DirectoryName '\' cell2mat(SelectedDirectory(iii)) '\' FileType]);\r
+    FFiles = dir(FileName);                                                 % Loads files to struct FFiles(1).name, FFiles(1).folder, FFiles(1).date - i s casem\r
+    nFFiles = numel(FFiles);                                                % Counts files\r
+    \r
+%% variable allocation\r
+\r
+    LevelNum = zeros(1,nFFiles);\r
+    Heihgt = zeros(1,nFFiles);\r
+    Metr_fit_H = zeros(1,nFFiles);\r
+    Botom = zeros(1,nFFiles);\r
+    Metr_fit_B = zeros(1,nFFiles);\r
+\r
+%%\r
+% load of all files in cycles\r
+\r
+    step=1;\r
+    startFile= 40;                                          %945;   %200 (20. )\r
+    endFile= 110; %nFFiles;                                           %1000;  %325 (20.)\r
+    nFFiles=endFile;                                                        % Attention!!!\r
+    for jjj=[1 startFile:step:nFFiles]                                      % Cycles for figures files\r
+        ImageName = FFiles(jjj).name\r
+        Figure = imread([FFiles(jjj).folder '\' ImageName]);  \r
+        [p,q]=size(Figure);\r
+        ContrastFigure = imadjust(Figure);                                  % Adjust the contrast of the image using imadjust.\r
+    \r
+%%\r
+% Figure bands for average compution intensity, without the bands with hole and meter\r
+    \r
+        ContrastFigure1=ContrastFigure(floor(p*1/16):floor(p/8+p*1/16-3), 1:q);\r
+        [p1,q]=size(ContrastFigure1);\r
+        ContrastFigure2=ContrastFigure(floor(p/2+p/32):floor(p*3/4-p*1/16-5), 1:q);\r
+        [p2,q]=size(ContrastFigure2);\r
+        ContrastFigure3=ContrastFigure(floor(p*3/4+p*1/16):floor(p-p*1/16), 1:q);\r
+        [p3,q]=size(ContrastFigure3);\r
+        \r
+        ContrastFigureFin(1:p1,1:q)=ContrastFigure1;\r
+        ContrastFigureFin(p1+1:p1+p2,1:q)=ContrastFigure2;\r
+        ContrastFigureFin(p1+p2+1:p1+p2+p3,1:q)=ContrastFigure3;\r
+        \r
+        IntensitaAverFin{jjj}= mean(ContrastFigureFin);\r
+         \r
+        % figure\r
+        % imshow(ContrastFigure1)\r
+        % figure\r
+        % imshow(ContrastFigure2)\r
+        % figure\r
+        % imshow(ContrastFigure3)\r
+\r
+\r
+%%\r
+% Load the dimensions from the 1st image (p&q in pxl)\r
+        if jjj == 1\r
+\r
+%%\r
+% Meter \r
+            D_num=str2double(SelectedDirectory{iii}(21));                   % position of camera\r
+\r
+            reply = input('Is this a NEW EXPERIMENT that does not yet have calculated parameters for the cm scale? (y/n): ','s');          % y, n  Selects where to find parameters for the cm scale. Either in the array or guess them. \r
+            if strcmp(reply,'n')\r
+                AxisIntensArray=[22,22,22,22,25,27,7,7,7,7,7,23,3,20,11,2,4,19,6,25,3];                                                    % this needs to be guessed\r
+                AxisIntensUpArray=[60,60,65,65,34,5,29,29,29,29,29,22,26,2,27,2,28,2,29,2,29];                                             % this needs to be guessed\r
+                AxisEmptyArray=[190,190,190,190,200,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190];                      % this needs to be guessed 190\r
+                LevelMeterArray=[0.95,0.95,0.95,1,0.11,0.8,0.2,0.2,0.2,0.1,0.29,0.9,0.39,0.9,0.39,0.6,0.29,0.9,0.25,0.7,0.27];\r
+                AxisIntens=AxisIntensArray(Selected-13);                         % The number of all files minus 9 in which there is no data\r
+                AxisIntensUp=AxisIntensUpArray(Selected-13);       \r
+                AxisEmpty=AxisEmptyArray(Selected-13);         \r
+                LevelMeter=LevelMeterArray(Selected-13);        \r
+            elseif strcmp(reply,'y')\r
+                AxisIntens=25;         % 1.- 4. =22;  5. - 29 6.-27  7.8.9.11.11.-7   12.=23 13.=3                  % Right    this needs to be guessed\r
+                AxisIntensUp=2;        % 3. = 65; 1. a 2. = 60; 5. - 34 6. a 7.8.9.10.11. = 29  12.=22 13.=26       % Left     this needs to be guessed\r
+                AxisEmpty=190;         % 5. = 200; 6. 7.8.9.10.11.12.13 = 190                                       % this needs to be guessed 190\r
+                LevelMeter=0.7;        % 5. = 0.11, 4. = 1; 1., 2. a 3. = 0.95, 6. =0.9;  7.8.9.=0.2 10.=0.1 11.=0.29  12.=0.9 13.=0.39        % number on the meter so that the left dash is above the surface and the right is below the surface\r
+            end\r
+            \r
+            Meter=ContrastFigure(floor(p*3/4-p*1/16+p*1/64):floor(p*3/4+p*1/64), 1:q);\r
+            ContrastMeter = imadjust(Meter);\r
+            [r,s]=size(ContrastMeter);\r
+            ContrastMeterMid=ContrastMeter(floor(end/2),:);\r
+                       \r
+            hf1=figure ('Name','Contrasted meter','NumberTitle','off','PaperSize',[8.5 6],'PaperUnits','centimeters');  \r
+            imshow(ContrastMeter)\r
+            hold on\r
+            plot(ContrastMeterMid,'-m','linewidth',2)\r
+            hold on\r
+\r
+            for kkk=2:1:q \r
+                if kkk<(1-LevelMeter)*q && ContrastMeterMid(kkk)>AxisIntensUp                         % looks for intensity minima for dashes on the axis above the level, Left\r
+                    ContrastMeterMid(kkk)=0;\r
+                elseif kkk>=(1-LevelMeter)*q  && ContrastMeterMid(kkk)>AxisIntens                     % looks for intensity minima for dashes on the axis under the level, Right\r
+                    ContrastMeterMid(kkk)=0;\r
+                else\r
+                    ContrastMeterMid(kkk)=1;\r
+                end\r
+                if ContrastMeterMid(kkk) == ContrastMeterMid(kkk-1)         % looking for the right side of the peak\r
+                    ContrastMeterMid(kkk-1)=0;\r
+                end\r
+            end\r
+            for mmm=q:-1:AxisEmpty \r
+                if ContrastMeterMid(mmm)==1                                 % erases the peaks (written numbers) to the left of the dashes on the axis\r
+                    ContrastMeterMid((mmm-AxisEmpty):mmm-1)=0;\r
+                    mmm=mmm-AxisEmpty;\r
+                end\r
+            end\r
+            ooo=1;\r
+            for nnn=1:1:q \r
+                if ContrastMeterMid(nnn)==1                                 % Writes x places of dashes on the axis\r
+                    MeterScale(ooo)=nnn;\r
+                    ooo=ooo+1;\r
+                end\r
+            end\r
+\r
+            if D_num==1\r
+                plot(MeterScale, [floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2)],'oc','linewidth',2)\r
+            elseif D_num==2\r
+                plot(MeterScale(1:end-1), [floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2);floor(r/2)],'oc','linewidth',2)\r
+            end\r
+%--------------------------------------------------------------------------\r
+            print ('-dpng', '-r1200', ['Contrasted_meter.png'])\r
+%--------------------------------------------------------------------------\r
+\r
+\r
+            hf2=figure ('Name','Intensity minima for dashes on the axis','NumberTitle','off','PaperSize',[8.5 6],'PaperUnits','centimeters');  \r
+            plot(ContrastMeterMid,'-m','linewidth',2)\r
+            \r
+            xlim([1,q]);\r
+            ylim([0,1]);\r
+%--------------------------------------------------------------------------\r
+            print ('-dpng', '-r1200', ['Intensity_places_dashes.png'])\r
+%--------------------------------------------------------------------------\r
+clear Meter\r
+clear ContrastMeter\r
+clear ContrastMeterMid\r
+\r
+% Calculation of the actual position in mm using the scale of the meter\r
+           \r
+            hf3=figure ('Name','Dashes scale','NumberTitle','off','PaperSize',[8.5 6],'PaperUnits','centimeters');  \r
+            if D_num==1\r
+                plot(MeterScale,[1000;900;800;700;600;500;400;300;200;100],'ob','linewidth',2)\r
+                hold on\r
+                polypar_Metr = polyfit(MeterScale,[1000;900;800;700;600;500;400;300;200;100],2);\r
+            elseif D_num==2\r
+                plot(MeterScale(1:end-1),[1800;1700;1600;1500;1400;1300;1200;1100],'ob','linewidth',2)\r
+                hold on\r
+                polypar_Metr = polyfit(MeterScale(1:end-1),[1800;1700;1600;1500;1400;1300;1200;1100],2);\r
+            end\r
+            no_layer_fit=1: 1 : q;\r
+            Metr_fit=polyval(polypar_Metr,no_layer_fit);\r
+            plot(no_layer_fit,Metr_fit,'-r','linewidth',2);\r
+            hold on\r
+            if D_num==1\r
+                xlim([0,q]);\r
+                ylim([0,1200]);\r
+            elseif D_num==2\r
+                xlim([0,q]);\r
+                ylim([0,2000]);\r
+            end\r
+%--------------------------------------------------------------------------\r
+            print ('-dpng', '-r1200', 'Dashes_scale.png')\r
+%--------------------------------------------------------------------------\r
+\r
+            xlswrite(ResFile,{'Contrasted meter'},['Met ' cell2mat(SelectedDirectory(iii))],'A2'); %[cell2mat(SelectedDirectory(iii)) ': Meter scale'],'A1'); ['Meter scale ' num2str(iii)]\r
+            xlswritefig(hf1, ResFile, ['Met ' cell2mat(SelectedDirectory(iii))] , 'A4')\r
+            xlswrite(ResFile,{'Intensity: places of dashes on the axis'},['Met ' cell2mat(SelectedDirectory(iii))],'A6');\r
+            xlswritefig(hf2, ResFile, ['Met ' cell2mat(SelectedDirectory(iii))], 'B8')\r
+            xlswrite(ResFile,{'Dashes scale'},['Met ' cell2mat(SelectedDirectory(iii))],'K6'); \r
+            xlswritefig(hf3, ResFile, ['Met ' cell2mat(SelectedDirectory(iii))], 'L8')\r
+            xlswrite(ResFile,[{'Meter Scale'} {'Dashes scale'}],['Met ' cell2mat(SelectedDirectory(iii))],'A28'); \r
+            xlswrite(ResFile,[{'AxisIntens'} {'AxisIntensUp'} {'AxisEmpty'} {'LevelMeter'}],['Met ' cell2mat(SelectedDirectory(iii))],'D28'); \r
+            if D_num==1\r
+                xlswrite(ResFile,[MeterScale' [1000;900;800;700;600;500;400;300;200;100]],['Met ' cell2mat(SelectedDirectory(iii))],'A29'); \r
+            elseif D_num==2\r
+                xlswrite(ResFile,[MeterScale(1:end-1)' [1800;1700;1600;1500;1400;1300;1200;1100]],['Met ' cell2mat(SelectedDirectory(iii))],'A29'); \r
+            end\r
+            xlswrite(ResFile,[{AxisIntens} {AxisIntensUp} {AxisEmpty} {LevelMeter}],['Met ' cell2mat(SelectedDirectory(iii))],'D29'); \r
+\r
+        end\r
+%%\r
+% Figure with average intensity, without the bands with hole and meter\r
+        figure\r
+        imshow(ContrastFigure)\r
+        hold on\r
+        plot(IntensitaAverFin{jjj},'-y','linewidth',2)\r
+        hold on\r
+        if jjj>=startFile+step                                                            %subtracts the intensities\r
+            plot(IntensitaAverFin{jjj-step},'Color',[0.9290 0.6940 0.1250],'linewidth',2)\r
+            hold on\r
+            IntensitaAverFin_2{jjj}=IntensitaAverFin{jjj}-IntensitaAverFin{jjj-step};\r
+            waytrend=mean(IntensitaAverFin_2{jjj},2);                                  % waytrend will tell whether to calculate the minimum or maximum green intensity IntensitaAverFin_2{jjj}\r
+            if waytrend<=0;\r
+                plot(-IntensitaAverFin_2{jjj},'-g','linewidth',2)\r
+            else\r
+                plot(IntensitaAverFin_2{jjj},'-g','linewidth',2)\r
+            end\r
+            hold on\r
+        end\r
+\r
+        infmt = 'hh:mm:ss.SS';\r
+        Time(jjj)=duration([(FFiles(jjj).name(8:9)) ':' (FFiles(jjj).name(10:11)) ':' (FFiles(jjj).name(12:16))],'Format',infmt)-duration([(FFiles(1).name(8:9)) ':' (FFiles(1).name(10:11)) ':' (FFiles(1).name(12:16))],'Format',infmt);\r
+        infmd = ['yy' 'MM' 'dd'];\r
+        Date(jjj) = datetime(FFiles(jjj).name(1:6),'InputFormat',infmd);\r
+        Level(jjj,1:3)=SelectedDirectory{iii}(7:9);\r
+        LevelNum(1,jjj)=str2double(Level(jjj,:))*1000;\r
+\r
+        % % plot(lk,abs(pk),'oc','linewidth',2)\r
+        if D_num==1\r
+            LevelPixels=MeterScale(1+(1000-LevelNum(1,jjj))/100);                 % x level in pixels in the original image\r
+            [pk,lk] = findpeaks(-IntensitaAverFin{jjj}(1:(LevelPixels+30)));  %10\r
+            [Heihgt(1,jjj),pkH]=max(pk);\r
+            qH=lk(pkH);\r
+            Metr_fit_H(1,jjj)=polyval(polypar_Metr,qH);\r
+            plot(qH,-Heihgt(jjj),'or','linewidth',2)\r
+            if jjj>=startFile+step \r
+                LevelPixels=MeterScale(1+(1000-LevelNum(1,jjj))/100);             % x level in pixels in the original image\r
+                if waytrend<=0;\r
+                    [pk,lk] = findpeaks(-IntensitaAverFin_2{jjj}(1:(LevelPixels+30)));  %10\r
+                else\r
+                    [pk,lk] = findpeaks(IntensitaAverFin_2{jjj}(1:(LevelPixels+30)));  %10\r
+                end\r
+                [Heihgt(1,jjj),pkH]=max(pk);\r
+                if max(pk)>=10;                                                 % error cleaning %30\r
+                    qH=lk(pkH);\r
+                    Metr_fit_H(1,jjj)=polyval(polypar_Metr,qH);\r
+                end\r
+                plot(qH,Heihgt(jjj),'om','linewidth',2)\r
+            end\r
\r
+        elseif D_num==2\r
+            if jjj<startFile+step \r
+                LevelPixels=MeterScale(1);                 % x level in pixels in the original image\r
+                [pk,lk] = findpeaks(-IntensitaAverFin{jjj}(LevelPixels:end));  %10\r
+                [Heihgt(1,jjj),pkH]=max(pk);\r
+                qH=LevelPixels+lk(pkH);\r
+                Metr_fit_H(1,jjj)=polyval(polypar_Metr,qH);\r
+                plot(qH,-Heihgt(jjj),'or','linewidth',2)\r
+            elseif jjj>=startFile+step \r
+                    LevelPixels=MeterScale(1);                 % x level in pixels in the original image\r
+                if waytrend<=0;\r
+                    [pk,lk] = findpeaks(-IntensitaAverFin_2{jjj}(LevelPixels:end));  %10\r
+                else\r
+                    [pk,lk] = findpeaks(IntensitaAverFin_2{jjj}(LevelPixels:end));  %10\r
+                end\r
+                    [Heihgt(1,jjj),pkH]=max(pk);\r
+                    qH=LevelPixels+lk(pkH);\r
+                    Metr_fit_H(1,jjj)=polyval(polypar_Metr,qH);\r
+                    if max(pk)<30;                                                 % error cleaning %30\r
+                        qH=NaN;\r
+                        Metr_fit_H(1,jjj)=NaN;\r
+                    end\r
+                    plot(qH,Heihgt(jjj),'om','linewidth',2)\r
+            end\r
+        end\r
+\r
+        if D_num==1\r
+            if jjj<startFile+step \r
+                [pk2,lk2] = findpeaks(-IntensitaAverFin{jjj},'MinPeakProminence',5);                         % Small peaks at the bubble/liquid interface\r
+        \r
+                [pk3,lk3] = findpeaks(-IntensitaAverFin{jjj},'MinPeakProminence',5,'MinPeakDistance',30);    % Throw out small random peaks in the liquid, peaks far apart cca 1cm\r
+                [one,nqq]=size(lk3);\r
+                [one,npp]=size(lk2);\r
+        \r
+                if npp==0\r
+                    pk2=NaN;\r
+                    lk2=NaN;\r
+                elseif nqq==0\r
+                    pk3=NaN;\r
+                    lk3=NaN;\r
+                end\r
+        \r
+                for qqq=1:1:nqq\r
+                    for ppp=1:1:npp\r
+                        if lk3(qqq)==lk2(ppp)\r
+                            pk2(ppp)=NaN;\r
+                            lk2(ppp)=NaN;\r
+                        end\r
+                    end\r
+                end\r
+        \r
+                % % plot(lk2,abs(pk2),'om','linewidth',2)\r
+                hold on\r
+        \r
+                [Botom(1,jjj),pk2B]=max(abs(pk2));        % For 1-4 files\r
+                qB=lk2(pk2B);                             % For 1-4 files\r
+              \r
+                Metr_fit_B(1,jjj)=polyval(polypar_Metr,qB);\r
+                if Metr_fit_B(1,jjj)>=(Metr_fit_H(1,jjj)-2)                                 % Throw out the bubble/liquid interface if it is above the surface, 2cm 2D interface\r
+                    Metr_fit_B(1,jjj)=NaN;\r
+                    qB=NaN;\r
+                elseif Botom(1,jjj)<=(max(abs(pk))+min(abs(pk)))*0.62                     % 0.65 is an estimate of how much intensity the bubbles need\r
+                    Metr_fit_B(1,jjj)=NaN;                                                % For 1-4 files\r
+                    qB=NaN;\r
+                end\r
+                plot(qB,Botom(jjj),'ob','linewidth',2)\r
+            end\r
+    \r
+            if jjj>=startFile+step \r
+                LevelPixels=MeterScale(1+(1000-LevelNum(1,jjj))/100);                 % x level in pixels in the original image\r
+                if waytrend<=0;\r
+                    [pk2,lk2] = findpeaks(-IntensitaAverFin_2{jjj}(LevelPixels:end));  %10\r
+                else\r
+                    [pk2,lk2] = findpeaks(IntensitaAverFin_2{jjj}(LevelPixels:end));  %10\r
+                end                    \r
+                [Botom(1,jjj),pk2B]=max(pk2);\r
+                qB=LevelPixels+lk2(pk2B);                            \r
+                Metr_fit_B(1,jjj)=polyval(polypar_Metr,qB);\r
+                if max(pk2)<=45;                                                            % error cleaning\r
+                    qB=NaN;\r
+                    Metr_fit_B(1,jjj)=NaN;\r
+                end\r
+                plot(qB,Botom(jjj),'oc','linewidth',2)\r
+            end\r
+        \r
+        elseif D_num==2\r
+            if jjj<startFile+step \r
+                [pk2,lk2] = findpeaks(-IntensitaAverFin{jjj},'MinPeakProminence',5);                         % Small peaks at the bubble/liquid interface\r
+        \r
+                [pk3,lk3] = findpeaks(-IntensitaAverFin{jjj},'MinPeakProminence',5,'MinPeakDistance',30);    % Throw out small random peaks in the liquid, peaks far apart cca 1cm\r
+                [one,nqq]=size(lk3);\r
+                [one,npp]=size(lk2);\r
+        \r
+                if npp==0\r
+                    pk2=NaN;\r
+                    lk2=NaN;\r
+                elseif nqq==0\r
+                    pk3=NaN;\r
+                    lk3=NaN;\r
+                end\r
+        \r
+                for qqq=1:1:nqq\r
+                    for ppp=1:1:npp\r
+                        if lk3(qqq)==lk2(ppp)\r
+                            pk2(ppp)=NaN;\r
+                            lk2(ppp)=NaN;\r
+                        end\r
+                    end\r
+                end\r
+        \r
+                % % plot(lk2,abs(pk2),'om','linewidth',2)\r
+                hold on\r
+        \r
+                [Botom(1,jjj),pk2B]=max(abs(pk2));        % For 1-4 files\r
+                qB=lk2(pk2B);                             % For 1-4 files\r
+        \r
+                % [Botom(1,jjj),pk2B]=max(abs(pk));           % For 5. files\r
+                % qB=lk(pk2B);                                % For 5. files\r
+        \r
+                Metr_fit_B(1,jjj)=polyval(polypar_Metr,qB);\r
+                if Metr_fit_B(1,jjj)>=(Metr_fit_H(1,jjj)-2)                                 % Throw out the bubble/liquid interface if it is above the surface, 2cm 2D interface\r
+                    Metr_fit_B(1,jjj)=NaN;\r
+                    qB=NaN;\r
+                elseif Botom(1,jjj)<=(max(abs(pk))+min(abs(pk)))*0.62                     % 0.65 is an estimate of how much intensity the bubbles need\r
+                    Metr_fit_B(1,jjj)=NaN;                                                % For 1-4 files\r
+                    qB=NaN;\r
+                end\r
+                plot(qB,Botom(jjj),'ob','linewidth',2)\r
+            end\r
+    \r
+            if jjj>=startFile+step \r
+                LevelPixels=MeterScale(1);                 % x level in pixels in the original image\r
+                if waytrend<=0;\r
+                    [pk2,lk2] = findpeaks(-IntensitaAverFin_2{jjj}(LevelPixels:end));  %10\r
+                else\r
+                    [pk2,lk2] = findpeaks(IntensitaAverFin_2{jjj}(LevelPixels:end));  %10\r
+                end\r
+                [Botom(1,jjj),pk2B]=max(pk2);\r
+                qB=LevelPixels+lk2(pk2B);                            \r
+                Metr_fit_B(1,jjj)=polyval(polypar_Metr,qB);\r
+                if max(pk2)<=20;                                                          % error cleaning\r
+                    qB=NaN;\r
+                    Metr_fit_B(1,jjj)=NaN;\r
+                end\r
+                plot(qB,Botom(jjj),'oc','linewidth',2)\r
+            end\r
+        end\r
+\r
+        xlswrite(ResFile,[{'ImageName'} {'Date'} {'Time [s]'} {'Intensita Heihgt [-]'} {'Intensita Botom [-]'} {'Heihgt [cm]'} {'Botom [cm]'} {'Level [cm]'}],cell2mat(SelectedDirectory(iii)),'A1:H1'); \r
+        xlswrite(ResFile,[{ImageName} {string(Date(1,jjj))} {seconds(Time(1,jjj))} {Heihgt(1,jjj)} {Botom(1,jjj)} {Metr_fit_H(1,jjj)} {Metr_fit_B(1,jjj)} {str2double(SelectedDirectory{iii}(7:9))}], cell2mat(SelectedDirectory(iii)),['A' num2str(jjj+1) ':H' num2str(jjj+1)]); \r
+\r
+\r
+        clear Figure\r
+        clear ContrastFigure\r
+        clear ContrastFigure1\r
+        clear ContrastFigure2\r
+        clear ContrastFigure3\r
+        clear ContrastFigureFin\r
+        % clear IntensitaAverFin\r
+\r
+    end  % jjj, Cycles for figures files\r
+    \r
+    hf4=figure ('Name','Velocity','NumberTitle','off','PaperSize',[8.5 6],'PaperUnits','centimeters');  \r
+    hp1=plot(seconds(Time(startFile:step:end)), Metr_fit_H(startFile:step:nFFiles),'-or','linewidth',2); %    [1 startFile:step:nFFiles]\r
+    hold on\r
+    hp2=plot(seconds(Time(startFile:step:end)), Metr_fit_B(startFile:step:nFFiles),'-ob','linewidth',2);\r
+    hold on\r
+    hp3=plot(seconds(Time(startFile:step:end)),LevelNum(1,startFile:step:nFFiles)','-og','linewidth',2);\r
+        \r
+    xlabel('time [s]','FontWeight','bold');\r
+    ylabel('position [cm]','FontWeight','bold');\r
+    grid('on');\r
+    [legend_h,object_h,plot_h,text_strings] = legend([hp1,hp2,hp3],'Heihgt', 'Botom', 'Level','Location','southeast' );\r
+    set(legend_h, 'Box', 'off', 'FontSize',7)\r
+\r
+%--------------------------------------------------------------------------\r
+    print ('-dpng', '-r1200', 'Velocity.png')\r
+%--------------------------------------------------------------------------\r
+\r
+\r
+    xlswritefig(hf4, ResFile, cell2mat(SelectedDirectory(iii)), 'J2')\r
+\r
+end  % iii, Cycles for directories with files\r
+\r
diff --git a/README.txt b/README.txt
new file mode 100755 (executable)
index 0000000..f35e1a8
--- /dev/null
@@ -0,0 +1,20 @@
+-main program for the evaluation of experiments in BC is:\r
+GasHoldUpSO15092023\r
+\r
+two sets of data are available for evaluation (that should be possible to evaluate):\r
+MATLAB Processing-LUK  \r
+UPW_Lab5_22062022\r
+\r
+other set of data are available for evaluation (that are not possible to evaluate with the current program):\r
+2023-08 16 - D19cm L0.8m do0.5mm\r
+\r
+\r
+name of the folders with images have the following structure:\r
+liquid phase_liquid height(in m)_superficial gas velocity(in m/s)_type of experiment(G=gas holdup; D=disengagement/shut down; E=engagement/startup)_repetition_heigh of the bottom of the column(in mm)\r
+G.150_0.6_0.0050_G_01_0525 means:\r
+liquid phase: 15% solution of glycerol\r
+liquid height L = 0.6 m\r
+superficial gas velocity q = 0.005 m/s\r
+type of experiment: G (gas holdup)\r
+repetition: 1st\r
+heigh of the bottom of the column: 525 mm\r