{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Using the Scatterer module"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this notebook, we will be describing how to use the `Free_Space_Scatterer` class provided in the Scatterer module. This class provides access to the functions provided by the `Free_Space_Scatterer` class of SCATMECH. These include the models\n",
"* RayleighScatterer\n",
"* RayleighGansSphereScatterer\n",
"* MieScatterer\n",
"* CoatedMieScatterer\n",
"* MultilayerCoatedMieScatterer\n",
"* Optically_Active_Sphere_Scatterer\n",
"* TMatrix_Axisymmetric_Scatterer\n",
"\n",
"First, import the libraries we will need. We will be graphing some data, and using the NumPy package."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from pySCATMECH.scatterer import * "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Mie scattering\n",
"\n",
"Let's start by looking at scattering by homogeneous spheres (Mie scatering). We start by creating a model and setting its parameters:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{None : 'MieScatterer',\n",
"'lambda' : '0.532',\n",
"'medium' : '(1,0)',\n",
"'radius' : '0.1',\n",
"'sphere' : '(1.59,0)'}\n"
]
}
],
"source": [
"parameters = {\n",
" 'lambda' : 0.532,\n",
" 'medium' : 1,\n",
" 'radius' : 0.1,\n",
" 'sphere' : 1.59}\n",
"\n",
"model = Free_Space_Scatterer(\"MieScatterer\",parameters)\n",
"\n",
"print(model)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can evaluate the Mueller matrix differential scattering cross section in any pair of directions, defined by two directional vectors. The basis set for the Mueller matrix is perpendicular and parallel to the plane of scattering, defined by the incident and scattering directions."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 2.30829762e-03 -6.16046580e-04 0.00000000e+00 0.00000000e+00]\n",
" [-6.16046580e-04 2.30829762e-03 0.00000000e+00 0.00000000e+00]\n",
" [ 0.00000000e+00 0.00000000e+00 2.22445889e-03 -2.25210041e-05]\n",
" [ 0.00000000e+00 0.00000000e+00 2.25210041e-05 2.22445889e-03]]\n"
]
}
],
"source": [
"theta = 45*deg\n",
"\n",
"vin = [0,0,1] \n",
"vout = [np.sin(theta),0,np.cos(theta)]\n",
"\n",
"m = model.DifferentialScatteringCrossSection(vin,vout)\n",
"print(m)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's plot the scattering function:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"\r\n",
"\r\n",
"\r\n",
"\r\n"
],
"text/plain": [
"