%2020-02-25 ROI Run script

clear
clc

%% Sweep Inputs
Repeats = 5;
R_range = 1.5;
L_range = [1.1 1.15 1.2];
tau_range = 52.1*60; 
mass_range = 5.5;
eta = 0.2;

ExpDuration = 4*3600;
MakeMovie = 0;
PrintData = 1;

%% Iteration Inputs
Nit_range = [];     %Input final number of iterations for each trial. 
                        %Must be done manually
                        PlotInterval = 18;    
PlotInterval = 70;  %This is the frequency of data output. 
                        %To set this to the correct value, open the
                        %directory "Data" and set this to the number that
                        %the first file ends in
                        
%% Movie types
PhiMov = 0;
ROIRetractMov = 0;
ColorSurfTraffMov = 0;

%% ROI-specific Inputs
Trial = 10;

%Bulk ROI
XLow = -7.5;
XHigh = 7.5;
YLow = -7.5;
YHigh = 7.5;
BulkROI = [XLow     YLow;   %BL
           XHigh    YLow;   %BR
           XHigh    YHigh;   %TR
           XLow     YHigh];  %TL
Bulkt0 = 10;
Bulktf = 60;   %min

%Decay ROI
XLow = -10;
XHigh = 5;
YLow = 2.5;
YHigh = 45;
DecayROI = [XLow     YLow;   %BL
           XHigh    YLow;   %BR
           XHigh    YHigh;   %TR
           XLow     YHigh];  %TL
Decayt0 = 72;
Decaytf = 77;   %min

%Prot ROI
XLow = -50;
XHigh = -25;
YLow = -5;
YHigh = 10;
ProtROI = [XLow     YLow;   %BL
           XHigh    YLow;   %BR
           XHigh    YHigh;   %TR
           XLow     YHigh];  %TL
Prott0 = 15;
Prottf = 30;   %min
ProtNo = 1;
                        
ct=0;
for h = 1:Repeats
    for i=1:size(R_range,2)
        for k=1:size(L_range,2)
            for l=1:size(tau_range,2)
                for m=1:size(mass_range,2)
                    ct=ct+1;
                    Package(ct,1) = R_range(i);
                    Package(ct,2) = L_range(k);
                    Package(ct,3) = tau_range(l);
                    Package(ct,4) = mass_range(m);
                    Package(ct,5) = h;
                end
            end
        end
    end
end

AllData = [];
AllAvgData = [];
for i = Trial
    R0 = Package(i,1);
    L = Package(i,2);
    Tau = Package(i,3);
    TotalMass = Package(i,4);
    NoIt = Nit_range(i);
    
    ROIPostProcess(Trial,ExpDuration,R0,L,Tau,TotalMass,...
        NoIt,PlotInterval,BulkROI,Bulkt0,Bulktf,ProtROI,Prott0,Prottf,...
        DecayROI,Decayt0,Decaytf,eta,...
        ProtNo,PhiMov,ROIRetractMov,ColorSurfTraffMov);
end

