summaryrefslogtreecommitdiff
path: root/faraday/faraday_vs_B.m
diff options
context:
space:
mode:
Diffstat (limited to 'faraday/faraday_vs_B.m')
-rw-r--r--faraday/faraday_vs_B.m141
1 files changed, 61 insertions, 80 deletions
diff --git a/faraday/faraday_vs_B.m b/faraday/faraday_vs_B.m
index acf7d43..11ba11b 100644
--- a/faraday/faraday_vs_B.m
+++ b/faraday/faraday_vs_B.m
@@ -1,6 +1,6 @@
-function [psr_rad]=psr_vs_detuning(detuning_freq, Ep, psi_el, B_field, theta, phi)
-% calculates psr in rad vs detunings of the probe field
-% for given laser probe and B field.
+function [psr_rad]=faraday_vs_B(detuning_freq, Ep, psi_el, B_fields, theta, phi)
+% calculates transmission if light polarizations vs B field in the cell
+% for given laser probe and B fields array
% Probe field defined by field strength (Ep) and ellipticity angle (pse_el)
% Magnetic field defined by magnitude (B_field) and angles theta and phi.
%
@@ -9,6 +9,11 @@ function [psr_rad]=psr_vs_detuning(detuning_freq, Ep, psi_el, B_field, theta, ph
t0 = clock (); % we will use this latter to calculate elapsed time
+%tune probe frequency
+detuning_p=0;
+N_steps=length(B_fields)
+kappa_p =zeros(1,N_steps+1);
+kappa_m =zeros(1,N_steps+1);
% load useful functions;
useful_functions;
@@ -18,36 +23,22 @@ useful_constants;
basis_transformation; % load subroutines
-% load atom energy levels and decay description
-rb87_D1_line;
-%four_levels_with_polarization;
-%four_levels;
-%three_levels;
-%two_levels;
-
-% load EM field description
-%field_description;
-
-%Nfreq=length(modulation_freq);
+fprintf (stderr, "tuning laser in forloop to set conditions vs detuning\n");
+fflush (stderr);
+for B_field_cntr=1:N_steps;
+ B_field=B_fields(B_field_cntr);
+ % load atom energy levels and decay description
+ rb87_D1_line;
-%tune probe frequency
-detuning_p=0;
-%detuning_p_min=-B_field*gmg*4; % span +/-4 Zeeman splitting
-%detuning_freq=zeros(1,N_detun_steps+1);
-N_detun_steps=length(detuning_freq);
-kappa_p =zeros(1,N_detun_steps+1);
-kappa_m =zeros(1,N_detun_steps+1);
-%detun_step=(detuning_p_max-detuning_p_min)/N_detun_steps;
-
-fprintf (stderr, "calculating atom properties\n");
-fflush (stderr);
-pfile='atomic_B_field.mat'; % the parent file where B_field is stored. This is the parameter for calculated L0_and_polarization_submatrices
-cfile='L0m_and_polarizability_calculated.mat'; % the child file to which calculated matrices are written
-need_update=false;
-[s, err_p, msg] = stat (pfile);
-if(err_p)
+ fprintf (stderr, "calculating atom properties\n");
+ fflush (stderr);
+ pfile='atomic_B_field.mat'; % the parent file where B_field is stored. This is the parameter for calculated L0_and_polarization_submatrices
+ cfile='L0m_and_polarizability_calculated.mat'; % the child file to which calculated matrices are written
+ need_update=false;
+ [s, err_p, msg] = stat (pfile);
+ if(err_p)
%file does not exist
need_update=true;
else
@@ -60,14 +51,15 @@ if(err_p)
else
need_update=false;
endif
-endif
-
-[s, err, msg] = stat (cfile);
-if(err)
- %file does not exist
- need_update=true;
-endif;
-if ( !need_update)
+ endif
+
+ [s, err, msg] = stat (cfile);
+ if(err)
+ %file does not exist
+ need_update=true;
+ endif;
+
+ if ( !need_update)
% matrices already calculated and up to date, all we need to load them
load(cfile);
else
@@ -80,32 +72,31 @@ if ( !need_update)
save(pfile, 'B_field');
save(cfile, 'L0m', 'polarizability_m');
endif
-elapsed_time = etime (clock (), t0);
-fprintf (stderr, "elapsed time so far is %.3f sec\n",elapsed_time);
-fflush (stderr);
-global atom_properties;
-atom_properties.L0m=L0m;
-atom_properties.polarizability_m=polarizability_m;
-atom_properties.dipole_elements=dipole_elements;
-
-%light_positive_freq = [wp];
-E_field_drive = [0 ];
-E_field_probe = [Ep ];
-E_field_zero = [0 ];
-E_field_lab_pos_freq.linear = E_field_zero + (1.00000+0.00000i)*E_field_probe + (1.00000+0.00000i)*E_field_drive;
-%E_field_lab_pos_freq.right = E_field_zero + (0.00000+0.00000i)*E_field_probe + (0.00000+0.00000i)*E_field_drive;
-%E_field_lab_pos_freq.left = E_field_zero + (0.00000+0.00000i)*E_field_probe + (0.00000+0.00000i)*E_field_drive;
-
-% phi is angle between linear polarization and axis x
-%phi=pi*2/8;
-% theta is angle between lab z axis (light propagation direction) and magnetic field axis (z')
-%theta=0;
-% psi_el is the ellipticity parameter (phase difference between left and right polarization)
-%psi_el=-30/180*pi;
-
-% we define light as linearly polarized
-% where phi is angle between light polarization and axis x
+ elapsed_time = etime (clock (), t0);
+ fprintf (stderr, "elapsed time so far is %.3f sec\n",elapsed_time);
+ fflush (stderr);
+
+ global atom_properties;
+ atom_properties.L0m=L0m;
+ atom_properties.polarizability_m=polarizability_m;
+ atom_properties.dipole_elements=dipole_elements;
+
+ %light_positive_freq = [wp];
+ E_field_drive = [0 ];
+ E_field_probe = [Ep ];
+ E_field_zero = [0 ];
+ E_field_lab_pos_freq.linear = E_field_zero + (1.00000+0.00000i)*E_field_probe + (1.00000+0.00000i)*E_field_drive;
+
+ % phi is angle between linear polarization and axis x
+ %phi=pi*2/8;
+ % theta is angle between lab z axis (light propagation direction) and magnetic field axis (z')
+ %theta=0;
+ % psi_el is the ellipticity parameter (phase difference between left and right polarization)
+ %psi_el=-30/180*pi;
+
+ % we define light as linearly polarized
+ % where phi is angle between light polarization and axis x
% only sign of modulation frequency is important now
% we define actual frequency later on
[E_field_lab_pos_freq.x, E_field_lab_pos_freq.y] = rotXpolarization(phi, E_field_lab_pos_freq.linear);
@@ -117,30 +108,21 @@ E_field_lab_pos_freq.linear = E_field_zero + (1.00000+0.00000i)*E_field_probe +
E_field_pos_freq=xyz_lin2atomic_axis_polarization(theta, E_field_lab_pos_freq);
-fprintf (stderr, "tuning laser in forloop to set conditions vs detuning\n");
-fflush (stderr);
-for detuning_p_cntr=1:length(detuning_freq);
wp0=w_pf1-w_sf2; %Fg=2 -> Fe=1
- %wd=w_pf1-w_hpf_ground;
- %detuning_p=detuning_p_min+detun_step*(detuning_p_cntr-1);
- detuning_p=detuning_freq(detuning_p_cntr);
- wp=wp0+detuning_p;
+ wp=wp0;
light_positive_freq=[ wp];
- % we calculate dc and negative frequiencies as well as amplitudes
+ % we calculate dc and negative frequencies as well as amplitudes
[modulation_freq, E_field] = ...
- light_positive_frequencies_and_amplitudes2full_set_of_modulation_frequencies_and_amlitudes(...
- light_positive_freq, E_field_pos_freq);
+ light_positive_frequencies_and_amplitudes2full_set_of_modulation_frequencies_and_amlitudes(...
+ light_positive_freq, E_field_pos_freq);
freq_index=freq2index(wp,modulation_freq);
atom_field_problem.E_field = E_field;
atom_field_problem.modulation_freq = modulation_freq;
atom_field_problem.freq_index = freq_index;
- problems_cell_array{detuning_p_cntr}=atom_field_problem;
-
+ problems_cell_array{B_field_cntr}=atom_field_problem;
- %kappa_p(detuning_p_cntr)=susceptibility_steady_state_at_freq( atom_field_problem);
- %detuning_freq(detuning_p_cntr)=detuning_p;
endfor
save '/tmp/problem_definition.mat' problems_cell_array atom_properties detuning_freq ;
@@ -150,10 +132,9 @@ fflush (stderr);
[xi_linear, xi_left, xi_right]=parcellfun(2, @susceptibility_steady_state_at_freq, problems_cell_array);
%[xi_linear, xi_left, xi_right]=cellfun( @susceptibility_steady_state_at_freq, problems_cell_array);
-%save '/tmp/relative_transmission_vs_detuning.mat' detuning_freq relative_transmission_vs_detuning;
-save '/tmp/xi_vs_detuning.mat' detuning_freq xi_linear xi_left xi_right E_field_pos_freq E_field_probe B_field psi_el;
+save '/tmp/xi_vs_B.mat' detuning_freq xi_linear xi_left xi_right E_field_pos_freq E_field_probe B_field psi_el;
-psr_rad=output_psr_results_vs_detuning;
+psr_rad=output_faraday_results_vs_B;
elapsed_time = etime (clock (), t0)
return