<s> import numpy as np <EOL> __all__ = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> cie1931 = { <EOL> "<STR_LIT:A>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT:C>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> } <EOL> cie1964 = { <EOL> "<STR_LIT:A>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT:C>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] , <EOL> } <EOL> def standard_illuminant_XYZ100 ( name , observer = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> if observer == "<STR_LIT>" : <EOL> return np . asarray ( cie1931 [ name ] , dtype = float ) <EOL> elif observer == "<STR_LIT>" : <EOL> return np . asarray ( cie1964 [ name ] , dtype = float ) <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" <EOL> "<STR_LIT>" % ( observer , ) ) <EOL> def test_standard_illuminant_XYZ100 ( ) : <EOL> assert np . allclose ( <EOL> standard_illuminant_XYZ100 ( "<STR_LIT>" ) , <EOL> [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] ) <EOL> assert np . allclose ( <EOL> standard_illuminant_XYZ100 ( "<STR_LIT>" , observer = "<STR_LIT>" ) , <EOL> [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] ) <EOL> from nose . tools import assert_raises <EOL> assert_raises ( ValueError , standard_illuminant_XYZ100 , "<STR_LIT>" , <EOL> observer = "<STR_LIT>" ) <EOL> def as_XYZ100_w ( whitepoint ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( whitepoint , str ) : <EOL> return standard_illuminant_XYZ100 ( whitepoint ) <EOL> else : <EOL> whitepoint = np . asarray ( whitepoint , dtype = float ) <EOL> if whitepoint . shape [ - <NUM_LIT:1> ] != <NUM_LIT:3> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> return whitepoint <EOL> def test_as_XYZ100_w ( ) : <EOL> assert np . allclose ( as_XYZ100_w ( "<STR_LIT>" ) , [ <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> ] ) <EOL> assert np . allclose ( as_XYZ100_w ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> assert as_XYZ100_w ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) . dtype == float <EOL> from nose . tools import assert_raises <EOL> assert_raises ( KeyError , as_XYZ100_w , "<STR_LIT>" ) <EOL> assert_raises ( ValueError , as_XYZ100_w , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) </s>
