PyMieSim is a very easy to install/use tool for extensive Mie scattering analysis. It allows to study the light scattering on different kind of objects (scatterer) though at the moment, only spherical scatterers are implemented. Using this package, one can easily set a Source a Scatterer and a Detector within a very wide range of parameters such as:
Source structure (e.g. plane wave or Gaussian focused)
Scatterer refractive index
Medium refractive index
Detector type (photodiode or LPMode)
Detector numerical aperture
Detector angle offset in polarization parallel axis (\(\phi\))
Detector angle offset in polarization perpendicular axis (\(\theta\))
Detector coupling mode (Mean coupling or centered coupling)
The package also lets you construct an Experiment using ScattererSet, SourceSet and DetectorSet. Those class define the type of scatterers, light sources and detectors you want to study.
All the latest available documentation is available here or you can click the following badge:
It’s 2021, you don’t need to run all your code on you computer anymore. Google Colab is a platform which allows to write/use python scripts remotely. You can open the PyMieSim.ipynb in the file to access it or click on the following “Open in Colab” badge:
- You have two options to install this package:
Using the python package manager Pip
Manual installation (if the first case fail)
Linux Wheel support now extended to manylinux2014. This means that the library can been installed on basically all Linux plateform using the following command:
>>> pip install PyMieSim
MacOs/Windows To install the package you’ll need to do the following command:
>>> git clone https://github.com/MartinPdeS/PyMieSim.git && cd PyMieSim >>> git submodule update --init --recursive >>> mkdir build && cd build && cmake .. >>> make install >>> sudo python3 setup.py install
To run the Unit-tests, one need the coverage library.
>>> python3 -m unittest tests/Unittest.py
Here is an example on how to use the library.
from PyMieSim.Source import PlaneWave from PyMieSim.Detector import LPmode from PyMieSim.Scatterer import Sphere Source = PlaneWave(Wavelength = 450e-9, Polarization = 0, E0 = 1) Detector = LPmode(Mode = (0, 1), Rotation = 0., Sampling = 201, NA = 0.2, GammaOffset = 0, PhiOffset = 0, CouplingMode = 'Centered') Scat = Sphere(Diameter = 300e-9, Source = Source, Index = 1.4) Coupling = Detector.Coupling(Scatterer = Scat) print(Coupling) # output: 1.66e+02 nWatt
For more examples, I invite you to check the examples section of the documentation.
A large set of examples are avaialble in the Examples folder. You can also see them in the examples section of the documentation
Adding dumb-proof assertions
Adding Stokes parameter representations [DONE]
Multiprocess Experiment class
Adding more unittests
Adding monotonic metric to optimizer class [DONE]
Comments on c++ codes
Multiclass c++ codes
verify if changes of NA for <LPmode> class can be simplified [DONE]
adding travis and codecov [DONE]
adding material Sellmeier boundary
Citing this work?¶
(Is this the new “like, comment and share” ?)
I have worked out a Dockerfile (see the PyMieSim Git) to install all the necessaries library.
I you prefer to directly install in your computer the files you can do the following
Submodules install If you want to clone this repository do not forget to init and update the submodules.
>>> git clone https://github.com/MartinPdeS/PyMieSim.git && cd PyMieSim >>> git git submodule update --init --recursive
Fortran wrapper Be sure to have a fortran compiler installed such as “gfortran”.
>>> sudo apt-get install gfortran
C++ wrapper You now need to compile the c++ code for your specific python version. If no preferred version leave DVERSION blank.
As of 2021, the project is still under development. If you want to collaborate, it would be a pleasure! I encourage you to contact me.
PyMieSim was written by Martin Poinsinet de Sivry-Houle .