Skip to content

Python modules for post-processing the simulation outputs of OpenDDA

Notifications You must be signed in to change notification settings

bcrodrigo/OpenDDA_output_parsing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

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.

Background

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).

mm_avg

Usage

The files and intended workflow are as follows:

  1. 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 and Kmatrix_calculation.py helper functions
  • Saves calculated quantities as a multidimensional NumPy arrays in a compressed npz file
  1. 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
  1. 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
  1. 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
  1. 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

About

Python modules for post-processing the simulation outputs of OpenDDA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages