Skip to content
Snippets Groups Projects
Commit 21c5f04b authored by Ling Sun's avatar Ling Sun
Browse files

adjust variable names, minor changes

parent 72f727e6
Branches
No related tags found
No related merge requests found
function [b,h] = binary_fstat(f,f0,P,a0)
% Generate the Bessel-weighted matched filter (also generate Comb filter)
function [b,h] = binaryfilter(f,f0,P,a0)
% BINARYFILTER Generate the Bessel-weighted matched filter (also generate Comb filter)
%
% Inputs:
% f - Frequency bin list (i.e. hidden stats)
......@@ -11,9 +11,10 @@ function [b,h] = binary_fstat(f,f0,P,a0)
% b - Bessel-weighted matched filter
% h - Comb filter (not used in the current search)
% Fstat power concentrated at [-c c]/P where c = 2*pi*a0*f0
% f0 is fixed to setup matched filter for each 1-Hz sub-band
c=(2*pi*a0*f0);
c = 2*pi*a0*f0;
% Make it slightly wider than c
N = ceil(c)+100;
n = -N:N;
......
function [f, X, N, T] = readfstats(dirName, startFreq, steps)
% Read Fstat files
% READFSTATS Read Fstat files
%
% Inputs:
% dirName - Directory of Fstat files
......@@ -13,9 +13,8 @@ function [f,X,N,T]=readfstats(dirName, startFreq, steps)
% N - Number of bins
% T - Total number of steps
d = dir(dirName);
X = [];
X = [];
for n = 1:steps
fileName = ['Fstat-' num2str(startFreq) '-' num2str(n-1) '.dat']
......
function search_O1(freq,idx)
% This script is for O1 Sco X-1 search.
% SEARCH_O1 This script is for O1 Sco X-1 search.
% The search is separated into parallel 1-Hz sub-jobs.
% The start frequency for each sub-job is the overal start frequency plus job index.
%
......@@ -11,6 +11,7 @@ function search_O1(freq,idx)
% Outputs:
% Save output files to the output directory.
format long g
startFreq = str2num(freq) + str2num(idx)
......@@ -21,7 +22,7 @@ outdir = '/home/ling.sun/O1/Viterbi/output/';
outfile = strcat(outdir,'Viterbi-', num2str(startFreq),'.dat')
% Set parameters
a = 1.44
a0median = 1.44
P = 68023.70496
steps = 13
......@@ -32,13 +33,14 @@ toc
fmean = f(1)+0.5; % Take the mean value of each 1-Hz sub-band
g = [-0.1:0.01:0.1]; % asini grid (+/-10% uncertainty, may search larger uncertainty)
a0=(1+g)*a; % asini values being searched
a0 = (1+g)*a0median; % asini values being searched
for m=1:length(g)
disp(sprintf('a0=%g',a0(m)))
tic
% Generate Bessel-weighted matched filter
[b,h] = binary_fstat(f,fmean,P,a0(m));
[b,h] = binaryfilter(f,fmean,P,a0(m));
% Compute Bessel-weighted Fstat
for n=1:steps
......@@ -46,7 +48,6 @@ for m=1:length(g)
end
[path0(m,:), delta, psi, sc(m)] = viterbi_colFLT(3, Y);
toc
end
......
function [path,delta,psi,score] = viterbi_colFLT(M, obslik)
% VITERBI Find the most-probable (Viterbi) path through the HMM states (frequency bins).
% VITERBI_COLFLT Find the most-probable (Viterbi) path through the HMM states (frequency bins).
%
% Inputs:
% M - One dimension of the colfilt matrix, in the current model M=3,
......@@ -15,7 +15,10 @@ function [path,delta,psi,score] = viterbi_colFLT(M, obslik)
% of paths to all the states at the final step
if round(M/2)==M/2 M=M+1;end
if round(M/2)==M/2
M = M+1;
end
[Q,T] = size(obslik); % Q bins, T steps
delta = zeros(Q,T);
......@@ -28,9 +31,10 @@ path = zeros(1,T);
% compares all three possible paths for each step and the operation
% is efficient.
cor = (0:Q-1)'-(M-1)/2; % correction term for each bin
t = 1;
delta(:,t) = obslik(:,t);
cor=(0:Q-1)'-(M-1)/2; % correction term for each bin
disp('forward')
for t=2:T
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment