summaryrefslogtreecommitdiff
path: root/benchmark/benchmark.m
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-08-26 14:16:22 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2011-08-26 14:16:22 -0400
commitcabdfbbcbaa9da6d01fd729dbf7c613379dd8e92 (patch)
treeb907794c2479a64508b3491f6f867d195e8c4444 /benchmark/benchmark.m
parentbbca4d7c1fefbfdd6c9a5417a2c8ade82b3827e5 (diff)
downloadNresonances-cabdfbbcbaa9da6d01fd729dbf7c613379dd8e92.tar.gz
Nresonances-cabdfbbcbaa9da6d01fd729dbf7c613379dd8e92.zip
Script to compare xmds and fortran output
Diffstat (limited to 'benchmark/benchmark.m')
-rw-r--r--benchmark/benchmark.m57
1 files changed, 57 insertions, 0 deletions
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')