Commit 69ee2188 authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

Cose da chiamata con Filippo, ripulite alcune righe (commit prima di...

Cose da chiamata con Filippo, ripulite alcune righe (commit prima di aggiungere una griglia stupida nello spazio dei parametri fisici per provare questo pezzo su osservazioni note)
parent 9bb74390
Loading
Loading
Loading
Loading
+22 −21
Original line number Diff line number Diff line
@@ -47,17 +47,6 @@ for s = 1:4
    nismax(s) = f_max*a_max*(Omega_max^s)*singah(s);
end

% Try s* and check \nu_s range
g_jj=((pi*T)^2)/3.*[1; (T^2)/60; (T^3)/1344; (T^4)/172800]; %eq. 22 M2015 + calcoli da eq. 21 M2015
mu_s=0.001; %massimo mismatch sulla griglia coerente da scegliere
s_s=int16(4);
while(1)
    if((nismax(s_s)-nismin(s_s))<delta_ni(mu_s,s_s,g_jj(s_s)))
        s_s=s_s-1;
    else
        break;
    end
end

%Rebin -------------------------------------------------------------------
Nyq=2000; %cambiare in caso
@@ -105,6 +94,18 @@ for m = 1:M
    end
end

% Try s* and check \nu_s range
g_jj=((pi*Tseg)^2)/3.*[1; (Tseg^2)/60; (Tseg^3)/1344; (Tseg^4)/172800]; %eq. 22 M2015 + calcoli da eq. 21 M2015
mu_s=0.001; %massimo mismatch sulla griglia coerente da scegliere
s_s=uint8(4);
while(1)
    if((nismax(s_s)-nismin(s_s))<delta_ni(mu_s,s_s,g_jj(s_s)))
        s_s=s_s-1;
    else
        break;
    end
end

%%  Create (...) a coherent template bank in the ν_s space
%%  Save this template bank, we'll need it later
% Nni+1 is the number of ni_s points in the grid (counting borders, 
@@ -135,10 +136,10 @@ nibank = combinations(nis{:}).Variables;

%for each segment (lavoro su tm)
for m=1:M
    [Cm,edges]=(histcounts(x(m,:),round((tm(m,end)-tm(m,1))/dt_psd))); % R - convincitene
    edges=edges(end)-edges(1); %mi dà il tempo preciso di tutta la TdF, che sarà leggermente diversa da length(C)*dt per come è definito histcounts 
    Y=fft(Cm).'; clear Cm
    F=((0:length(Y)-1)./edges).'; clear edges
 %   [Cm,edges]=(histcounts(x(m,:),round((tm(m,end)-tm(m,1))/dt_psd))); % R - convincitene
 %   edges=edges(end)-edges(1); %mi dà il tempo preciso di tutta la TdF, che sarà leggermente diversa da length(C)*dt per come è definito histcounts 
    Y=fft(x(m,:)).'; 
    F=((0:length(Y)-1)./(tm(m,end)-tm(m,1))).'; %freq. da 0 a 2Nyq.
    L=length(F); %lunghezza iniziale, servirà per lo zero-padding
    
    %Choose freq. region of interest (RoI) and inverse-fourier transf. over RoI
@@ -170,17 +171,17 @@ for m=1:M
        %il secondo è un vettore colonna di zeri con lunghezza pari al numero di elementi che mi serve per tornare alla risoluzione originale

        %Fourier transform -----------------------------------------------------
        [Cm,edges]=(histcounts(X1,round((X1(end)-X1(1))/dt_psd)));
        edges=edges(end)-edges(2); %mi dà il tempo preciso di tutta la TdF, che sarà leggermente diversa da length(C)*dt per come è definito histcounts
        Y1=(2./sum(Cm).*abs(fft(Cm)).^2).'; %normalizzazione Leahy, giusto?????
        clear Cm
        F1=((0:length(Y1)-1)./edges).';
        %[Cm,edges]=(histcounts(X1,round((X1(end)-X1(1))/dt_psd)));
        %edges=edges(end)-edges(2); %mi dà il tempo preciso di tutta la TdF, che sarà leggermente diversa da length(C)*dt per come è definito histcounts
        Y1=(2./sum(X1).*abs(fft(X1)).^2).'; %normalizzazione Leahy, giusto?????
        clear X1
        F1=((0:length(Y1)-1)./(tm(m,end)-tm(m,1))).';
        F1=F1(1:round(length(F1)/2));
        Y1=Y1(1:round(length(Y1)/2));

        %Calcolo della detection statistic
        %QUESTA SARA' DA INIZIALIZZARE ALL'ESTERNO tipo Lambda = zeros(length(template),1);
        Lambda(template)=sum(Y1); %CREDO (oppure prendono la potenza massima?)
        Lambda(template)=sum(Y1)/sum(x(m,:)); %CREDO (oppure prendono la potenza massima?)
    end

end