Py-Focus 0.0.1
Vectorial simulation of fields focused by a high numerical aperture lens
Requires Python: >=3.6

Author: Fernando Caprile (fcaprile@gmail.com) Supervisors: Luciano A. Masullo (lmasullo@df.uba.ar) Fernando D. Stefani (fernando.stefani@df.uba.ar) Affiliation: Physics Department, Faculty of Natural and Exact Sciences, University of Buenos Aires and Center for Bionanoscience Research (CIBION), National Scientific and Technical Research Council (CONICET)

This is PyFocus, an user interface that allows the simulation of the propagation and focusing of a gaussian beam, after being modulated by a custom phase mask.

To execute the interface run "main.py".

Required packages: tqdm and configparser (usually with pip install)

In case of simulating a custom phase mask, replace the function defined in "maskfunction_goes_here.py".

For circular polarization, the parameters are arctan(ey/ex)=45, phase=90 for right polarization (which gives the minimal intensity at the center with the VPP) and phase=-90 for left polarization.

Saving the values matrix with the data for the intensity of the XZ and XY plane of the field near the focus is available at the lower part of the user interface. The coordinates are as ploted, with x going from -(radial field of view)/2 to (radial field of view)/2 on each column, and z going from (axial field of view)/2 to -(axial field of view)/2 on each row. The total number of rows and columns is given by the resolution, being the integer part of (radial field of view)/(radial resolution) for columns and of (axial field of view)/(axial resolution) for rows of the XZ plane.

The only atypical packages used are tqdm and configparser, which serve as a waitbar and to save the .txt with the used parameters respectively. Other than these, one no other packages should need to be instaled.

For custom mask integration, the phase mask's function must be modified at the 'maskfunction_goes_here.py' file. If the mask has real terms (wich mean that the amplitude changes), keep in mind that the simulation already has the term of a gaussian beam's amplitude: exp(-r^2/diam^2). If instead of a function, a matrix with the values of the fase is to be used, at "main.py", lines 213 and 214 can be uncommented and lines 203 to 209 should be commented. The matrixes for the X and Y component of the incident field should have the values Ex[n_phi,n_theta] and Ey[n_phi,n_theta] (where phi,theta mean each position in the respective coordinate).

For an example, the function 'generate_incident_field' in 'trapezoid2D_integration_functions.py' generates this matrixes given the pahse function, and thus can be usefull in understanding. Keep in mind that the integration for the calculus is made with equispaced divisions on the theta and phi coordinates, and thus the rho coordinate is not uniformly spaced.

A 2D trapezoid method was used for the numerical integration, the resolution of the calculation is given by the number of divisions, which can be modified in the script "main.py", lines 192 and 193.

Description of the scripts and their use: 'tipical custom mask simulations.py' has examples of the use for each function, and thus can be used to perform the calculation of a custom mask without using the user interface. It also contains examples of the parameters used to realize the simulations, allowing to test the amount of divisions needed to perform the integration of a custom mask 'front_end_ui.py' generates the user interface, can be opened by PYQT5's designer 'plot polarization near center.py' simulates the field generated by using a vortex phase plate mask in a smaller field of view closer to the focus and also plots the parameters: tan-1(Ey/Ex) and phase(Ey)-phase(Ex) which define the polarization 'VPP.py' contains the functions used to calculate the field generated by using a vortex phase plate mask 'No_mask.py' contains the functions used to calculate the field generated without the use of plate mask (gaussian beam) 'SPP.py' contains the functions used to calculate the field generated by using a polarization spiral phase mask (the one made out of rotating half wave plates) 'plot.py' contains the functions used to plot the fields 'plot_polarization_elipses.py' is used to draw each one of the polarization elipses, it is used by 'plot' 'complex_quadrature' and 'complex_quadrature_2D.py' are auxiliary functions used to run the scipy.integrate.quad function for both the real and imaginary part of a function 'trapezoid2D_integration_functions.py' has all the functions used to realize the 2D integration by trapezoid method