%**************************************************************************
%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, 9/11/07

function [] = cmm_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 = 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, 'Mechanical Measurement Analysis', '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
