is a Mie scattering code for large grains written in Python and based on MIEX by Wolf & Voshchinnikov (2004).
The following quantities for
- single grain sizes / chemical components and
- mixtures of chemically different grains with a size distribution
can be calculated:
- Scattering matrix elements
$S_{11}$ ,$S_{12}$ ,$S_{33}$ , and$S_{34}$ , - Extinction efficiency factor (
$Q_\mathrm{ext}$ ) and Extinction cross-section ($C_\mathrm{ext}$ ), - Scattering efficiency factor (
$Q_\mathrm{sca}$ ) and Scattering cross-section ($C_\mathrm{sca}$ ), - Absorption efficiency factor (
$Q_\mathrm{abs}$ ) and Absorption cross-section ($C_\mathrm{abs}$ ), - Backscattering efficiency factor (
$Q_\mathrm{bk}$ ) and Backscattering cross-section ($C_\mathrm{bk}$ ), - Radiation pressure efficiency factor (
$Q_\mathrm{pr}$ ), - Albedo,
- Scattering asymmetry factor (
$g$ ).
Modified and ported to Python with permission of S. Wolf.
For the original source code of MIEX written in FORTRAN90
, we refer to
To run MIEX-Python, at least Python 3.6 and the following packages are required:
- numba
- numpy
To check the current version or to install the packages, run:
python3 --version
pip3 install -r requirements.txt
The package can be installed via pip
, change into the directory MIEX-Python
and run:
pip install .
miex_app.py can be used as a simple Streamlit web app: https://miex-python.streamlit.app/.
Alternatively, install Streamlit
pip3 install streamlit
and start the web app locally:
streamlit run miex_app.py
After installation, MIEX-Python can be imported via import miex
and used in any python script (see jupyter notebook 1).
To calculate the efficiency factors and scattering amplitude functions (optionally), use e.g.,
result = miex.get_mie_coefficients(x=1.0, m=complex(1.5, 0.0), nang=91, doSA=True)
Variable | Input Parameter | Type |
---|---|---|
x |
Size parameter | float |
m |
Complex refractive index | complex |
nang=2 |
Half number of scattering angles in the interval [0, 90] | int, optional |
doSA=False |
Calculate scattering amplitude functions | bool, optional |
nterm=2e7 |
Maximum number of terms to be considered | int, optional |
eps=1.0e-20 |
Accuracy to be achieved | float, optional |
xmin=1.0e-6 |
Minimum size parameter | float, optional |
The function returns a dictionary with the following entries:
Entry | Output Parameter | Type |
---|---|---|
Q_ext |
Extinction efficiency | float |
Q_abs |
Absorption efficiency | float |
Q_sca |
Scattering efficiency | float |
Q_bk |
Backscattering efficiency | float |
Q_pr |
Radiation pressure efficiency | float |
Albedo |
Single scattering albedo | float |
g_sca |
Scattering asymmetry factor | float |
SA_1 |
Scattering amplitude function | ndarray, complex |
SA_2 |
Scattering amplitude function | ndarray, complex |
theta |
Scattering angles [rad] | ndarray |
The scattering amplitude functions are an array with size 2*nang-1
.
To calculate the scattering matrix elements, use
scat_mat = miex.get_scattering_matrix(S1, S2)
where scat_mat["S_11"]
.
test_miex.py includes some test routines. The results are compared with results by Bohren & Huffman (1998) and by Wiscombe (1979):
python3 test_miex.py
.
├── ri-data # Input data used by MIEX-Python
├── README.me
├── miex
│ └── miex.py # Source code of MIEX-Python
├── miex_app.py # Python script to run MIEX-Python via Streamlit
├── miex_notebook_1.ipynb # Jupyter notebook on how to use MIEX-Python
├── requirements.txt # Required python packages for MIEX-Python
└── test_miex.py # Python script for test purposes
The original source code of MIEX written in FORTRAN90
is distributed under the CPC license.
Modified and ported to Python with permission of S. Wolf.