Beispiel #1
0
def test_clipping(verbose=1):
    '''Test the various color clipping methods.'''
    xyz_colors = ciexyz.get_normalized_spectral_line_colors()
    #print 'xyz_colors', xyz_colors
    (num_wl, num_cols) = xyz_colors.shape
    # get rgb values for standard clipping
    colormodels.init_clipping(colormodels.CLIP_ADD_WHITE)
    rgb_add_white = []
    for i in xrange(0, num_wl):
        color = colormodels.irgb_string_from_rgb(
            colormodels.rgb_from_xyz(xyz_colors[i]))
        rgb_add_white.append(color)
    # get rgb values for clamp clipping
    colormodels.init_clipping(colormodels.CLIP_CLAMP_TO_ZERO)
    rgb_clamp = []
    for i in xrange(0, num_wl):
        color = colormodels.irgb_string_from_rgb(
            colormodels.rgb_from_xyz(xyz_colors[i]))
        rgb_clamp.append(color)
    # compare
    if verbose >= 1:
        print('colors from add white, colors from clamp')
        for i in xrange(0, num_wl):
            print(rgb_add_white[i], rgb_clamp[i])
    print('Passed test_clipping()')
Beispiel #2
0
def test_clipping (verbose=1):
    '''Test the various color clipping methods.'''
    xyz_colors = ciexyz.get_normalized_spectral_line_colors ()
    #print 'xyz_colors', xyz_colors
    (num_wl, num_cols) = xyz_colors.shape
    # get rgb values for standard clipping
    colormodels.init_clipping (colormodels.CLIP_ADD_WHITE)
    rgb_add_white = []
    for i in xrange (0, num_wl):
        color = colormodels.irgb_string_from_rgb (
            colormodels.rgb_from_xyz (xyz_colors [i]))
        rgb_add_white.append (color)
    # get rgb values for clamp clipping
    colormodels.init_clipping (colormodels.CLIP_CLAMP_TO_ZERO)
    rgb_clamp = []
    for i in xrange (0, num_wl):
        color = colormodels.irgb_string_from_rgb (
            colormodels.rgb_from_xyz (xyz_colors [i]))
        rgb_clamp.append (color)
    # compare
    if verbose >= 1:
        print 'colors from add white, colors from clamp'
        for i in xrange (0, num_wl):
            print rgb_add_white [i], rgb_clamp [i]
    print 'Passed test_clipping()'
    def test_clipping(self, verbose=False):
        ''' Test the various color clipping methods. '''
        # This is just a coverage test.
        xyz_colors = ciexyz.get_normalized_spectral_line_colors ()
        num_wl = xyz_colors.shape[0]
        for i in range (num_wl):
            # Get rgb values for standard add white clipping.
            colormodels.init_clipping (colormodels.CLIP_ADD_WHITE)
            rgb_white_color = colormodels.irgb_string_from_rgb (
                colormodels.rgb_from_xyz (xyz_colors [i]))

            # Get rgb values for clamp-to-zero clipping.
            colormodels.init_clipping (colormodels.CLIP_CLAMP_TO_ZERO)
            rgb_clamp_color = colormodels.irgb_string_from_rgb (
                colormodels.rgb_from_xyz (xyz_colors [i]))

            msg = 'Wavelength: %s    White: %s    Clamp: %s' % (
                str(i),    # FIXME: Put in Angstroms.
                rgb_white_color,
                rgb_clamp_color)
            if verbose:
                print (msg)
Beispiel #4
0
    def test_clipping(self, verbose=False):
        ''' Test the various color clipping methods. '''
        # This is just a coverage test.
        xyz_colors = ciexyz.get_normalized_spectral_line_colors()
        num_wl = xyz_colors.shape[0]
        for i in range(num_wl):
            # Get rgb values for standard add white clipping.
            colormodels.init_clipping(colormodels.CLIP_ADD_WHITE)
            rgb_white_color = colormodels.irgb_string_from_rgb(
                colormodels.rgb_from_xyz(xyz_colors[i]))

            # Get rgb values for clamp-to-zero clipping.
            colormodels.init_clipping(colormodels.CLIP_CLAMP_TO_ZERO)
            rgb_clamp_color = colormodels.irgb_string_from_rgb(
                colormodels.rgb_from_xyz(xyz_colors[i]))

            msg = 'Wavelength: %s    White: %s    Clamp: %s' % (
                str(i),  # FIXME: Put in Angstroms.
                rgb_white_color,
                rgb_clamp_color)
            if verbose:
                print(msg)
Beispiel #5
0
def figures_clip_clamp_to_zero ():
    '''Adjust the color clipping method, and create the sample figures.'''
    colormodels.init()
    colormodels.init_clipping (colormodels.CLIP_CLAMP_TO_ZERO)
    figures()
Beispiel #6
0
def figures_clip_clamp_to_zero ():
    '''Adjust the color clipping method, and create the sample figures.'''
    colormodels.init()
    colormodels.init_clipping (colormodels.CLIP_CLAMP_TO_ZERO)
    figures()