Skip to content

Commit

Permalink
Replace uint8 with built-in int for colorscale
Browse files Browse the repository at this point in the history
  • Loading branch information
catanzaromj committed Jun 29, 2024
1 parent 5817fb1 commit de5c3cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kmapper/visuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def _map_val2color(val, vmin, vmax, colorscale=None):
# get the triplet of three values in [0,1] that represent the rgb color
# corresponding to val
val_color01 = colors_01[idx] + vv * (colors_01[idx + 1] - colors_01[idx])
val_color_0255 = list(map(np.uint8, 255 * val_color01))
val_color_0255 = list(map(int, 255 * val_color01))

return "rgb" + str(tuple(val_color_0255))

Expand Down
12 changes: 6 additions & 6 deletions test/test_visuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def test_visualize_one_color_function(self):
)

def test_visualize_multiple_color_functions(self):
""" convenience test for generating a vis with multiple color_values"""
"""convenience test for generating a vis with multiple color_values"""
mapper = KeplerMapper()
data, labels = make_circles(1000, random_state=0)
lens = mapper.fit_transform(data, projection=[0])
Expand All @@ -343,7 +343,7 @@ def test_visualize_multiple_color_functions(self):
)

def test_visualize_multiple_node_color_functions(self):
""" convenience test for generating a vis with multiple node_color_values but 1d color_values"""
"""convenience test for generating a vis with multiple node_color_values but 1d color_values"""
mapper = KeplerMapper()
data, labels = make_circles(1000, random_state=0)
lens = mapper.fit_transform(data, projection=[0])
Expand All @@ -357,7 +357,7 @@ def test_visualize_multiple_node_color_functions(self):
)

def test_visualize_multiple_color_function_and_node_color_functions(self):
""" convenience test for generating a vis with multiple color_values _and_ multiple node_color_values"""
"""convenience test for generating a vis with multiple color_values _and_ multiple node_color_values"""
mapper = KeplerMapper()
data, labels = make_circles(1000, random_state=0)
lens = mapper.fit_transform(data, projection=[0])
Expand All @@ -375,7 +375,7 @@ def test_visualize_multiple_color_function_and_node_color_functions(self):
)

def test_visualize_search_bar(self):
""" convenience test for generating a vis with a search bar (and also with multiple color_values _and_ multiple node_color_values)"""
"""convenience test for generating a vis with a search bar (and also with multiple color_values _and_ multiple node_color_values)"""
mapper = KeplerMapper()
data, labels = make_circles(1000, random_state=0)
lens = mapper.fit_transform(data, projection=[0])
Expand All @@ -394,7 +394,7 @@ def test_visualize_search_bar(self):
)

def test_visualize_min_intersection_selector(self):
""" convenience test for generating a vis with a min_intersection_selector
"""convenience test for generating a vis with a min_intersection_selector
(and also with multiple color_values _and_ multiple node_color_values)"""
mapper = KeplerMapper()
data, labels = make_circles(1000, random_state=0)
Expand Down Expand Up @@ -638,7 +638,7 @@ def test_file_not_written(self, tmpdir):

class TestColorhandling:
def test_map_val2color_on_point(self, default_colorscale):
""" This function takes a val, a min and max, and a color scale, and finds the color the val should be """
"""This function takes a val, a min and max, and a color scale, and finds the color the val should be"""

for v, color in default_colorscale:
c = _map_val2color(v, 0.0, 1.0, default_colorscale)
Expand Down

0 comments on commit de5c3cf

Please sign in to comment.