Skip to content

Commit

Permalink
cleaning of contrib_spheroids.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lavakyan committed Mar 5, 2021
1 parent 81bde33 commit 5d5f6a0
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions mstm_studio/contrib_spheroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# #
# ----------------------------------------------------- #
"""
Contributions to UV/vis extinction spectra other
then obtained from MSTM.
Contributions to optical extinction spectra from axial-symmetric
particles. Currently, spheroids.
"""
from __future__ import print_function
from __future__ import division
Expand Down Expand Up @@ -134,31 +134,3 @@ def plot_shape(self, values, fig=None, axs=None):
plt.show()
return fig, axs


if __name__== '__main__':
# tests come here
from mstm_studio.alloy_AuAg import AlloyAuAg
wls = np.linspace(300, 800, 51)
npsize = 10
sph = SpheroidSP(wavelengths=wls)
sph.set_material(AlloyAuAg(x_Au=1), 1.5)
sph.NORDER = 5
sph.plot_shape([1, npsize, 1.0])
ext_sph = sph.calculate([1, npsize, 1.0])
# sph.plot([1, 10, 1.0]) # scale, diameter, aspect

from mstm_studio.contributions import MieSingleSphere
mie = MieSingleSphere(name='mie', wavelengths=wls)
mie.set_material(AlloyAuAg(x_Au=1), 1.5)
ext_mie = mie.calculate([1, npsize])

ext_sph = ext_sph
norm_sph = np.sum(ext_sph)
ext_mie = ext_mie
norm_mie = np.sum(ext_mie)
scale = norm_mie / norm_sph
print('scale mult: %f' % scale)
plt.plot(wls, ext_sph * scale, label='T-mat')
plt.plot(wls, ext_mie, label='Mie')
plt.legend()
plt.show()

0 comments on commit 5d5f6a0

Please sign in to comment.