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

Pre merge Filippo

parent 9ce89657
Loading
Loading
Loading
Loading
+39 −39
Original line number Diff line number Diff line
@@ -157,8 +157,6 @@ else
    nismax(s) = -f_min*a_min*(Omega_min^s)*singal(s) + f_min;
end
for s = 2:4
    singah(s) = max(sin(gam + s*pi/2));
    singal(s) = min(sin(gam + s*pi/2));
    % 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
@@ -176,29 +174,26 @@ for s = 2:4
    end
end

% Find the range in ν^s (i.e. the maximum span of Eq. (15) covered by 
% combining the search parameters over their respective ranges)
% Sin(gamma) going from -1 to 1
% Adding special case for s = 1
s = 1;
if a_max*Omega_max>1 %%%%%%%%%%%%%%%%%%%%%%%%%% FINIREEEEEEEEEEEEEEE %%%
nismin(s) = -f_max*a_max*(Omega_max^s) + f_max;
nismax(s) = -f_max*a_min*(Omega_min^s) + f_min;
for s = 2:4
    singah(s) = max(sin(gam + s*pi/2));
    singal(s) = min(sin(gam + s*pi/2));
    % 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.
    %% RECHECK EVERY COMBINATION
    if singal(s)>0
        nismin(s) = -f_max*a_max*(Omega_max^s)*singah(s);
        nismax(s) = -f_min*a_min*(Omega_min^s)*singal(s);
    elseif singah(s)>0
        nismin(s) = -f_max*a_max*(Omega_max^s)*singah(s);
        nismax(s) = -f_max*a_max*(Omega_max^s)*singal(s);
if a_max*Omega_max>1 
    nismin(s) = -f_max*a_max*(Omega_max) + f_max;
    if a_min*Omega_min>1
        nismax(s) = -f_min*a_min*(Omega_min) + f_min;
    else
        nismin(s) = -f_max*a_max*(Omega_max^s)*singah(s);
        nismax(s) = -f_min*a_min*(Omega_min^s)*singal(s);
        nismax(s) = -f_max*a_min*(Omega_min) + f_max;
    end
else
    nismin(s) = -f_min*a_max*(Omega_max) + f_min;
    nismax(s) = -f_max*a_min*(Omega_min) + f_max;
end
% The other s's are easier
for s = 2:4
    nismin(s) = -f_max*a_max*(Omega_max^s);
    nismax(s) =  f_max*a_max*(Omega_max^s);
end

toc
@@ -352,11 +347,14 @@ nisearcher = KDTreeSearcher(nibank,'BucketSize',100);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parbank = combinations(f_gr,porb_gr,a_gr,tasc_gr).Variables;
bestpar = zeros(5,1);
for i=1:length(parbank)
    curpar = parbank(i,:);
    % Move from ν,P,a,T_asc to ν,Ω,a,γ 
    curpar(2) = 2*pi/curpar(2);
    curpar(4) = curpar(2)*(t0 - curpar(4));
    totlam = 0;
    for m = 1:M
        curpar(4) = curpar(2)*(tmid(m) - curpar(4));
        curni=zeros(1,s_s+1);
        for s=1:s_s
            curni(s) = (curpar(2)^s)*sin(curpar(4)-0.5*s*pi);
@@ -364,22 +362,24 @@ for i=1:length(parbank)
        curni=curni.*curpar(1).*curpar(2);
        curni(s_s+1) = curpar(1);

    [Idx,D] = knnsearch(nisearcher,curni)
    nibank(Idx,:)
    curpar(1)
        [Idx,D] = knnsearch(nisearcher,curni);
        totlam = totlam + (Lambda(Idx,m));
%        nibank(Idx,:)
%        curpar(1)
    end
    if (totlam > bestpar(1))
        bestpar = [totlam;parbank(i,:).'];
    end
end

%% Finire domani
disp(bestpar);
save('risultelli.mat');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%COMPLETARE DOPO AVER STUDIATO I RANDOM TEMP. BANKS
%E VEDERE CODICE https://pyfstat.readthedocs.io/en/latest/pyfstat.html#pyfstat.core.SemiCoherentSearch





%% COMPLETARE DOPO AVER STUDIATO I RANDOM TEMP. BANKS
%% E VEDERE CODICE https://pyfstat.readthedocs.io/en/latest/pyfstat.html#pyfstat.core.SemiCoherentSearch

%--------------------------------------------------------------------------
%FUNCTIONS