%**************************************************************************
%This function opens all output files and performs all other
%initialization required by the program.
%
%Input:
%param, parameter structure
%shim_param, shim parameter structure
%header, original data file header
%
%Output:
%dat_file, output data file name
%plt_file, output plot file name
%
%Zachary Wolf
%12/28/05

function [dat_file, plt_file] = pid_shim_init(param, shim_param, header)

%Make file names
dat_file = strcat(lower(shim_param.input_file_dir), 'pid_shim.dat');  %Output data file
plt_file = strcat(lower(shim_param.input_file_dir), 'pid_shim.ps');   %Output plot file

%Initialize the data file
util_dat_init(dat_file);

%Write a message to the data file
msg{1} = ' ';
msg{2} = 'Planar Insertion Device Shim Analysis';
msg{3} = '-------------------------------------';
util_dat_msg(dat_file, msg);

%Write the header to the data file
util_dat_header(dat_file, header);

%Write the parameter values to the data file
pid_anal_dat_param(dat_file, param);

%Write the shim parameters to the data file
pid_shim_dat_param(dat_file, shim_param);

%Initialize the plot file
util_plt_init(plt_file, msg, param, header);

%Done
