def test_grazing_incidence(self): """Grazing rays are not refracted""" dir = N.c_[[0, 0, 1]] norm = N.c_[[0, 1, 0]] R = optics.fresnel(dir, norm, N.r_[1.], N.r_[1.5]) self.failUnlessAlmostEqual(R, 1.) # ref [1], page 45
def test_no_reflectance(self): """With index of refraction = 1, no reflection""" dir = N.c_[[0, 1, 1]]/math.sqrt(2) norm = N.c_[[0, 1, 0]] R = optics.fresnel(dir, norm, N.r_[1.], N.r_[1.]) self.failUnlessAlmostEqual(R, 0)
def test_normal_incidence(self): """Rays at normal incidence achieve predicted reflectance.""" dir = N.c_[[0, 0, 1]] norm = dir R = optics.fresnel(dir, norm, N.r_[1.], N.r_[1.5]) self.failUnlessAlmostEqual(R, 0.04) # ref [1], page 44