Commit 113bce12 authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

Created

parent 5326c6e4
Loading
Loading
Loading
Loading

power_dist_test.m

0 → 100644
+65 −0
Original line number Diff line number Diff line
clear
close all

cd /data/Sorgenti/SCORPIUS-X-1/
diary(['log_pow_dist_',char(datetime('now','Format','dd_MM')),'.log'])
mario = split(ls('*.fits'));
mario = mario(~cellfun('isempty',mario));
import matlab.io.*
Nyq = 2000
Tseg = 512
dt = 1/(2*Nyq);
N = fix(Tseg/dt);
ted = (0:dt:Tseg);
tm = (0.5*dt:dt:(Tseg-0.5*dt));
F1=gpuArray((0:N-1)./(N*dt)).';
for i = 1:length(mario)
    filoc = [pwd,'/',char(mario(i))]
    % file = fits.openFile(filoc)
    % fits.closeFile(file);
    t_raw = fitsread(filoc,"binarytable");
    t_raw = t_raw{1};
    t_raw = t_raw(t_raw<(t_raw(1)+Tseg));
    Nphot = length(t_raw);
    [xtemp,t]=(histcounts(t_raw,ted));
    Y0 = fft(xtemp);
end


% load('counts_check_Tseg_490_.mat')
% Y0 = 2.0.*(abs(fft(x(:,1))).^2)./sum(x(:,1));
% F1=((0:N-1)./(N*dt)).';
% mean(Y0)
% mean(Y0(9*N/20:N/2))
% Y0sub = Y0 - 2.300035862611959
% Y0sub = Y0 - 0.300035862611959;
% Y0div = Y0./(ans);
% mean(Y0div(9*N/20:N/2))
% Y0div = 2.0*Y0./(ans);
% Y0div = 2.0*Y0./(mean(Y0(9*N/20:N/2)));
% F0(9*N/20)
% F1(9*N/20)
% F1(N/2)
% F1(N/2+1)
% F0 = F1(2:N/2+1);
% Y0 = Y0(2:N/2+1);
% Y0div = Y0div(2:N/2+1);
% Y0sub = Y0sub(2:N/2+1);
% loglog(F0,Y0,F0,Y0sub,F0,Y0div)
% semilogy(F0,Y0,F0,Y0sub,F0,Y0div)
% yline(2)
% max(Y0)
% max(Y0div)
% max(Y0sub)
% powedges = (0.0:1.0:52.0);
% [histno,~] = histcounts(Y0,powedges,'normalization','pdf');
% Y02 = Y0(end/2:end);
% Y0div2 = Y0(end/2:end);
% Y0div2 = Y0div(end/2:end);
% Y0sub2 = Y0sub(end/2:end);
% F02 = F0(end/2:end);
% [histno,~] = histcounts(Y02,powedges,'normalization','pdf');
% [histnodiv,~] = histcounts(Y0div2,powedges,'normalization','pdf');
% [histnosub,~] = histcounts(Y0sub2,powedges,'normalization','pdf');
% powmid(1:52) = (powedges(2:53)+powedges(1:52))./2;
% semilogy(powmid,histno,'o',powmid,histnodiv,'+',powmid,chi2pdf(powmid,(2.0)),powmid,histnosub,'*')
 No newline at end of file