Commit 9bf33423 authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

Created scsearch

parent ff720523
Loading
Loading
Loading
Loading

scsearch.m

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

% Define variables, M is segm. number
pathfi = './';

finame = 'franco.fits';
t = fitsread([pathfi,finame],"binarytable");
t = t{1};
% info = fitsinfo(finame).BinaryTable.Keywords;
% for i = 1:length(info)
%     if (isequal(info{i},'TIMEDEL'))
%         res = info{i,2};
%     end
% end

% % Controlli sui tempi
% for i = 1:(length(t)-1)
%     if (t(i+1)-t(i)>= res*1.001)

% Prendi da file il tspan
tspan = t(end)-t(1);
param = [f_min,f_max,porb_min,porb_max,a_min,a_max,tasc_min,tasc_max];
t0 = (t(end)+t(1))/2;

% Aux par
Omega_max = 2*pi/porb_min;
Omega_min = 2*pi/porb_max;
gamma_min = Omega_min*(t0-tasc_max);
gamma_max = Omega_max*(t0-tasc_min);

% Time matrix with bin midpoints for each segment
dt = 256/N;
tm = zeros(M,N);
tmid = zeros(M,1);
for m = 1:M
    tm(m,1) = t(1)+(m-1)*256 + dt/2;
    for j = 2:N
        tm(m,j)= tm(m,1)+(j-1)*dt; 
    end
    tmid(m) = (tm(m,N)+tm(m,1))/2;
end

% Time series for each segment
x = zeros(M,N);

for m = 1:M
    for j = 1:N
        pippo = t>=tm(m,j)-dt/2 & t<tm(m,j)+dt/2;
        x(m,j) = sum(pippo);
    end
end


% Find largest singam
% M2015 eq. 15
gam = [gamma_max,gamma_min];
singal = zeros(4,1);
singah = zeros(4,1);
nismin = zeros(M,4);
nismax = zeros(M,4);
for s = 1:4
    singah(s) = max(sin(gam - s*pi/2));
    singal(s) = min(sin(gam - s*pi/2));
    % Da buttare pure questo
    % This range is computed by finding the maximum span of Equation (15) after varying the search
    % parameters over their respective ranges (given in Table 2). This
    % is done with the exception of ν which is held fixed at its
    % maximum value within sub-bands over the frequency search space.
    for m = 1:M
        nismin(m,s) = f_min*a_min*(Omega_min^s)*singal(s);
        nismax(m,s) = f_max*a_max*(Omega_max^s)*singah(s);
    end
end



% Try s* and check \nu_s range




%