Skip to content

Commit

Permalink
1.5.2
Browse files Browse the repository at this point in the history
Fixed a big that would cause a single solution from two measurements to not be reported.
  • Loading branch information
bsumlin committed Mar 9, 2018
1 parent e375eb6 commit 8161185
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 18 deletions.
5 changes: 2 additions & 3 deletions PyMieScatt.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Metadata-Version: 1.1
Name: PyMieScatt
Version: 1.5.1
Version: 1.5.2
Summary: A collection of forward and inverse Mie solving routines based on Bohren and Huffman's Mie Theory derivations.
Home-page: http://air.eece.wustl.edu/people/ben-sumlin/
Author: Benjamin Sumlin
Author-email: bsumlin@wustl.edu
License: GPL
Description-Content-Type: UNKNOWN
Description: 1.5.1 - Added error bounds as an option for the graphical inversion method. Added new automatic inversion methods Inversion() and Inversion_SD(). Significantly improved the iterative methods.
Docs are hosted at `ReadTheDocs <http://pymiescatt.readthedocs.io/>`_.
Description: 1.5.2 - See `documentation <http://pymiescatt.readthedocs.io/>`_ for update notes.
Keywords: Mie Rayleigh scattering absorption extinction light refraction
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Expand Down
21 changes: 19 additions & 2 deletions PyMieScatt/CoreShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from scipy.special import jv, yv
from PyMieScatt.Mie import MieQ, MiePiTau

def MieQCoreShell(mCore,mShell,wavelength,dCore,dShell):
def MieQCoreShell(mCore,mShell,wavelength,dCore,dShell, asDict=False, asCrossSection=False):
# http://pymiescatt.readthedocs.io/en/latest/forwardCS.html#MieQCoreShell
xCore = np.pi*dCore/wavelength
xShell = np.pi*dShell/wavelength
Expand Down Expand Up @@ -36,7 +36,24 @@ def MieQCoreShell(mCore,mShell,wavelength,dCore,dShell):
qback = (1/xShell2)*(np.abs(np.sum(n1*((-1)**n)*(an-bn)))**2)
qratio = qback/qsca

return qext, qsca, qabs, g, qpr, qback, qratio
if asCrossSection:
css = np.pi*(dShell/2)**2
cext = css*qext
csca = css*qsca
cabs = css*qabs
cpr = css*qpr
cback = css*qback
cratio = css*qratio
if asDict:
return dict(Cext=cext,Csca=csca,Cabs=cabs,g=g,Cpr=cpr,Cback=cback,Cratio=cratio)
else:
return cext, csca, cabs, g, cpr, cback, cratio
else:
if asDict:
return dict(Qext=qext,Qsca=qsca,Qabs=qabs,g=g,Qpr=qpr,Qback=qback,Qratio=qratio)
else:
return qext, qsca, qabs, g, qpr, qback, qratio


def CoreShell_ab(mCore,mShell,xCore,xShell):
# http://pymiescatt.readthedocs.io/en/latest/forwardCS.html#CoreShell_ab
Expand Down
10 changes: 7 additions & 3 deletions PyMieScatt/Inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,13 @@ def find_intersections(A,B):
poly1 = geometry.LineString(v1)
poly2 = geometry.LineString(v2)
sol = poly1.intersection(poly2)
for s in sol:
X.append(s.x)
Y.append(s.y)
if type(sol)==geometry.point.Point:
X.append(sol.x)
Y.append(sol.y)
else:
for s in sol:
X.append(s.x)
Y.append(s.y)
except:
pass

Expand Down
2 changes: 1 addition & 1 deletion PyMieScatt/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.5.1"
__version__ = "1.5.2"
21 changes: 19 additions & 2 deletions build/lib/PyMieScatt/CoreShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from scipy.special import jv, yv
from PyMieScatt.Mie import MieQ, MiePiTau

def MieQCoreShell(mCore,mShell,wavelength,dCore,dShell):
def MieQCoreShell(mCore,mShell,wavelength,dCore,dShell, asDict=False, asCrossSection=False):
# http://pymiescatt.readthedocs.io/en/latest/forwardCS.html#MieQCoreShell
xCore = np.pi*dCore/wavelength
xShell = np.pi*dShell/wavelength
Expand Down Expand Up @@ -36,7 +36,24 @@ def MieQCoreShell(mCore,mShell,wavelength,dCore,dShell):
qback = (1/xShell2)*(np.abs(np.sum(n1*((-1)**n)*(an-bn)))**2)
qratio = qback/qsca

return qext, qsca, qabs, g, qpr, qback, qratio
if asCrossSection:
css = np.pi*(dShell/2)**2
cext = css*qext
csca = css*qsca
cabs = css*qabs
cpr = css*qpr
cback = css*qback
cratio = css*qratio
if asDict:
return dict(Cext=cext,Csca=csca,Cabs=cabs,g=g,Cpr=cpr,Cback=cback,Cratio=cratio)
else:
return cext, csca, cabs, g, cpr, cback, cratio
else:
if asDict:
return dict(Qext=qext,Qsca=qsca,Qabs=qabs,g=g,Qpr=qpr,Qback=qback,Qratio=qratio)
else:
return qext, qsca, qabs, g, qpr, qback, qratio


def CoreShell_ab(mCore,mShell,xCore,xShell):
# http://pymiescatt.readthedocs.io/en/latest/forwardCS.html#CoreShell_ab
Expand Down
10 changes: 7 additions & 3 deletions build/lib/PyMieScatt/Inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,13 @@ def find_intersections(A,B):
poly1 = geometry.LineString(v1)
poly2 = geometry.LineString(v2)
sol = poly1.intersection(poly2)
for s in sol:
X.append(s.x)
Y.append(s.y)
if type(sol)==geometry.point.Point:
X.append(sol.x)
Y.append(sol.y)
else:
for s in sol:
X.append(s.x)
Y.append(s.y)
except:
pass

Expand Down
2 changes: 1 addition & 1 deletion build/lib/PyMieScatt/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.5.1"
__version__ = "1.5.2"
Binary file removed dist/PyMieScatt-1.5.1.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/PyMieScatt-1.5.2.tar.gz
Binary file not shown.
10 changes: 7 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Install PyMieScatt

NOTE: You must install `Shapely <https://shapely.readthedocs.io/>`_ first, preferably from GitHub. Users have reported difficulty installing it with pip.

The current version is 1.5.1. You can install PyMieScatt from `The Python Package Index (PyPI) <https://pypi.python.org/pypi/PyMieScatt>`_ with ::
The current version is 1.5.2. You can install PyMieScatt from `The Python Package Index (PyPI) <https://pypi.python.org/pypi/PyMieScatt>`_ with ::

$ pip install PyMieScatt

Expand All @@ -30,14 +30,18 @@ or from `GitHub <https://github.com/bsumlin/PyMieScatt>`_. Clone the repository

$ python setup.py install

Revision Notes - version 1.5.1 (7 March, 2018)
Revision Notes - version 1.5.2 (9 March, 2018)
-------------------------------------------------

- Added the option to report single-particle Mie efficiencies as optical cross-sections. This affects :py:func:`MieQ`, :py:func:`RayleighMieQ`, :py:func:`AutoMieQ`, :py:func:`LowFrequencyMieQ`, and :py:func:`MieQCoreShell`. The results carry units of nm\ :sup:`2`.
- Fixed a bug that would occasionally cause a single solution from two optical measurements to not be reported (thanks to Miriam Elser for pointing this bug out).

Revision History
----------------

- 1.5.1 (7 March, 2018)

- Added the option to report single-particle Mie efficiencies as optical cross-sections. This affects :py:func:`MieQ`, :py:func:`RayleighMieQ`, :py:func:`AutoMieQ`, :py:func:`LowFrequencyMieQ`, and :py:func:`MieQCoreShell`. The results carry units of nm\ :sup:`2`.

- 1.4.3 (21 February, 2018)

- Fixed a small bug in :py:func:`ContourIntersection` and :py:func:`ContourIntersection_SD` that would produce an error if no intersections were detected. Now it just throws a warning. I'll update soon to have better reporting.
Expand Down

0 comments on commit 8161185

Please sign in to comment.