ARTmie
ARTmie is a python library to calculate optical properties of spherical particles.
Those can be simple, single coated or drawn from a particle size distribution.
ARTmie uses a lot of improved C++ in the backend for accelaration of various calculations.
The Code was mainly ported from Matlab and Fortran to C++.
Installation
from the Python Package Index (PyPI)
pip install ARTmie
from source
- Download the source code from this git by clicking the triangular button next to
Codeand selecting e.g. zip underneath Download source code. - Extract the source code to a desired location.
- Open a terminal with an appropriate python environment (Python 3.0 or higher) and Numpy (1.5 or higher, tested with 2.0).
- Change to the directory of the ARTmie project (dir above src):
cd /path/to/ARTmie
- Install it with the following command:
python -m pip install .
Requirements
- Python 3.0 or higher
- Numpy 1.5 or higher, preferable 2.0 or higher
- On windows with VS-Code: Microsoft Visual C++ 14.0 or higher
Example
Calculating the Mie efficiencies for extinction, scattering, absoprtion and backscattering for a glass sphere (crown glass, BK7) depending on the wavelength
Refractive index data are taken from wikipedia and refractiveindex.info
#import libraries
import numpy as np
np.set_printoptions(threshold=200)
import matplotlib.pyplot as plt
import ARTmie
#setup date
wavelength = np.linspace(200.0, 2000.0, 1000) #nanometers
w2 = (wavelength/1000.0)**2
b1,b2,b3,c1,c2,c3 = 1.03961212,0.231792344,1.01046945,6.00069867e-3,2.00179144e-2,103.560653
m_bk7 = np.sqrt(1.0+w2*(b1/(w2-c1)+b2/(w2-c2)+b3/(w2-c3))) #real part, from wikipedia (see above)
m_bk7 = m_bk7+9.7525e-9*1j #imaginary part, fix value, because its variability can be neglected (from refractiveindex.info see above)
diam = 200.0 #nanometers
#calculate Mie efficiencies
mie = ARTmie.MieQ(m_bk7,diam,wavelength, asDict=True)
print(mie)
{'Qext': array([4.41564110e+00, 4.28610971e+00, 4.17518991e+00, ...,
2.23387660e-03, 2.22560118e-03, 2.21736348e-03], shape=(1000,)), 'Qsca': array([4.41564090e+00, 4.28610952e+00, 4.17518973e+00, ...,
2.23387013e-03, 2.22559471e-03, 2.21735702e-03], shape=(1000,)), 'Qabs': array([1.98117068e-07, 1.88077067e-07, 1.78400203e-07, ...,
6.47562109e-09, 6.46930174e-09, 6.46299577e-09], shape=(1000,)), 'Qback': array([1.87779191, 1.78529354, 1.67319268, ..., 0.00319725, 0.00318568,
0.00317416], shape=(1000,)), 'Qratio': array([0.4252592 , 0.41653008, 0.4007465 , ..., 1.43125931, 1.43138174,
1.43150385], shape=(1000,)), 'Qpr': array([1.53362294, 1.4964994 , 1.45816498, ..., 0.00219041, 0.00218237,
0.00217437], shape=(1000,)), 'g': array([0.652684 , 0.65084905, 0.65075484, ..., 0.01945852, 0.01942341,
0.0193884 ], shape=(1000,))}
#plot the results
plt.figure()
ax = plt.gca()
ax.plot(wavelength, mie['Qext'], ls='-', label='Qext')
ax.plot(wavelength, mie['Qsca'], ls='--', label='Qsca')
ax.plot(wavelength, mie['Qabs'], ls='-.', label='Qabs')
ax.plot(wavelength, mie['Qback'], ls=':', label='Qback')
ax.set_xlabel('wavelength [nm]')
ax.set_ylabel('efficiency [--]')
ax.set_title('Scattering efficiencies of BK7 crown glass')
ax.legend()
plt.show()
License
ARTmie is available under the 3-Clause BSD license. See LICENSE for license information.
Contributor(s)
Enrico P. Metzner
Roadmap
for version 0.2.0:
- 1dimensional arrays for input arguments sizepar1 & sizepar2 in Size_Distribution_Optics and Size_Distribution_Phase_Function
- Size_Distribution_Phase_Function can also take an array of angles (theta) instead of predefined equally spaced 721 angles from 0° to 180°
Developement status
There are ideas, what to add to the library, but the developement is slowed down.
Main features needed for work are implemented.
Any suggestions on how to make the library more flexible and how to speed things up are welcome.
Metadata
Release files for ARTmie 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| artmie-0.1.3.tar.gz | 67.7 kB | Details |
Release files / artmie-0.1.3.tar.gz
| Download URL | artmie-0.1.3.tar.gz |
|---|---|
| Size | 67.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7ff2ef1c52656db4c9d2a95dc99b18883b4d7bc0908c52d2a606500d2469892
|
|
BLAKE2b-256 checksum How to use checksums |
1c82fd1118c56c7524c18c22ee33a53220265581edb858f2234bad94863dc53e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency log