MartinPdeS / PyMieSim

Python package for Mie scattering computation and analysis.
MIT License
18 stars 5 forks source link

Qabs wierd behaviour at low size parameters #2

Closed MartinPdeS closed 2 years ago

MartinPdeS commented 3 years ago

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')
MartinPdeS commented 2 years ago

Fixed in a previous commit