Commit b06386cd authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

Aggiunta divisione in segmenti

parent a463eff9
Loading
Loading
Loading
Loading
+54 −45
Original line number Diff line number Diff line
@@ -32,10 +32,13 @@ for i = 1:length(mario)
    % fits.closeFile(file);
    t_raw = fitsread(filoc,"binarytable");
    t_raw = t_raw{1};
    t_raw = t_raw(t_raw<(t_raw(1)+Tseg));
    t_raw = t_raw - t_raw(1);
    Nphot = length(t_raw);
    [xtemp,~]=(histcounts(t_raw,ted));
    M=fix((t_raw(end)-t_raw(1))/Tseg);
    for m = 1:M
        tsplit = t_raw((t_raw>(t_raw(1)+Tseg*(m-1)))&(t_raw<(t_raw(1)+Tseg*m)));
        % t_raw = t_raw(t_raw<(t_raw(1)+Tseg));
        tsplit = tsplit - tsplit(1);
        Nphot = length(tsplit);
        [xtemp,~]=(histcounts(tsplit,ted));
        xtemp = gpuArray(xtemp);
        Y0 = abs(fft(xtemp));
        Y0 = 2.0.*(Y0(1:N/2+1).^2)./Y0(1);
@@ -45,9 +48,12 @@ for i = 1:length(mario)
            Yqlbin(nino) = sum(Y0((Fqlog(nino)<=F0)&(F0<Fqlog(nino+1))));
        end
        Yqlbin(:) = Yqlbin(:)./(Fqlbin(:).*Tseg);
    xlim([100 3000])

        yme = mean(Y0(100*Tseg+1:end));
        semilogx(Fqlmid,Yqlbin)
    yline(mean(Y0(100*Tseg+1:end)))
        xlim([100 3000])
        ylim([yme*0.8 yme*1.2])
        yline(yme)
        pause


@@ -73,15 +79,18 @@ for i = 1:length(mario)
                p8l(k) = p8l(5)*(1-r8l)^(k-5);
            end
            vard = var(xtemp)
        vartot/expectot
        vard/mean(xtemp)
        mean(Y0(100*Tseg+1:end))/2
            vsuetot = vartot/expectot
            vsuedat = vard/mean(xtemp)
            meanpow = mean(Y0(100*Tseg+1:end))/2
            meanpow/vsuetot
            meanpow/vsuedat
        else
            disp('Too many counts!')
            disp(['Avg. counts per bin :',num2str(mean(xtemp)/N),'.']);
        end
        pause
    end
end


% % xtemp = x(:,1);