Commit cbaecdea authored by Priyanjana Sinha's avatar Priyanjana Sinha
Browse files

nt specifics

parent 80cb06e2
......@@ -353,8 +353,11 @@ class AbstractNdarray(np.ndarray):
sub_dict = list_dict[key]
list_dict[key] = []
for index in sorted(sub_dict.keys()):
bulk_type = sub_dict[index].get('bulk_type')
bulk_type = getattr(tfields, bulk_type.tolist())
bulk_type = sub_dict[index].get('bulk_type').tolist()
if isinstance(bulk_type, bytes):
# asthonishingly, this is not necessary under linux. Found under nt. ???
bulk_type = bulk_type.decode('UTF-8')
bulk_type = getattr(tfields, bulk_type)
list_dict[key].append(bulk_type._from_dict(**sub_dict[index]))
'''
......
......@@ -443,7 +443,7 @@ def to_colors(scalars, cmap=None, vmin=None, vmax=None):
vmax = max(scalars)
color_map = plt.get_cmap(cmap)
norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax)
return color_map(map(norm, scalars))
return color_map([norm(s) for s in scalars])
def to_scalars(colors, cmap, vmin, vmax):
......@@ -495,9 +495,9 @@ def color_cycle(cmap=None, n=None):
"""
if cmap:
color_rgb = to_colors(np.linspace(0, 1, n), cmap=cmap, vmin=0, vmax=1)
colors = map(lambda rgb: '#%02x%02x%02x' % (rgb[0] * 255,
rgb[1] * 255,
rgb[2] * 255),
colors = map(lambda rgb: '#%02x%02x%02x' % (int(rgb[0] * 255),
int(rgb[1] * 255),
int(rgb[2] * 255)),
tuple(color_rgb[:, 0:-1]))
else:
colors = list([color['color'] for color in mpl.rcParams['axes.prop_cycle']])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment