%% Propagation plot
% Subscript used to plot the propagation of the field
% using waterplots.


%% Propagation of pump

        plotPumpPower = powerplot(2);
        plotlimZ = floor(linspace(Param.z_steps/1.3,Param.z_steps,8));
        figure(12);
        w12 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w12,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(3);
        plotlimZ = floor(linspace(Param.z_steps/1.3,Param.z_steps,8));
        figure(13);
        w13 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w13,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(4);
        plotlimZ = floor(linspace(Param.z_steps/2,Param.z_steps,8));
        figure(14);
        w14 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w14,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(5);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(15);
        w15 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w15,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(6);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(16);
        w16 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w16,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(7);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(17);
        w17 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w17,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(8);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(18);
        w18 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Pump.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{pump}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w18,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Pump-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
%% Propagation of signal
    
        plotPumpPower = powerplot(2);
        plotlimZ = floor(linspace(Param.z_steps/1.3,Param.z_steps,8));
        figure(22);
        w22 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w22,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(3);
        plotlimZ = floor(linspace(Param.z_steps/1.3,Param.z_steps,8));
        figure(23);
        w23 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w23,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(4);
        plotlimZ = floor(linspace(Param.z_steps/2,Param.z_steps,8));
        figure(24);
        w24 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w24,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(5);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(25);
        w25 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w25,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(6);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(26);
        w26 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w26,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(7);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(27);
        w27 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w27,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        plotPumpPower = powerplot(8);
        plotlimZ = floor(linspace(1,Param.z_steps,8));
        figure(28);
        w28 = waterfall(Axis.t_ns(plotPumpPower,plotlimit).*1e3,Axis.z_mm(plotPumpPower,plotlimZ),squeeze(Signal.I.depleted(plotPumpPower,plotlimZ,plotlimit)).*1e-9);
        title(['$I_{Signal}^{+dep.}\,\,(\tau,z)\,$ @ ' int2str(power(plotPumpPower)./1000) 'kW'],'Interpreter','latex','FontSize',FontSize+4);
        xlabel('$\tau~[ps]$','Interpreter','latex','FontSize',FontSize);
        ylabel('$z~[mm]$','Interpreter','latex','FontSize',FontSize);
        zlabel('$I~[GW/m^2]$','Interpreter','latex','FontSize',FontSize);
        set(w28,'edgecolor','k');
        %zlim([0 2e11])
        view([-140 50])
        export_fig(['Propagation-' plotName '-Signal-Depleted-PumpPower' int2str(power(plotPumpPower)./1000) 'kW'], '-pdf', '-transparent');
        
        
%% compare signal energy
ColorSet=varycolor(size(powerplot,2));

figure(1003)
hold all
for nn=1:size(powerplot,2)
    plot(Axis.z_mm(nn,:),Signal.Energy.depleted(nn,:)./Pump.Energy.depleted(nn,1),'LineWidth',1.5,'Color',ColorSet(nn,:),'DisplayName','kW');
    legendInfo{nn} = [int2str(power(powerplot(nn))./1000) 'kW'];
end
hold off;
    l1003 = legend(legendInfo,...%'First','Second','Third','4th','5th','6th','7th','8th','9th','10th',...
        'Orientation','vertical','Location','EastOutside');
    set(l1003,'Interpreter','latex','color','none');
    PlotSetAxisLabels('z [mm]','$\eta~[a.u.]$',18);
    PlotSetFigureDimensions(1,5,22,10,0,0,0,0);
    PlotSetAxisProperties(5,3,20);
    set(gca, 'Units', 'normalized','Position', [0.15 0.22 0.62 0.55]);
    set(gca, 'Color', 'none'); % Sets axes background
    export_fig(['Propagation-' plotName '-SignalEnergy-Depleted-PumpPower'], '-pdf', '-transparent');

figure(1004)
hold on;
for nn=1:size(powerplot,2)
    plot(Axis.z_mm,Signal.Energy.undepleted(nn,:)./Pump.Energy.undepleted(nn,1),'LineWidth',1.5,'Color',ColorSet(nn,:));
end
hold off;
set(gca,'YScale','log');

%% Signal center value
% figure(1005)
% hold all
% for nn=1:size(powerplot,2)
%     plot(Axis.z_mm(nn,:),squeeze(Signal.I.depleted(nn,:,floor(end/2))).*1e-9,'LineWidth',1.5,'Color',ColorSet(nn,:),'DisplayName','kW');
%     legendInfo{nn} = [int2str(power(powerplot(nn))./1000) 'kW'];
% end
% hold off;
%     l1005 = legend(legendInfo,...%'First','Second','Third','4th','5th','6th','7th','8th','9th','10th',...
%         'Orientation','vertical','Location','EastOutside');
%     set(l1005,'Interpreter','latex','color','none');
%     title('$I_{Signal}\,\,(0,z)\,$','Interpreter','latex','FontSize',FontSize+4);
%     PlotSetAxisLabels('z [mm]','$I~[GW/m^2]$',18);
%     PlotSetFigureDimensions(1,5,22,10,0,0,0,0);
%     PlotSetAxisProperties(5,3,20);
%     set(gca, 'Units', 'normalized','Position', [0.15 0.22 0.62 0.55]);
%     set(gca, 'Color', 'none'); % Sets axes background
%     export_fig(['Propagation-' plotName '-SignalCenterIrradiance-Depleted-SignalPower'], '-pdf', '-transparent');
   
