%**************************************************************************
%This function initializes the plot file.  It writes a title page.
%
%Input:
%plt_file, plot file for results
%param, structure containing parameter information
%header, copy of the header in the input data file
%
%Zachary Wolf, 3/11/07

function [] = hall_calib_plot_init(plt_file, param, header)

%Put the analysis parameters in a cell array to include with the output
param_info{1} = strcat('INPUT_FILE_DIR = ', param.input_file_dir);
param_info{2} = strcat('INPUT_FILE_NAME = ', param.input_file_name);
param_info{3} = strcat('POLY_FIT_ORDER = ', num2str(param.poly_fit_order));
param_info{4} = strcat('NUM_SIG_OUTLIER = ', num2str(param.num_sig_outlier));
param_info{5} = strcat('NOM_CALIB_CONST = ', num2str(param.nom_calib_const));
param_info{6} = strcat('MAX_B_NMR_FIT = ', num2str(param.max_b_nmr_fit));
param_info = strrep(param_info, '_', '-');
param_info = strrep(param_info, '\', '\\');

%Make substitutions in header
header = strrep(header, '_', '-');
header = strrep(header, '\', '\\');
header = strrep(header, '	', ' ');

%Make a title page for the plots
axes('position', [0, 0, 1, 1], 'visible', 'off');

y_pos = .95;
text(.1, y_pos, 'SLAC Magnetic Measurements', 'FontSize', 12);
y_pos = y_pos - .03;
text(.1, y_pos, 'Hall Probe Calibration', 'FontSize', 12);

y_pos = y_pos - .03;
text(.1, y_pos, '  ', 'FontSize', 12);
y_pos = y_pos - .03;
text(.1, y_pos, 'Header:', 'FontSize', 12);
[r, c] = size(header);
for ii = 1:c
    y_pos = y_pos - .03;
    text(.1, y_pos, header{ii}, 'FontSize', 12);
end

y_pos = y_pos - .03;
text(.1, y_pos, '  ', 'FontSize', 12);
y_pos = y_pos - .03;
text(.1, y_pos, 'Parameters:', 'FontSize', 12);
[r, c] = size(param_info);
for ii = 1:c
    y_pos = y_pos - .03;
    text(.1, y_pos, param_info{ii}, 'FontSize', 12);
end

%Plot the title page
util_print_fig_init(plt_file);

%Done
