%**************************************************************************
%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/22/10

function [] = util_plt_init_und(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('CORR_REQUIRED = ', num2str(param.corr_required));
param_info{5} = strcat('GAMMA = ', num2str(param.gamma));
param_info{6} = strcat('NOM_LAMBDA_U = ', num2str(param.nom_lambda_u));
param_info{7} = strcat('NOM_K_VALUE = ', num2str(param.nom_k_value));
param_info{8} = strcat('NOM_LAMBDA_R = ', num2str(param.nom_lambda_r));
param_info{9} = strcat('NUM_POLES = ', num2str(param.num_poles));
param_info{10} = strcat('NUM_END_POLES = ', num2str(param.num_end_poles));
param_info{11} = strcat('CELL_LENGTH = ', num2str(param.cell_length));
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
