%**************************************************************************
%This function writes the calculated k_eff at 20 C to the data file.
%
%Input:
%dat_file, data file for results
%temp, average undulator temperature (C)
%k_eff, calculated effective K value
%k_eff_20c, calculated effective K value at 20 C
%
%Zachary Wolf, 10/5/07

function [] = k_dat_keff_20c(dat_file, temp, k_eff, k_eff_20c)

%Write the results to the data file
fid = fopen(dat_file, 'a');
fprintf(fid, '\r\n');
fprintf(fid, 'Calculated K Value At 20 C:\r\n');
fprintf(fid, '(Assumes Keff changes by -.05%% per degree C)\r\n');
fprintf(fid, 'Measured Average Undulator Temperature = %f C\r\n', temp);
fprintf(fid, 'Measured Keff = %f\r\n', k_eff);
fprintf(fid, 'Calculated Keff at 20 C = %f\r\n', k_eff_20c);
fprintf(fid, 'Relative Change (Keff_20C - Keff) / Keff = %f\r\n', (k_eff_20c - k_eff) / k_eff);
fclose(fid);
