def element_colors(element):
    """
    Given an element, try to extract RGBA color from
    properties and return them as an (n,3|4) array.

    Parameters
    -------------
    element: dict, containing color keys

    Returns
    ------------
    colors: (n,(3|4)
    signal: float, estimate of range
    """
    keys = ['red', 'green', 'blue', 'alpha']
    candidate_colors = [element['data'][i]
                        for i in keys if i in element['properties']]

    if len(candidate_colors) >= 3:
        colors = np.column_stack(candidate_colors)
        signal = colors.ptp(axis=0).sum()
        return colors, signal

    return None, 0.0
def element_colors ( element ) : keys = [ 'red' , 'green' , 'blue' , 'alpha' ] candidate_colors = [ element [ 'data' ] [ i ] for i in keys if i in element [ 'properties' ] ] if len ( candidate_colors ) >= 3 : colors = np . column_stack ( candidate_colors ) signal = colors . ptp ( axis = 0 ) . sum ( ) return colors , signal return None , 0.0
Given an element, try to extract RGBA color from
    properties and return them as an (n,3|4) array.

    Parameters
    -------------
    element: dict, containing color keys

    Returns
    ------------
    colors: (n,(3|4)
    signal: float, estimate of range