From cabdfbbcbaa9da6d01fd729dbf7c613379dd8e92 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Fri, 26 Aug 2011 14:16:22 -0400 Subject: Script to compare xmds and fortran output --- benchmark/benchmark.m | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 benchmark/benchmark.m diff --git a/benchmark/benchmark.m b/benchmark/benchmark.m new file mode 100644 index 0000000..e32486b --- /dev/null +++ b/benchmark/benchmark.m @@ -0,0 +1,57 @@ +% will plot on the same graph results of xmds and navy fortran calculations + +Gamma_super = 6*2*pi*1e6; + +% first we load navy fortran results + +d=load('../fortran/navy_four_levels/Movie4level_EndPoints.dat'); +t_fortran=d(:,1); +t_fortran=t_fortran*1e6; % switch to uS +Om1_strt=d(:,2); +Om_vac_strt=d(:,3); +Om1_end=d(:,4); +Om_vac_end=d(:,5); + +%figure(1) +%plot(t_fortran, Om1_strt, '-;Om1_{strt};', t_fortran, Om_vac_strt, '-;Om_{vac_{strt}};', t_fortran, Om1_end, '-;Om1_{end};', t_fortran,Om_vac_end, '-;Om_{vac_{end}};'); +%xlabel('Time (uS)'); +%ylabel('Rabi frequency'); + +% second xmds results +%% fields before and after the cell +fpDat = fopen('../xmds2/Nlevels_no_dopler_with_z/Nlevels_no_dopler_with_z_mg0.dat', 'r', 'ieee-le'); +if (fpDat < 0) + disp('Cannot open binary data file: Nlevels_no_dopler_with_z_mg0.dat') + return +end +z_1Len = fread(fpDat, 1, 'uint32'); +z_1 = zeros(1, z_1Len); +z_1(:) = fread(fpDat, z_1Len, 'double'); +t_1Len = fread(fpDat, 1, 'uint32'); +t_1 = zeros(1, t_1Len); +t_1(:) = fread(fpDat, t_1Len, 'double'); +I1_out_1Len = fread(fpDat, 1, 'uint32'); +I1_out_1 = fread(fpDat, [t_1Len, z_1Len], 'double'); +I2_out_1Len = fread(fpDat, 1, 'uint32'); +I2_out_1 = fread(fpDat, [t_1Len, z_1Len], 'double'); +I3_out_1Len = fread(fpDat, 1, 'uint32'); +I3_out_1 = fread(fpDat, [t_1Len, z_1Len], 'double'); +fclose(fpDat); +clear fpDat z_1Len t_1Len I1_out_1Len I2_out_1Len I3_out_1Len + +t_xmds=t_1/1e-6; % move to uS +% watch for factor 2 in Rabi frequency calculations +Om1_xmds=2*sqrt(I1_out_1)/Gamma_super; % normalize output + + + +figure(1) +plot( ... + t_xmds, Om1_xmds(:,1), '-;Om1 before;', ... + t_xmds, Om1_xmds(:,end), '-;Om1 xmds after;', ... + t_fortran, Om1_end, '-;Om1 fortran after;' ... + ) +xlabel('Time (uS)'); +ylabel('Normalized Rabi frequency'); + +print('xmds_vs_fortran.pdf') -- cgit v1.2.3