1 from numpy import *
2 from reflectometry.model1d.model.calcRefl import magnetic_reflectivity as cr4x
3 from reflectometry.model1d.model.polarizedmatrix import magnetic_reflectivity as pyr4x
4 Qs = linspace(0.001,0.3,200)
5
6 depth = array([ 100, 65, 35, 17, 100],'d')
7 rho = array([ 0, 1.87, 1.7, 3.8, 2.07],'d')
8 mu = array([ 0, 0.01, 0.01, 0.01, 0.01],'d')
9 phi = array([ 0.001, 0.1, 0.001, 0.002, 0.003],'d')
10 theta = array([200, 210, 220, 230, 240],'d')
11 wavelength = 4.75
12 pyR = pyr4x(depth,1e-6*rho,1e-6*mu,wavelength,1e-6*phi,theta,Qs,Aguide=-90.)
13 cR = cr4x(depth,1e-6*rho,1e-6*mu,wavelength,1e-6*phi,theta,-90.,Qs)
14
15 for i in range(4):
16 assert linalg.norm((pyR[i]-cR[i])/cR[i]) < 1e-10,"norm %d fails"%i
17