martinpdes / pymiesim Goto Github PK
View Code? Open in Web Editor NEWPython package for Mie scattering computation and analysis.
License: MIT License
Python package for Mie scattering computation and analysis.
License: MIT License
Unittesting doesn't run without error for the self-hosted arm64 workflow.
It looks like cibuildwheel use the command pip install, and I cannot make an alias of pip (looks like it's a known bug of GH-actions).
Hi,
First, thanks so much for this great package. Very impressive work!
While trying to get myself more acquainted with the package I got a bit confused about the use of shell_width
vs shell_diameter
in a CoreShell
particle.
shell_width
is used in a CoreShell
particle (see) and shell_diameter
is used in a CoreShellSet (see).
I assume both refer to the thickness of the shell? However, when I look at one of your examples you set the shell_diameter
to 800 nm and the core_diameter
to 400 - 600 nm, suggesting shell_diameter
does not refer to the thickness of the shell but to the diameter of the entire particle.
So could you clarify for me if shell_width
and shell_diameter
refer to the same thing and if so, if they mean the thickness of the shell?
Contrary to all other angles (gamma_offset, phi_offset, source polarization_value) which are to be given in degrees, the detector's polarization_filter is to be given in rad. This is not documented and also the default plots show it as if were degrees. I'd suggest to changing to degrees for consitency with the other angles.
The Experiment class cannot compute the detector coupling with the OpenMP parallel for because of the ndarray which, allegedly, would need to get hand on the GIL of the python interpreter. Easiest fix-up would be to just get rid of ndarray and work only with the equivalent std::vector.
Hello,
I went through the PyMieSim and it is a great job, congrats!
I installed PyMieSim after cloning the repository locally. I try to follow the SPF computation example, but it fails. See below the error message:
❯ python PyMieSim/mesh.py
Traceback (most recent call last):
File "/home/stathaki/EPFL/Simulations/PyMieSim/PyMieSim/mesh.py", line 7, in <module>
from PyMieSim.binary.Fibonacci import FIBONACCI
ModuleNotFoundError: No module named 'PyMieSim.binary.Fibonacci'
Also from inside an ipython session:
In [1]: from PyMieSim.scatterer import Sphere
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from PyMieSim.scatterer import Sphere
File ~/EPFL/Simulations/PyMieSim/.direnv/python-3.10.12/lib/python3.10/site-packages/PyMieSim/scatterer.py:10
7 from tabulate import tabulate
9 from PyOptik import ExpData
---> 10 from PyMieSim.mesh import FibonacciMesh
11 from PyMieSim.source import PlaneWave
12 from PyMieSim.representations import S1S2, FarField, Stokes, SPF, Footprint
File ~/EPFL/Simulations/PyMieSim/.direnv/python-3.10.12/lib/python3.10/site-packages/PyMieSim/mesh.py:7
4 import numpy
5 from dataclasses import dataclass
----> 7 from PyMieSim.binary.Fibonacci import FIBONACCI
8 from MPSPlots.render3D import SceneList as SceneList3D
11 @dataclass
12 class FibonacciMesh():
ModuleNotFoundError: No module named 'PyMieSim.binary.Fibonacci'
What am I doing wrong?
Thank you
It seems that the code produce negative Qabs in some conditions.
MWE:
import numpy as np
from PyMieSim import Material
from PyMieSim.Scatterer import Sphere
from PyMieSim.Source import PlaneWave
from PyMieSim.Detector import Photodiode
from PyMieSim.Experiment import ScatSet, SourceSet, Setup, DetectorSet
scatKwargs = { 'Diameter' : np.geomspace(6.36e-09, 10000e-9, 1500),
'Material' : [Material('Silver')],
'nMedium' : [1] }
sourceKwargs = { 'Wavelength' : [400e-9],
'Polarization' : [0]}
scatSet = ScatSet(Scatterer = Sphere, kwargs = scatKwargs )
sourceSet = SourceSet(Source = PlaneWave, kwargs = sourceKwargs )
Experiment = Setup(ScattererSet = scatSet,
SourceSet = sourceSet)
Data = Experiment.Get(Input=['Qsca', 'Qabs'])
Data.Plot(x='diameter', Scale='log', Groupby='type')
There appears to be a runtime linking error with the windows wheel build on GH-actions: windows-latest.
This is closely related to MinGW not being in the path.
What I already tried:
- statically link winpthread (unsuccessfull)
- adding Mingw library directory to path (unsuccessfull)
- removing OpenMP::OpenMP_CXX target link from CmakeList for windows build only (successfull)
I am leaving it this way for the moment, but it is on the to-do list!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.