Color array when rgb can be transferred with binary transfer#16
Color array when rgb can be transferred with binary transfer#16jeammimi wants to merge 7 commits intowidgetti:masterfrom
Conversation
…ray) by first checking for array and then float
|
I'd like to do the deserialize of the color seperately, I think I'll take some of this code and refactor it, instead of merging it... I'll let you know. |
|
Ok. I did it that way because now you can be in performance 1 all the time, I modified the fact that you were forcing the conversion to float32. I was thinking trying to make the embeding work when the performance is set to 1, and also look |
|
Ok, sounds good. I'm working on the performance of create_mesh, since that is a bit slow, and difficult to maintain. For the embedding with performance = 1, I'm not sure you should attack that now. For the more general case, with performance = 2, there is quite some progress here: jupyter-widgets/ipywidgets#1194 |
|
I am sory, I am not sure what you mean by
|
|
Have you made a comparison of performance 1 and 2 for the speed? |
|
If you do from the menu in the notebook, Widget->Embed widget. This is the javascript side making a json serialization. If you do the ipyvolume.pylab.save, it is the python side doing the serialization. |
|
I did a mayor refactor, but I think your changes are included, please check if everything is working as expected, so I can close this. |
|
Make sure you run npm update btw, threejs required a new version. |
|
Not everything was included, but I can create another pull request. |
|
Hmm, surprised by that, this line only allows for ints and floats, the rest should go as json (for performance == 1). Let me think about the order of the traitlets, I noticed it in the diff, but didn't think it was intentional. |
|
For the traitlets this might convince you: 1 loop, best of 3: 87.8 ms per loop 1 loop, best of 3: 6.31 s per loop The second one is very slow, and if you change the position of array, before unicode, you wont see this |
|
For the first point , the line you are mentionning it allows all u element and the array I mentionned is |
|
u is unsigned integer U is unicode, quite confusing, isn't it? >>> a = np.array(['#f00', '#ff0a00', '#ff1500', '#ff1f00', '#ff2900', '#ff3400'])
>>> a.dtype, a.dtype.kind
(dtype('<U7'), 'U')Thanks for the report on the Unicode(), it must be in the error handling code. |
|
I think the same problem is true for size size_selected and color_selected. |
8531be1 to
f376042
Compare
3c896f6 to
a923744
Compare
e861e87 to
6dead3f
Compare
I added the possibility to transfer color with the binary transfer when it is an rgb an array of rgb
or an array of array.
I think that the next one I would like to implement is to transfer with the binary transfer the hexadecimal representation of the color. (I like it better because it is a lot smaller when saving it for the embedded version)