

files = ["imdd_simulation\projects\MPI_April\wh_pam4_dienstag.mat","imdd_simulation\projects\MPI_April\wh_pam6_dienstag.mat"];
linesstyles = ["-","--"];

vp = wh.parameter.vp.values;
vb = wh.parameter.vb.values;
sir = wh.parameter.sir.values(end);
rop = wh.parameter.rop.values(end);
lw = wh.parameter.laser_linewidth.values(1);
pn_key = wh.parameter.pn_key.values;
bias = wh.parameter.vb.values(1:end-3);

figure()
tiledlayout(2,3)
cols = flip(cbrewer2("RdYlBu",32));

for d = 1:2
    load(files(d));
    nexttile
    for lw = wh.parameter.laser_linewidth.values
        
        curcspr = [];
        meancspr = [];
        for v = 1:numel(wh.parameter.vp.values)
            vp_ = wh.parameter.vp.values(v);

            for b = 1:numel(bias)
                for k = pn_key
                    curcspr(k,b) = wh.getStoValue('cspr',sir,lw,k,vp_,bias(b),rop);
                end
            end

            meancspr(v,:) =  mean(curcspr,1);
            hold on
            plot(2-bias,meancspr(v,:),'DisplayName',['vpp: ',num2str(vp_)]);
            
        end
        

        if d == 1
            title(['PAM4 - SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
        elseif d == 2
            title(['PAM6 - SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
        end

    end
end

