def figures(): '''Draw some thin film plots.''' # simple patch plot thickness_nm_list = xrange(0, 1000, 10) illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_patch_plot(1.500, 1.003, 1.500, thickness_nm_list, illuminant, 'ThinFilm Patch Plot', 'ThinFilm-Patch') # plot the colors of films vs thickness. # we scale the illuminant to get a better range of color. #thickness_nm_list = xrange (0, 1000, 2) # faster thickness_nm_list = xrange(0, 1000, 1) # nicer # gap in glass/plastic illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 4.50) thinfilm_color_vs_thickness_plot( 1.500, 1.003, 1.500, thickness_nm_list, illuminant, 'Thin Film - Gap In Glass/Plastic (n = 1.50)\nIlluminant D65', 'ThinFilm-GlassGap') # soap bubble illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_color_vs_thickness_plot( 1.003, 1.33, 1.003, thickness_nm_list, illuminant, 'Thin Film - Soap Bubble (n = 1.33)\nIlluminant D65', 'ThinFilm-SoapBubble') # oil slick on water illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 15.00) thinfilm_color_vs_thickness_plot( 1.003, 1.44, 1.33, thickness_nm_list, illuminant, 'Thin Film - Oil Slick (n = 1.44) on Water (n = 1.33)\nIlluminant D65', 'ThinFilm-OilSlick') # large index of refraction bubble illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 3.33) thinfilm_color_vs_thickness_plot( 1.003, 1.60, 1.003, thickness_nm_list, illuminant, 'Thin Film - Large Index (n = 1.60) Bubble\nIlluminant D65', 'ThinFilm-LargeBubble') # plot the spectrum of the refection for a couple of thicknesses - using constant illuminant for cleaner plot illuminant = illuminants.get_constant_illuminant() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_spectrum_plot( 1.003, 1.33, 1.003, 400.0, illuminant, 'Thin Film Interference Spectrum - 400 nm thick\nConstant Illuminant', 'ThinFilm-Spectrum-400nm') thinfilm_spectrum_plot( 1.003, 1.33, 1.003, 500.0, illuminant, 'Thin Film Interference Spectrum - 500 nm thick\nConstant Illuminant', 'ThinFilm-Spectrum-500nm')
def test_coverage_1(self, verbose=False): ''' A coverage test of illuminants. ''' D65 = illuminants.get_illuminant_D65() if verbose: print ('Illuminant D65') print (str (D65)) A = illuminants.get_illuminant_A() if verbose: print ('Illuminant A') print (str (A)) const = illuminants.get_constant_illuminant() if verbose: print ('Constant Illuminant') print (str (const))
def test(verbose=0): '''Mainly call some functions.''' D65 = illuminants.get_illuminant_D65() if verbose >= 1: print('Illuminant D65') print(str(D65)) A = illuminants.get_illuminant_A() if verbose >= 1: print('Illuminant A') print(str(A)) const = illuminants.get_constant_illuminant() if verbose >= 1: print('Constant Illuminant') print(str(const)) T_list = [0.0, 1.0, 100.0, 1000.0, 5778.0, 10000.0, 100000.0] for T in T_list: bb = illuminants.get_blackbody_illuminant(T) if verbose >= 1: print('Blackbody Illuminant : %g K' % T) print(str(bb)) print('test_illuminants.test() passed.')
def test (verbose=0): '''Mainly call some functions.''' D65 = illuminants.get_illuminant_D65() if verbose >= 1: print 'Illuminant D65' print str (D65) A = illuminants.get_illuminant_A() if verbose >= 1: print 'Illuminant A' print str (A) const = illuminants.get_constant_illuminant() if verbose >= 1: print 'Constant Illuminant' print str (const) T_list = [0.0, 1.0, 100.0, 1000.0, 5778.0, 10000.0, 100000.0] for T in T_list: bb = illuminants.get_blackbody_illuminant (T) if verbose >= 1: print 'Blackbody Illuminant : %g K' % (T) print str (bb) print 'test_illuminants.test() passed.'
def figures (): '''Draw some thin film plots.''' # Simple patch plot. This is not all that interesting. thickness_nm_list = numpy.linspace(0.0, 750.0, 36) illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant (illuminant, 9.50) thinfilm_patch_plot (1.500, 1.003, 1.500, thickness_nm_list, illuminant, 'ThinFilm Patch Plot', 'ThinFilm-Patch') # Plot the colors of films vs thickness. # Scale the illuminant to get a better range of color. thickness_nm_list = numpy.linspace(0.0, 1000.0, 800) # Gap in glass/plastic. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant (illuminant, 4.50) thinfilm_color_vs_thickness_plot ( 1.500, 1.003, 1.500, thickness_nm_list, illuminant, 'Thin Film - Gap In Glass/Plastic (n = 1.50)\nIlluminant D65', 'ThinFilm-GlassGap') # Soap bubble. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant (illuminant, 9.50) thinfilm_color_vs_thickness_plot ( 1.003, 1.33, 1.003, thickness_nm_list, illuminant, 'Thin Film - Soap Bubble (n = 1.33)\nIlluminant D65', 'ThinFilm-SoapBubble') # Oil slick on water. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant (illuminant, 15.00) thinfilm_color_vs_thickness_plot ( 1.003, 1.44, 1.33, thickness_nm_list, illuminant, 'Thin Film - Oil Slick (n = 1.44) on Water (n = 1.33)\nIlluminant D65', 'ThinFilm-OilSlick') # Large index of refraction bubble. # This has the brightest colors, but is a bit of an artificial example. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant (illuminant, 3.33) thinfilm_color_vs_thickness_plot ( 1.003, 1.60, 1.003, thickness_nm_list, illuminant, 'Thin Film - Large Index (n = 1.60) Bubble\nIlluminant D65', 'ThinFilm-LargeBubble') # A very thick film to test the aliasing limits. # You have to go to very large thicknesses to get much aliasing. thickness_nm_list = numpy.linspace(0.0, 200000.0, 800) illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant (illuminant, 9.50) thinfilm_color_vs_thickness_plot ( 1.003, 1.33, 1.003, thickness_nm_list, illuminant, 'Not-so-thin Film - Soap Bubble (n = 1.33)\nIlluminant D65', 'ThinFilm-Thick') # Plot the spectrum of the refection for a couple of thicknesses. # Use a constant illuminant for a cleaner plot. # FIXME: Should this really be using an illuminant? illuminant = illuminants.get_constant_illuminant() illuminants.scale_illuminant (illuminant, 9.50) thinfilm_spectrum_plot (1.003, 1.33, 1.003, 400.0, illuminant, 'Thin Film Interference Spectrum - 400 nm thick\nConstant Illuminant', 'ThinFilm-Spectrum-400nm') thinfilm_spectrum_plot (1.003, 1.33, 1.003, 500.0, illuminant, 'Thin Film Interference Spectrum - 500 nm thick\nConstant Illuminant', 'ThinFilm-Spectrum-500nm')
def figures(): '''Draw some thin film plots.''' # Simple patch plot. This is not all that interesting. thickness_nm_list = numpy.linspace(0.0, 750.0, 36) illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_patch_plot(1.500, 1.003, 1.500, thickness_nm_list, illuminant, 'ThinFilm Patch Plot', 'ThinFilm-Patch') # Plot the colors of films vs thickness. # Scale the illuminant to get a better range of color. thickness_nm_list = numpy.linspace(0.0, 1000.0, 800) # Gap in glass/plastic. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 4.50) thinfilm_color_vs_thickness_plot( 1.500, 1.003, 1.500, thickness_nm_list, illuminant, 'Thin Film - Gap In Glass/Plastic (n = 1.50)\nIlluminant D65', 'ThinFilm-GlassGap') # Soap bubble. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_color_vs_thickness_plot( 1.003, 1.33, 1.003, thickness_nm_list, illuminant, 'Thin Film - Soap Bubble (n = 1.33)\nIlluminant D65', 'ThinFilm-SoapBubble') # Oil slick on water. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 15.00) thinfilm_color_vs_thickness_plot( 1.003, 1.44, 1.33, thickness_nm_list, illuminant, 'Thin Film - Oil Slick (n = 1.44) on Water (n = 1.33)\nIlluminant D65', 'ThinFilm-OilSlick') # Large index of refraction bubble. # This has the brightest colors, but is a bit of an artificial example. illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 3.33) thinfilm_color_vs_thickness_plot( 1.003, 1.60, 1.003, thickness_nm_list, illuminant, 'Thin Film - Large Index (n = 1.60) Bubble\nIlluminant D65', 'ThinFilm-LargeBubble') # A very thick film to test the aliasing limits. # You have to go to very large thicknesses to get much aliasing. thickness_nm_list = numpy.linspace(0.0, 200000.0, 800) illuminant = illuminants.get_illuminant_D65() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_color_vs_thickness_plot( 1.003, 1.33, 1.003, thickness_nm_list, illuminant, 'Not-so-thin Film - Soap Bubble (n = 1.33)\nIlluminant D65', 'ThinFilm-Thick') # Plot the spectrum of the refection for a couple of thicknesses. # Use a constant illuminant for a cleaner plot. # FIXME: Should this really be using an illuminant? illuminant = illuminants.get_constant_illuminant() illuminants.scale_illuminant(illuminant, 9.50) thinfilm_spectrum_plot( 1.003, 1.33, 1.003, 400.0, illuminant, 'Thin Film Interference Spectrum - 400 nm thick\nConstant Illuminant', 'ThinFilm-Spectrum-400nm') thinfilm_spectrum_plot( 1.003, 1.33, 1.003, 500.0, illuminant, 'Thin Film Interference Spectrum - 500 nm thick\nConstant Illuminant', 'ThinFilm-Spectrum-500nm')