Skip to content

Commit

Permalink
Fixed q-space steps
Browse files Browse the repository at this point in the history
Adjusted q-space per comments from zcm73400
  • Loading branch information
bsumlin committed May 6, 2019
1 parent a5a5450 commit cec07b3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
3 changes: 1 addition & 2 deletions PyMieScatt.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ Summary: A collection of forward and inverse Mie solving routines based on Bohre
Home-page: http://air.eece.wustl.edu/people/ben-sumlin/
Author: Benjamin Sumlin
Author-email: bsumlin@wustl.edu
License: GPL
Description-Content-Type: UNKNOWN
License: MIT
Description: 1.7.3 - See `documentation <http://pymiescatt.readthedocs.io/>`_ for update notes.
Keywords: Mie Rayleigh scattering absorption extinction light refraction
Platform: UNKNOWN
Expand Down
23 changes: 13 additions & 10 deletions PyMieScatt/Mie.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ def Mie_ab(m,x):
mx = m*x
nmax = np.round(2+x+4*(x**(1/3)))
nmx = np.round(max(nmax,np.abs(mx))+16)
n = np.arange(1,nmax+1)
nu = n + 0.5
n = np.arange(1,nmax+1) #
nu = n + 0.5 #

sx = np.sqrt(0.5*np.pi*x)
px = sx*jv(nu,x)

p1x = np.append(np.sin(x), px[0:int(nmax)-1])
chx = -sx*yv(nu,x)
px = sx*jv(nu,x) #
p1x = np.append(np.sin(x), px[0:int(nmax)-1]) #

ch1x = np.append(np.cos(x), chx[0:int(nmax)-1])
gsx = px-(0+1j)*chx
gs1x = p1x-(0+1j)*ch1x
chx = -sx*yv(nu,x) #
ch1x = np.append(np.cos(x), chx[0:int(nmax)-1]) #

gsx = px-(0+1j)*chx #
gs1x = p1x-(0+1j)*ch1x #

# B&H Equation 4.89
Dn = np.zeros(int(nmx),dtype=complex)
Expand Down Expand Up @@ -304,10 +305,12 @@ def ScatteringFunction(m, wavelength, diameter, nMedium=1.0, minAngle=0, maxAngl
adjust = 1

if space in ['q','qspace','QSPACE','qSpace']:
_steps *= 10
# _steps *= 10
_steps += 1
if minAngle==0:
minAngle = 1e-5
measure = np.logspace(np.log10(minAngle),np.log10(maxAngle),_steps)*np.pi/180
#measure = np.logspace(np.log10(minAngle),np.log10(maxAngle),_steps)*np.pi/180
measure = np.linspace(minAngle, maxAngle, _steps)*np.pi/180
_q = True
else:
measure = np.linspace(minAngle,maxAngle,_steps)*adjust
Expand Down
23 changes: 13 additions & 10 deletions build/lib/PyMieScatt/Mie.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ def Mie_ab(m,x):
mx = m*x
nmax = np.round(2+x+4*(x**(1/3)))
nmx = np.round(max(nmax,np.abs(mx))+16)
n = np.arange(1,nmax+1)
nu = n + 0.5
n = np.arange(1,nmax+1) #
nu = n + 0.5 #

sx = np.sqrt(0.5*np.pi*x)
px = sx*jv(nu,x)

p1x = np.append(np.sin(x), px[0:int(nmax)-1])
chx = -sx*yv(nu,x)
px = sx*jv(nu,x) #
p1x = np.append(np.sin(x), px[0:int(nmax)-1]) #

ch1x = np.append(np.cos(x), chx[0:int(nmax)-1])
gsx = px-(0+1j)*chx
gs1x = p1x-(0+1j)*ch1x
chx = -sx*yv(nu,x) #
ch1x = np.append(np.cos(x), chx[0:int(nmax)-1]) #

gsx = px-(0+1j)*chx #
gs1x = p1x-(0+1j)*ch1x #

# B&H Equation 4.89
Dn = np.zeros(int(nmx),dtype=complex)
Expand Down Expand Up @@ -304,10 +305,12 @@ def ScatteringFunction(m, wavelength, diameter, nMedium=1.0, minAngle=0, maxAngl
adjust = 1

if space in ['q','qspace','QSPACE','qSpace']:
_steps *= 10
# _steps *= 10
_steps += 1
if minAngle==0:
minAngle = 1e-5
measure = np.logspace(np.log10(minAngle),np.log10(maxAngle),_steps)*np.pi/180
#measure = np.logspace(np.log10(minAngle),np.log10(maxAngle),_steps)*np.pi/180
measure = np.linspace(minAngle, maxAngle, _steps)*np.pi/180
_q = True
else:
measure = np.linspace(minAngle,maxAngle,_steps)*adjust
Expand Down
Binary file modified dist/PyMieScatt-1.7.3-py3-none-any.whl
Binary file not shown.
Binary file modified dist/PyMieScatt-1.7.3.tar.gz
Binary file not shown.

0 comments on commit cec07b3

Please sign in to comment.