def test (): '''Mainly call some functions.''' for i in range(0, 100): wl_nm = 1000.0 * random.random() rayleigh.rayleigh_scattering (wl_nm) rayleigh.rayleigh_scattering_spectrum() illum = illuminants.get_illuminant_D65() rayleigh.rayleigh_illuminated_spectrum (illum) rayleigh.rayleigh_illuminated_color (illum) print('test_rayleigh.test() passed.') # didnt exception
def test (): '''Mainly call some functions.''' for i in xrange (0, 100): wl_nm = 1000.0 * random.random() rayleigh.rayleigh_scattering (wl_nm) rayleigh.rayleigh_scattering_spectrum() illum = illuminants.get_illuminant_D65() rayleigh.rayleigh_illuminated_spectrum (illum) rayleigh.rayleigh_illuminated_color (illum) print 'test_rayleigh.test() passed.' # didnt exception
def test_scattering(self, verbose=False): ''' Test of scattering calculations. ''' # Coverage test of rayleigh_scattering_spectrum(). rayleigh.rayleigh_scattering_spectrum() illum = illuminants.get_illuminant_D65() spect = rayleigh.rayleigh_illuminated_spectrum(illum) # Both color calculations should give the same result. xyz1 = ciexyz.xyz_from_spectrum(spect) xyz2 = rayleigh.rayleigh_illuminated_color(illum) atol = 1.0e-16 ok = numpy.allclose(xyz1, xyz2, atol=atol) self.assertTrue(ok) msg = 'D65 Rayleigh scattered xyz: %s, %s' % (str(xyz1), str(xyz2)) if verbose: print(msg)
def test_scattering(self, verbose=False): ''' Test of scattering calculations. ''' # Coverage test of rayleigh_scattering_spectrum(). rayleigh.rayleigh_scattering_spectrum() illum = illuminants.get_illuminant_D65() spect = rayleigh.rayleigh_illuminated_spectrum (illum) # Both color calculations should give the same result. xyz1 = ciexyz.xyz_from_spectrum (spect) xyz2 = rayleigh.rayleigh_illuminated_color (illum) atol = 1.0e-16 ok = numpy.allclose(xyz1, xyz2, atol=atol) self.assertTrue(ok) msg = 'D65 Rayleigh scattered xyz: %s, %s' % (str(xyz1), str(xyz2)) if verbose: print (msg)