Skip to content

Commit

Permalink
Update Mie.py
Browse files Browse the repository at this point in the history
Fixed: an error in AutoMieQ that was calculating effective refractive index and wavelength twice if nMedium != 1
  • Loading branch information
bsumlin committed Feb 23, 2020
1 parent 3cc055f commit 6dcbcab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions PyMieScatt/Mie.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ def RayleighMieQ(m, wavelength, diameter, nMedium=1.0, asDict=False, asCrossSect
def AutoMieQ(m, wavelength, diameter, nMedium=1.0, crossover=0.01, asDict=False, asCrossSection=False):
# http://pymiescatt.readthedocs.io/en/latest/forward.html#AutoMieQ
nMedium = nMedium.real
m /= nMedium
wavelength /= nMedium
x = np.pi*diameter/wavelength
if x==0:
m_eff = m / nMedium
wavelength_eff = wavelength / nMedium
x_eff = np.pi*diameter/wavelength_eff
if x_eff==0:
return 0, 0, 0, 1.5, 0, 0, 0
elif x<crossover:
elif x_eff<crossover:
return RayleighMieQ(m, wavelength, diameter, nMedium, asDict=asDict, asCrossSection=asCrossSection)
else:
return MieQ(m, wavelength, diameter, nMedium, asDict=asDict, asCrossSection=asCrossSection)
Expand Down Expand Up @@ -526,4 +526,4 @@ def Mie_Lognormal(m,wavelength,geoStdDev,geoMean,numberOfParticles,nMedium=1.0,
if asDict==True:
return dict(Bext=Bext, Bsca=Bsca, Babs=Babs, bigG=bigG, Bpr=Bpr, Bback=Bback, Bratio=Bratio)
else:
return Bext, Bsca, Babs, bigG, Bpr, Bback, Bratio
return Bext, Bsca, Babs, bigG, Bpr, Bback, Bratio

0 comments on commit 6dcbcab

Please sign in to comment.