Skip to content

Commit

Permalink
Color with performance = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jeammimi committed Mar 15, 2017
1 parent d9cdfb3 commit 3377236
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ipyvolume/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ def array_to_binary_or_json(ar, obj=None):
elif performance == 1:
known_type = ["|u1", "|i1", "<u2", "<i2", "<u4", "<i4", "<f4", "<f8"]
if ar.dtype in known_type and len(ar.shape) <= 3:
#print(ar.flags)
#ar = np.array(ar, dtype=np.float32) # this mode only support 'regular' arrays
iobyte = StringIO()
np.save(iobyte, np.copy(ar,order='C')) #The copy is to ensure the C order
if ar.flags["C_CONTIGUOUS"]:
np.save(iobyte, ar)
else:
np.save(iobyte, np.ascontiguousarray(ar)) #The copy is to ensure the C order
return iobyte.getvalue()
else:
return array_to_json(ar)
Expand Down
2 changes: 1 addition & 1 deletion ipyvolume/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Scatter(widgets.DOMWidget):
default_value=0.1).tag(sync=True)
size_selected = traitlets.Float(0.02).tag(sync=True)
color = traitlets.Union([Unicode().tag(sync=True),
Array(default_value=None,allow_none=True).tag(sync=True, **array_binary_serialization)],
Array(default_value=None,allow_none=True).tag(sync=True, **create_array_binary_serialization('color'))],
default_value="red").tag(sync=True)
color_selected = traitlets.Unicode(default_value="white").tag(sync=True)
geo = traitlets.Unicode('diamond').tag(sync=True)
Expand Down

0 comments on commit 3377236

Please sign in to comment.