Computer Physics Communications
PyFocus a Python package for vectorial calculations of focused optical fields under realistic conditions. Application to toroidal foci
Caprile, F., Masullo, L. A., & Stefani, F. D.
Toroidal focus, Super-resolution, STED, MINFLUX
Focused optical fields are key to a multitude of applications involving light-matter interactions, such as optical microscopy, single-molecule spectroscopy, optical tweezers, lithography, or quantum coherent control. A detailed vectorial characterization of the focused optical fields that includes a description beyond the paraxial approximation is key to optimize technological performance as well as for the design of meaningful experiments and interpret properly their results. Here, we present PyFocus, an open-source Python software package to perform fully vectorial calculations of focused electromagnetic fields after modulation by an arbitrary phase mask and in the presence of a multilayer system. We provide a graphical user interface and high-level functions to easily integrate PyFocus into custom scripts. Furthermore, to demonstrate the potential of PyFocus, we apply it to extensively characterize the generation of toroidal foci with a high numerical aperture objective, as it is commonly done in super-resolution fluorescence microscopy methods such as STED or MINFLUX. We provide examples of the effects of different experimental factors such as polarization, aberrations, and misalignments of key optical elements. Finally, we present calculations of toroidal foci through an interface of different mediums, and, to our knowledge, the first calculations of toroidal foci generated in total internal reflection conditions.