From 99f39dc1423adc360a04344689a83d2f788aae33 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 20 Mar 2013 16:53:39 -0400 Subject: Matt's changes to use faster beam propagator --- fitness.m | 60 ++++++++++++++++++++++++------------- fitter_check.m | 32 ++++++++------------ gbeam_propagation.m | 8 ++--- gbeam_propagation_froward_only.m | 9 ++---- mode_match.m | 26 +++++----------- pick_visualization.m | 10 +++---- self_gbeam_propagation.m | 49 +++++++++++++++--------------- solution_visualization.m | 64 +++++----------------------------------- 8 files changed, 101 insertions(+), 157 deletions(-) diff --git a/fitness.m b/fitness.m index 55f9d76..e92879f 100644 --- a/fitness.m +++ b/fitness.m @@ -3,25 +3,26 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit x0 = 0; Np=20; % # of pts between start position and second lens N_collimated = 10; % # of pts between second lens and third lens to be collimated region + Energy = 0; x1=optics_positions(1); x2=optics_positions(2); x3=optics_positions(3); - x_array1=linspace(x0,x2,Np); - x_array2=linspace(x2, x3, N_collimated); - x = cat(2,x_array1,x_array2); - - q_f_trial_forward = gbeam_propagation(x,q_0,x0,optics_placer(optics_positions, optics_focal_length)); - [Waist_trial_forward, Radius_trial_forward] = q2wr(q_f_trial_forward, lambda); - q_f_trial_backward = gbeam_propagation(x,q_final,x_final,optics_placer(optics_positions, optics_focal_length)); - [Waist_trial_backward, Radius_trial_backward] = q2wr(q_f_trial_backward, lambda); - - Energy = 0; - Penalty_waist_mismatch = sum(abs((Waist_trial_forward-Waist_trial_backward)./min(Waist_trial_forward, Waist_trial_backward)))/Np; - - Energy = 1e-2*Penalty_waist_mismatch; - +% x_array1=linspace(x0,x2,Np); +% x_array2=linspace(x2, x3, N_collimated); +% x = cat(2,x_array1,x_array2); +% +% q_f_trial_forward = gbeam_propagation(x,q_0,x0,optics_placer(optics_positions, optics_focal_length)); +% [Waist_trial_forward, Radius_trial_forward] = q2wr(q_f_trial_forward, lambda); +% q_f_trial_backward = gbeam_propagation(x,q_final,x_final,optics_placer(optics_positions, optics_focal_length)); +% [Waist_trial_backward, Radius_trial_backward] = q2wr(q_f_trial_backward, lambda); +% +% Energy = 0; +% Penalty_waist_mismatch = sum(abs((Waist_trial_forward-Waist_trial_backward)./min(Waist_trial_forward, Waist_trial_backward)))/Np; +% +% Energy = 1e-2*Penalty_waist_mismatch; +% % penalty calculation % do not put lenses too close to each other and end positions lens_size=0.03; @@ -58,14 +59,33 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit Energy = Energy + penalty_lenses_outside_optical_path; % make collimated region between 2nd and 3rd lens - %intialize intermediate points between lenses - q_intermediate = q_f_trial_forward((x2= x_in) % Forward propagation to the right of x_in - [q(x_pos >= x_in)] = gbeam_propagation_froward_only(x_pos(x_pos>=x_in), q_in, x_in, optics_elements); + q(x_pos >= x_in) = gbeam_propagation_froward_only(x_pos(x_pos>=x_in), q_in, x_in, optics_elements); end if any(x_pos < x_in) @@ -45,10 +45,8 @@ function [q] = gbeam_propagation(x_pos, q_in, x_in, optics_elements) % final assignment of the backwards propagating beam % which we need to flip back q(x_pos