The sample object

Scott Prahl

Aug 2021

[1]:
import iadpython

Object creation

The Sample object contains all the information needed to calculate the reflected and transmitted light for a 1D air-slide-sample-slide-air sandwich.

If glass slides are not present, then they can be set to have an index of refraction equal to 1 (that of the air).

The default object created by Sample() is absorbing-only, 1mm thick, with an index of refraction of 1.

[2]:
s = iadpython.Sample()
print(s)
Intrinsic Properties
   albedo            = 0.000
   optical thickness = 1.000
   anisotropy        = 0.000
   thickness         = 1.000 mm
   sample index      = 1.000
   top slide index   = 1.000
   bottom slide index= 1.000
 cos(theta incident) = 1.000
   quadrature points = 4

Derived quantities
   mu_a              = 1.000 1/mm
   mu_s              = 0.000 1/mm
   mu_s*(1-g)        = 0.000 1/mm
      theta incident = 0.0°
 cos(theta critical) = 0.0000
      theta critical = 90.0°

The correct values can be used when the sample object is created.

[7]:
a = 0.8 # albedo
b = 2.0 # optical thickness
g = 0.9 # scattering anisotropy
d = 2.0 # physical thickness of the sample
s = iadpython.Sample(a=a,b=b,g=g,d=d)
print(s)
Intrinsic Properties
   albedo            = 0.800
   optical thickness = 2.000
   anisotropy        = 0.900
   thickness         = 2.000 mm
   sample index      = 1.000
   top slide index   = 1.000
   bottom slide index= 1.000
 cos(theta incident) = 1.000
   quadrature points = 4

Derived quantities
   mu_a              = 0.200 1/mm
   mu_s              = 0.800 1/mm
   mu_s*(1-g)        = 0.080 1/mm
      theta incident = 0.0°
 cos(theta critical) = 0.0000
      theta critical = 90.0°

Or all the values can be changed.

[45]:
s = iadpython.Sample()
s.a = 0.99 # albedo
s.b = 2.0 # optical thickness
s.g = 0.9 # scattering anisotropy
s.d = 2.0 # physical thickness of the sample
s.quad_pts=8
s.n = 1.3
s.n_above = 1.532
s.n_below = 1.532
print(s)
Intrinsic Properties
   albedo            = 0.990
   optical thickness = 2.000
   anisotropy        = 0.900
   thickness         = 2.000 mm
   sample index      = 1.300
   top slide index   = 1.532
   bottom slide index= 1.532
 cos(theta incident) = 1.000
   quadrature points = 8

Derived quantities
   mu_a              = 0.010 1/mm
   mu_s              = 0.990 1/mm
   mu_s*(1-g)        = 0.099 1/mm
      theta incident = 0.0°
 cos(theta critical) = 0.6390
      theta critical = 50.3°

Calculated values

The scattering and absorption coeffients easily obtained.

[27]:
print('The scattering coefficient is %.3f [1/mm]' % s.mu_s())
print('The absorption coefficient is %.3f [1/mm]' % s.mu_a())
print('The reduced scattering coefficient is %.3f [1/mm]' % s.mu_sp())
The scattering coefficient is 0.990 [1/mm]
The absorption coefficient is 0.010 [1/mm]
The reduced scattering coefficient is 0.099 [1/mm]

The quadrature angles and weight might also be found.

[34]:
s.update_quadrature()
print(" i    mu    weight  2*mu*w")
for i,mu in enumerate(s.nu):
    two_mu_w = s.twonuw[i]
    w = two_mu_w / 2 / mu
    print("%2d %.5f %.5f %.5f" % (i, mu, w, two_mu_w))

 i    mu    weight  2*mu*w
 0 0.04859 0.12172 0.01183
 1 0.23096 0.22820 0.10541
 2 0.46890 0.22820 0.21401
 3 0.65126 0.12172 0.15855
 4 0.72644 0.06617 0.09614
 5 0.82275 0.11651 0.19173
 6 0.93627 0.09870 0.18482
 7 1.00000 0.01876 0.03752

The reflection and transmission matrices for this sample for light from the bottom and light from the top are identical (and they should be because of the symmetry).

[44]:
R03, R30, T03, T30 = s.rt_matrices()

print("Reflected light for light incident from the top")
s.wrmatrix(R03)

print("Reflected light for light incident from the bottom")
s.wrmatrix(R30)

print("\n**************\nTransmitted light for light incident from the top")
s.wrmatrix(T03)

print("Transmitted light for light incident from the bottom")
s.wrmatrix(T30)
Reflected light for light incident from the top
cos_theta |  0.04436  0.21087  0.42810  0.59461  0.67095  0.78680  0.92334  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04436 |    *****  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.21087 |  0.00000 11.38065  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.42810 |  0.00000  0.00000  5.60563  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.59461 |  0.00000  0.00000  0.00000  7.56644  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.67095 |  0.00000  0.00000  0.00000  0.00000  2.84086  0.35528  0.22764  0.15525 |  0.43869
  0.78680 |  0.00000  0.00000  0.00000  0.00000  0.35528  0.66950  0.19884  0.14898 |  0.23591
  0.92334 |  0.00000  0.00000  0.00000  0.00000  0.22764  0.19884  0.37339  0.12491 |  0.15567
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.15525  0.14898  0.12491  1.22254 |  0.13200
----------+-------------------------------------------------------------------------+---------
  flux    |  1.00000  1.00000  1.00000  1.00000  0.43869  0.23591  0.15567  0.13200 |  0.23486

Reflected light for light incident from the bottom
cos_theta |  0.04436  0.21087  0.42810  0.59461  0.67095  0.78680  0.92334  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04436 |    *****  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.21087 |  0.00000 11.38065  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.42810 |  0.00000  0.00000  5.60563  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.59461 |  0.00000  0.00000  0.00000  7.56644  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.67095 |  0.00000  0.00000  0.00000  0.00000  2.36601  0.43778  0.28194  0.19267 |  0.41976
  0.78680 |  0.00000  0.00000  0.00000  0.00000  0.43778  0.55633  0.25015  0.18750 |  0.23275
  0.92334 |  0.00000  0.00000  0.00000  0.00000  0.28194  0.25015  0.28414  0.18337 |  0.15585
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.19267  0.18750  0.18337  0.64415 |  0.13120
----------+-------------------------------------------------------------------------+---------
  flux    |  1.00000  1.00000  1.00000  1.00000  0.41976  0.23275  0.15585  0.13120 |  0.23027


**************
Transmitted light for light incident from the top
cos_theta |  0.04436  0.21087  0.42810  0.59461  0.67095  0.78680  0.92334  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04436 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.21087 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.42810 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.59461 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.67095 |  0.00000  0.00000  0.00000  0.00000  1.82457  0.82078  0.51591  0.28526 |  0.50187
  0.78680 |  0.00000  0.00000  0.00000  0.00000  0.79244  1.90450  0.77877  0.47102 |  0.69665
  0.92334 |  0.00000  0.00000  0.00000  0.00000  0.49524  0.77295  2.32938  1.31302 |  0.79331
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.27476  0.46781  1.31224  8.98364 |  0.82563
----------+-------------------------------------------------------------------------+---------
  flux    |  0.00000  0.00000  0.00000  0.00000  0.49062  0.69825  0.79677  0.82763 |  0.70714

Transmitted light for light incident from the bottom
cos_theta |  0.04436  0.21087  0.42810  0.59461  0.67095  0.78680  0.92334  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04436 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.21087 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.42810 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.59461 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.67095 |  0.00000  0.00000  0.00000  0.00000  1.82457  0.79244  0.49524  0.27476 |  0.49062
  0.78680 |  0.00000  0.00000  0.00000  0.00000  0.82078  1.90450  0.77295  0.46781 |  0.69825
  0.92334 |  0.00000  0.00000  0.00000  0.00000  0.51591  0.77877  2.32938  1.31224 |  0.79677
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.28526  0.47102  1.31302  8.98364 |  0.82763
----------+-------------------------------------------------------------------------+---------
  flux    |  0.00000  0.00000  0.00000  0.00000  0.50187  0.69665  0.79331  0.82563 |  0.70714

Now, break symmetry and recalculate to see that that matrices for light

[53]:
s = iadpython.Sample()
s.a = 0.90 # albedo
s.b = 1.0 # optical thickness
s.g = 0.0 # scattering anisotropy
s.d = 2.0 # physical thickness of the sample
s.quad_pts=8
s.n = 1.33
s.n_above = 1.532
s.n_below = 1.0
print(s)

R03, R30, T03, T30 = s.rt_matrices()

print("Reflected light for light incident from the top")
s.wrmatrix(R03)

print("Reflected light for light incident from the bottom")
s.wrmatrix(R30)

print("\n**************\nTransmitted light for light incident from the top")
s.wrmatrix(T03)

print("Transmitted light for light incident from the bottom")
s.wrmatrix(T30)
Intrinsic Properties
   albedo            = 0.900
   optical thickness = 1.000
   anisotropy        = 0.000
   thickness         = 2.000 mm
   sample index      = 1.330
   top slide index   = 1.532
   bottom slide index= 1.000
 cos(theta incident) = 1.000
   quadrature points = 8

Derived quantities
   mu_a              = 0.050 1/mm
   mu_s              = 0.450 1/mm
   mu_s*(1-g)        = 0.450 1/mm
      theta incident = 0.0°
 cos(theta critical) = 0.6593
      theta critical = 48.8°

Reflected light for light incident from the top
cos_theta |  0.04578  0.21758  0.44172  0.61352  0.68948  0.79881  0.92766  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04578 | 95.25256  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.21758 | -0.00000 10.68963 -0.00000 -0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.44172 |  0.00000  0.00000  5.26527  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.61352 |  0.00000  0.00000  0.00000  7.10701  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.68948 | -0.00000 -0.00000 -0.00000 -0.00000  2.81749  0.35725  0.33522  0.32080 |  0.45065
  0.79881 | -0.00000 -0.00000 -0.00000 -0.00000  0.35725  0.76189  0.37167  0.35576 |  0.29040
  0.92766 | -0.00000 -0.00000 -0.00000 -0.00000  0.33522  0.37167  0.60179  0.33436 |  0.25258
  1.00000 | -0.00000 -0.00000 -0.00000 -0.00000  0.32080  0.35576  0.33436  1.52141 |  0.24269
----------+-------------------------------------------------------------------------+---------
  flux    |  1.00000  1.00000  1.00000  1.00000  0.45065  0.29040  0.25258  0.24269 |  0.30226

Reflected light for light incident from the bottom
cos_theta |  0.04578  0.21758  0.44172  0.61352  0.68948  0.79881  0.92766  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04578 | 95.25256  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.21758 |  0.00000 10.68963  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.44172 |  0.00000  0.00000  5.26527  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.61352 |  0.00000  0.00000  0.00000  7.10701  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.68948 |  0.00000  0.00000  0.00000  0.00000  2.39508  0.40407  0.37627  0.36010 |  0.42700
  0.79881 |  0.00000  0.00000  0.00000  0.00000  0.40407  0.64436  0.40471  0.38740 |  0.27863
  0.92766 |  0.00000  0.00000  0.00000  0.00000  0.37627  0.40471  0.50556  0.36130 |  0.24496
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.36010  0.38740  0.36130  0.96565 |  0.23538
----------+-------------------------------------------------------------------------+---------
  flux    |  1.00000  1.00000  1.00000  1.00000  0.42700  0.27863  0.24496  0.23538 |  0.29018


**************
Transmitted light for light incident from the top
cos_theta |  0.04578  0.21758  0.44172  0.61352  0.68948  0.79881  0.92766  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04578 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.21758 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.44172 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.61352 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.68948 | -0.00000 -0.00000 -0.00000 -0.00000  1.66974  0.34862  0.33139  0.31913 |  0.32908
  0.79881 | -0.00000 -0.00000 -0.00000 -0.00000  0.33805  1.58114  0.35835  0.34503 |  0.45828
  0.92766 | -0.00000 -0.00000 -0.00000 -0.00000  0.31880  0.35551  1.85951  0.32490 |  0.50850
  1.00000 | -0.00000 -0.00000 -0.00000 -0.00000  0.30702  0.34231  0.32491  8.36577 |  0.52794
----------+-------------------------------------------------------------------------+---------
  flux    | -0.00000 -0.00000 -0.00000 -0.00000  0.32371  0.45867  0.51040  0.52977 |  0.45832

Transmitted light for light incident from the bottom
cos_theta |  0.04578  0.21758  0.44172  0.61352  0.68948  0.79881  0.92766  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.04578 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.21758 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.44172 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.61352 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.68948 |  0.00000  0.00000  0.00000  0.00000  1.66974  0.33805  0.31880  0.30702 |  0.32371
  0.79881 |  0.00000  0.00000  0.00000  0.00000  0.34862  1.58114  0.35551  0.34231 |  0.45867
  0.92766 |  0.00000  0.00000  0.00000  0.00000  0.33139  0.35835  1.85951  0.32491 |  0.51040
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.31913  0.34503  0.32490  8.36577 |  0.52977
----------+-------------------------------------------------------------------------+---------
  flux    |  0.00000  0.00000  0.00000  0.00000  0.32908  0.45828  0.50850  0.52794 |  0.45832

[ ]: