######################################################################### # scriptfile: phase_constrast_batch_run; # # Description: This script will run multiple simulations # for different source angles. For each angle, # it will run two orthogonal polarization states. # If desired, the simulation will run a reference # beam # # Copyright 2007/2010 Lumerical Solutions Inc. ######################################################################## # choose the number of points around the annulus to simulate points = 4; # choose the template file filename = "phase_contrast1"; # choose to run original beam run_with_sample = 1; # choose to rerun reference beams run_reference_beams = 1; # disribute the azimuthal angles evenly phi = ((1:points)-1)/points*360; if(run_with_sample) { # set up source angle # load the template file load(filename); # loop over the possible angles simulation_counter = 1; for(i=1:points) { # loop over the 2 polarization states for(polarization=0:90:90) { load(filename); switchtolayout; # set up source angle select("Source1"); set("angle phi",phi(i)); set("polarization angle",polarization); # run the simulation ?"Running simulation " + num2str(simulation_counter) + " of " + num2str(2*points) + " with specimen"; run; #copy the temporary fsp file unique name save(filename+"_"+num2str(simulation_counter)+".fsp"); simulation_counter = simulation_counter+1; } } } if(run_reference_beams) { # load the template file load(filename); # delete the sample switchtolayout; select("sphere"); shiftselect("surface"); delete; # loop over the possible angles simulation_counter = 1; for(i=1:points) { # loop over the 2 polarization states for(polarization=0:90:90) { switchtolayout; # set up source angle select("Source1"); set("angle phi",phi(i)); set("polarization angle",polarization); # run the simulation save(filename+"_reference_"+num2str(simulation_counter)); ?"Running simulation " + num2str(simulation_counter) + " of " + num2str(2*points) + " without specimen"; run; simulation_counter = simulation_counter+1; } } } # reload the template file load(filename);