Repository containing Python scripts for post-processing the simulation outputs of OpenDDA for scattering calculations of single particles. These scripts rely on the NumPy, Pandas, and Matplotlib libraries as indicated on each script.
A typical simulation from OpenDDA would output a csv file with about 1 million rows, as each simulation calculated a 2-by-2 complex-valued Matrix for ~18 incident wavelengths, 20 orientations, and 181 observation directions.
The 2-by-2 complex-valued matrices relate the incident and scattered components of the electric field. Since these components are generally challenging to measure, the complex-valued matrices were mapped to a 4-by-4 real-valued matrix, known as the Mueller Matrix (MM). The MM relates the incident and scattered polarization states, and allows you to validate if the simulation outputs are correct by looking at the number of non-zero elements and symmetries. One advantage of this representation is that you can represent any polarization state, from fully polarized to completely unpolarized. The elements of the MM can be measured experimentally.
Finally, the scattering response of an ensemble of randomly oriented particles can be calculated using an average over multiple single-particle orientations. This is achieved by averaging the elements of the MM for all the calculated orientations.
Below you can see an example of the calculated Mueller matrix elements for a spherical particle for multiple incident wavelengths (from 0.4 to 2.0 micrometers).
The files and intended workflow are as follows:
read_fmatrix_rawoutput.py
- Parses the simulation output fmatrix_rawoutput.csv file generated by OpenDDA
- Calculates the Mueller Matrix and Extinction Matrix using the
MM_calculation.py
andKmatrix_calculation.py
helper functions - Saves calculated quantities as a multidimensional NumPy arrays in a compressed npz file
orientation_average.py
- Performs an average over orientations using the compressed NumPy file generated by
read_fmatrix_rawoutput.py
- Saves a new compressed NumPy file containing the incident wavelength, observation angle, and multidimensional NumPy arrays after averaging
plot_matrix_elements.py
- Plots the 16 elements of the Mueller Matrix or the Extinction Matrix calculated by
orientation_average.py
- The plots are saved as png and svg files
calculate_pol_ellipse_parameters.py
- Calculates polarization parameters using the compressed npz file generated by
orientation_average.py
- Saves a new compressed NumPy file containing the tilt angle, ellipticity, degree of polarization, and polarization ellipse semi-axes
plot_ellipse_parameters.py
- Plots Amplitude, Degree of polarization, ellipticity and azimuth for a given incident polarization state, from the npz file generated with
calculate_pol_ellipse_parameters.py
- The plots are saved as png and svg files