Skip to content

Commit

Permalink
TST: test for spheroids (equal to mie for perfect sphere)
Browse files Browse the repository at this point in the history
  • Loading branch information
lavakyan committed Mar 5, 2021
1 parent 78f6485 commit 2749a9d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions mstm_studio/test/test_contrib_spheroid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
#
# ----------------------------------------------------- #
# #
# This code is a part of T-matrix fitting project #
# Contributors: #
# L. Avakyan <laavakyan@sfedu.ru> #
# #
# ----------------------------------------------------- #
from __future__ import print_function
from __future__ import division

import pytest

from mstm_studio.mstm_spectrum import Material
from mstm_studio.contrib_spheroid import SpheroidSP
from mstm_studio.contributions import MieSingleSphere

import numpy as np
import os


def test_spheroidSP():
mat_gold = Material(os.path.join('..', 'nk', 'etaGold.txt'))
wls = np.linspace(300, 800, 51)
npsize = 10 # diameter of nanoparticle
sph = SpheroidSP(wavelengths=wls)
sph.set_material(mat_gold, 1.5)
ext_sph = sph.calculate([1, npsize, 1.0])

mie = MieSingleSphere(name='mie', wavelengths=wls)
mie.set_material(mat_gold, 1.5)
ext_mie = mie.calculate([1, npsize])

assert(np.allclose(ext_sph, ext_mie))

0 comments on commit 2749a9d

Please sign in to comment.