From 970b25b9c25f4cbccf80a10ba60bda381d97f4dd Mon Sep 17 00:00:00 2001 From: xuewei <1550505935@qq.com> Date: Tue, 25 May 2021 21:53:57 +0800 Subject: [PATCH 1/2] fix inverse --- PyMieScatt/Inverse.py | 96 +++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/PyMieScatt/Inverse.py b/PyMieScatt/Inverse.py index 66c8e8d..9ab7540 100644 --- a/PyMieScatt/Inverse.py +++ b/PyMieScatt/Inverse.py @@ -16,7 +16,7 @@ def coerceDType(d): return d def Inversion(Qsca,Qabs,wavelength,diameter,nMin=1,nMax=3,kMin=0.001,kMax=1,scatteringPrecision=0.010,absorptionPrecision=0.010,spaceSize=120,interp=2): - + nRange = np.linspace(nMin,nMax,spaceSize) kRange = np.logspace(np.log10(kMin),np.log10(kMax),spaceSize) scaSpace = np.zeros((spaceSize,spaceSize)) @@ -32,13 +32,13 @@ def Inversion(Qsca,Qabs,wavelength,diameter,nMin=1,nMax=3,kMin=0.001,kMax=1,scat kRange = zoom(kRange,interp) scaSpace = zoom(scaSpace,interp) absSpace = zoom(absSpace,interp) - + scaSolutions = np.where(np.logical_and(Qsca*(1-scatteringPrecision) Date: Tue, 25 May 2021 22:12:37 +0800 Subject: [PATCH 2/2] Fix erros in Visualization of the Contour Intersection Inversion Method --- docs/examples.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/examples.rst b/docs/examples.rst index 967a01e..cd748e1 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -514,21 +514,21 @@ This example illustrates the algorithm used by the contour intersection method. qbackerrs = [Qm[2]-Qm[2]*err,Qm[2]+Qm[2]*err] ax1.plot_surface(nSurf,kSurf,QscaSurf,rstride=1,cstride=1,cmap=c1,alpha=0.5) - ax1.contour(nSurf,kSurf,QscaSurf,Qm[0],linewidths=2,colors='r',linestyles='dashdot') + ax1.contour(nSurf,kSurf,QscaSurf,[Qm[0]],linewidths=2,colors='r',linestyles='dashdot') ax1.contour(nSurf,kSurf,QscaSurf,qscaerrs,linewidths=0.5,colors='r',linestyles='dashdot',alpha=0.75) - ax1.contour(nSurf,kSurf,QscaSurf,Qm[0],linewidths=2,colors='r',linestyles='dashdot',offset=0) + ax1.contour(nSurf,kSurf,QscaSurf,[Qm[0]],linewidths=2,colors='r',linestyles='dashdot',offset=0) ax1.contourf(nSurf,kSurf,QscaSurf,qscaerrs,colors='r',offset=0,alpha=0.25) ax2.plot_surface(nSurf,kSurf,QabsSurf,rstride=1,cstride=1,cmap=c2,alpha=0.5) - ax2.contour(nSurf,kSurf,QabsSurf,Qm[1],linewidths=2,colors='b',linestyles='solid') + ax2.contour(nSurf,kSurf,QabsSurf,[Q]m[1]],linewidths=2,colors='b',linestyles='solid') ax2.contour(nSurf,kSurf,QabsSurf,qabserrs,linewidths=0.5,colors='b',linestyles='solid',alpha=0.75) - ax2.contour(nSurf,kSurf,QabsSurf,Qm[1],linewidths=2,colors='b',linestyles='solid',offset=0) + ax2.contour(nSurf,kSurf,QabsSurf,[Qm[1]],linewidths=2,colors='b',linestyles='solid',offset=0) ax2.contourf(nSurf,kSurf,QabsSurf,qabserrs,colors='b',offset=0,alpha=0.25) ax3.plot_surface(nSurf,kSurf,QbackSurf,rstride=1,cstride=1,cmap=c3,alpha=0.5) - ax3.contour(nSurf,kSurf,QbackSurf,Qm[2],linewidths=2,colors='g',linestyles='dotted') + ax3.contour(nSurf,kSurf,QbackSurf,[Qm[2]],linewidths=2,colors='g',linestyles='dotted') ax3.contour(nSurf,kSurf,QbackSurf,qbackerrs,linewidths=0.5,colors='g',linestyles='dotted',alpha=0.75) - ax3.contour(nSurf,kSurf,QbackSurf,Qm[2],linewidths=2,colors='g',linestyles='dotted',offset=0) + ax3.contour(nSurf,kSurf,QbackSurf,[Qm[2]],linewidths=2,colors='g',linestyles='dotted',offset=0) ax3.contourf(nSurf,kSurf,QbackSurf,qbackerrs,colors='g',offset=0,alpha=0.25) boxLabels = ["Qsca","Qabs","Qback"]