Package reflectometry :: Package model1d :: Package tests :: Module check2

Module check2

source code

Functions
 
fresnel(Q, rho)
Fresnel reflectivity calculator.
source code
Variables
  nd = 10
  depth = array([100, 15, 3, 5, 100], 'd')
  rho = array([0, 1.87, 1.7, 3.8, 2.07], 'd')
  mu = array([0, 0.01, 0.01, 0.01, 0.01], 'd')
  phi = array([0.001, 2, 0.001, 0.002, 0.003], 'd')
  theta = array([200, 210, 220, 230, 240], 'd')
  length = 4
  Qc = sqrt(16* pi* rho [-1]* 1e-6)
  step = 2* pi/ min(depth)
  start = ceil(3* Qc/ step)
  lo = start* step
  hi = lo+ length* step
  Qs = linspace(lo, hi, 200)
  step_n = 2* pi/ min(nd* depth)
  lo_n = start* step_n
  hi_n = lo_n+ length* step_n
  Qs_n = linspace(lo_n, hi_n, 200)
  wavelength = 4.75
  R = [abs(refl(Qs, depth, rho, mu, wavelength))** 2]
  R_n = [abs(refl(Qs_n, nd* depth, rho, mu, wavelength))** 2]
  Fq = logspace(-5, 6, 500)
  Fr = fresnel(Fq, rho [-1])
Function Details

fresnel(Q, rho)

source code 
Fresnel reflectivity calculator. This calculator supports very high Q values with encountering cancellation errors by using a taylor series expansion for sqrt(1-x). A similar technique may apply to the calculation of reflectivity for extremely large Q if such a thing is ever needed.