Skip to content

Commit

Permalink
Update Inverse.py
Browse files Browse the repository at this point in the history
Fixed: put a band-aid on the inputs to ContourIntersection_SD to correctly handle units. Please see readthedocs for an explanation.
  • Loading branch information
bsumlin committed Feb 23, 2020
1 parent 6dcbcab commit 2e6ce8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion PyMieScatt/Inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ def ContourIntersection(Qsca,Qabs,wavelength,diameter,Qback=None,n=None,k=None,n

def ContourIntersection_SD(Bsca,Babs,wavelength,dp,ndp,n=None,k=None,nMin=1,nMax=3,kMin=0.00001,kMax=1,Bback=None,gridPoints=60,interpolationFactor=2,maxError=0.005,fig=None,ax=None,axisOption=0):
# http://pymiescatt.readthedocs.io/en/latest/inverse.html#ContourIntersection_SD
# See discussion on documentation site for the following lines, where B needs to be scaled for correct units
Bsca *= 1e6
Babs *= 1e6
if Bback is not None:
Bback *= 1e6
if (type(Babs) == np.float64 and Babs == 0.0) or (type(Babs) in [list, tuple, np.ndarray] and Babs[0]==0):
k = 0.0
if k == 0.0:
Expand Down Expand Up @@ -825,4 +830,4 @@ def fastMieQ(m, wavelength, diameter):
qsca = (2/x2)*np.sum(n1*(an.real**2+an.imag**2+bn.real**2+bn.imag**2))
qback = (1/x2)*(np.abs(np.sum(n1*((-1)**n)*(an-bn)))**2)
qabs = qext-qsca
return qsca, qabs, qback
return qsca, qabs, qback

0 comments on commit 2e6ce8a

Please sign in to comment.