% Notes about the test:
% =====================
% This light curve spans 1350d (up to Quarter 15), and includes two previosuly
% published planets (Kepler -10b and -10c with periods of 0.837495d and 45.29404d.
% It shows a number of features mentioned in the text:
%
% - Both planets produce their own clear set of BLS peaks (true period and aliases)
% but dspite the >50 factor in orbital period, both peaks are sampled with a
% similar number of points.
%
% - Rising background and scatter towards smaller frequencies.
%
% - True stellar parameters for this star (M=0.895, R=1.056 [solar]) are
% close to solar values, therefore default parameters produce good
% results (e.g. frequency sampling, maxiaml frequency). Nevertheless, users are
% advised to use optional parameters (like M,R) whenever possible.
%
% - The light curve is uncleaned. Obvious outliers exist, but they don't change the
% results for these strong signals.
%
% For scale, parallel processing (using parfor command) using 12 threads took 128 sec.
% on my computer.

BaseDir = mfilename('fullpath'); % Current folder
load([BaseDir(1:end-14) 'Kepler-10.lc.mat']); % .mat format file.
[per, freq]=OptimalBLS(LC(:,1),1-LC(:,2),LC(:,3));

subplot(2,1,1)
plot(LC(:,1),LC(:,2),'.b')
xlabel('Time (BJD-2454833)');
ylabel('PDC-MAP Normalized flux');

subplot(2,1,2)
semilogx(freq,per)
xlabel('freq [d^{-1}]')
ylabel('raw BLS score [arbitrary scale]');