%**************************************************************************
%This function initializes the plot file.  It writes a title page.
%
%Input:
%plt_file, plot file for results
%msg, message describing the type of plots
%param, structure containing parameter information
%
%Zachary Wolf
%6/21/13

function [] = hall2_anal_plt_init(plt_file, msg, param)

%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('INPUT_FILE_TYPE = ', param.input_file_type);
param_info{4} = strcat('UND_POL_MODE = ', param.und_pol_mode);
param_info{5} = strcat('PROBE1_BX_CALIB_FILE = ', param.probe1_bx_calib_file);
param_info{6} = strcat('PROBE1_BY_CALIB_FILE = ', param.probe1_by_calib_file);
param_info{7} = strcat('PROBE2_BX_CALIB_FILE = ', param.probe2_bx_calib_file);
param_info{8} = strcat('PROBE2_BY_CALIB_FILE = ', param.probe2_by_calib_file);
param_info{9} = strcat('NUM_ZERO_GAUSS_MEAS = ', num2str(param.num_zero_gauss_meas));
param_info{10} = strcat('PROBE2_OFFSET_DIR = ', param.probe2_offset_dir);
param_info = strrep(param_info, '_', '-');
param_info = strrep(param_info, '\', '\\');

%Make a title page for the plots
figure;
axes('position', [0, 0, 1, 1], 'visible', 'off');
%[r, c] = size(header);
y_pos = .95;
text(.1, y_pos, 'SLAC Magnetic Measurements', 'FontSize', 12);

%Write message
[r, c] = size(msg);
for ii = 1 : c
    y_pos = y_pos - .03;
    text(.1, y_pos, strrep(msg{ii}, '_', '-'), 'FontSize', 12);
end

%Write parameter information
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
