Commit 2515aec9 authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

Fixed wrong power distribution arising if the time series was rebinned during the second step

parent 4c829d7a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ function [extrVoverE,CrossTalkProb,HalfMeanPow] = powdist(NyqFreq,LC,Binned,PSna
%   PowDisname is the filename for the graph containing the comparison of 
%   a chi^2 distribution with two degrees of freedom vs our power
%   distribution, both with "input" powers and the PS renormalized by
%   2*HalfMeanPow
%   HalfMeanPow
%   
%   Output arguments:
%   extrVoverE are the three values of the expected Var/E assuming 8-pixel,
@@ -57,6 +57,7 @@ Fqlmid(1:nbqlog) = 0.5*(Fqlog(2:end)+Fqlog(1:end-1));
Fqlbin(1:nbqlog) = Fqlog(2:end)-Fqlog(1:end-1);
Y0 = abs(fft(xtemp));
Y0 = 2.0.*(Y0(1:floor(N/2)+1).^2)./Y0(1);
PSgeq10 = Y0(ceil(Tseg*10)+1:end);
Yqlbin = zeros(size(Fqlbin));
for nino = 1:nbqlog
    Yqlbin(nino) = sum(Y0((Fqlog(nino)<=F0)&(F0<Fqlog(nino+1))));
@@ -219,14 +220,13 @@ HalfMeanPow = meanpow;

%% Part III: Power distribution at frequencies >= 10 Hz, comparison with chi^2_2 

PSgeq10 = Y0(ceil(Tseg*10)+1:end);
Fgeq10 = F0(ceil(Tseg*10)+1:end);
maxp = max(PSgeq10);
pedges = (0:1:ceil(maxp));
pmid = (0.5:1:ceil(maxp)-0.5);
Pcounts= fastcounts(PSgeq10,pedges);
Pcounts= histcounts(PSgeq10,pedges);
sumpc = sum(Pcounts);
Pcountsresc = fastcounts(PSgeq10./(2*HalfMeanPow),pedges);
Pcountsresc = histcounts(PSgeq10./HalfMeanPow,pedges);
sumpcresc = sum(Pcounts);

t = tiledlayout(2,1);