Comments (17)
Question: Why do we really need to sync coordinates
originally?
from nglview.
a proposed PR here: https://github.com/arose/nglview/pull/59/files
normal implementation by syncing coordinates
view = nv.show_pytraj()
view
turn cache on
view.caching()
--> fast
want to sync coordinate
again?
view.uncaching()
from nglview.
potential: let user to choose specific frames to cache. This is good for pytraj and MDAnalysis out-of-core trajectory/universe. User only need to load coordinates from disk to JavaScript once when caching
is called.
from nglview.
tried with 13008 atoms (DNA + waters). caching is dramatically faster.
from nglview.
New issue: sending 30 MB data from Python to JS via Widget.send
is really slow, costs me 16 s. ack.
from nglview.
so two seperate issue:
- how to send a GB of data from Python to JS within seconds?
- how to use binary data?
for trajectory viewer, non-lagging viewing is important (at least for me).
from nglview.
timing: sending list
and bytes
via Widget.send
method
print(traj.xyz.shape, traj.xyz.dtype)
xyz = traj.xyz.flatten()
xyz_list = xyz.tolist()
xyz_bytes = xyz.tobytes()
(100, 5293, 3) float64
%%time
view.send(xyz_list)
CPU times: user 10.2 s, sys: 77 ms, total: 10.3 s
Wall time: 10.3 s
%%time
view.send(xyz_bytes)
CPU times: user 1.73 s, sys: 247 ms, total: 1.98 s
Wall time: 1.95 s
sending bytes is 5 times faster than sending list but still slow (1.95 s for 100 frames, 5293 atoms).
from nglview.
from my benchmark, sending a dict of base64 data is 100 times faster than sending a Python list.
I am going this way.
from nglview.
Out of curiosity when you send GB of data from python to js is that data copied?
from nglview.
Out of curiosity when you send GB of data from python to js is that data copied?
Yes. But this should not be a problem for out-of-core back-end like MDAnalysis. Coordinates are only copied once when 'caching' is called and those are kept in memory (JS) for fast iteration.
But ideally, I just want Python and Javascript can share memory view, just like Python and C/C++.
from nglview.
You could ask on the jupyter mailing list if they know a method to do that.
from nglview.
- bokeh still have an open issue about DataView ans Python/JS stuff. :D
bokeh/bokeh#2204
So I guess there is not.
from nglview.
But ideally, I just want Python and Javascript can share memory view, just like Python and C/C++.
That is not going to happen, ever! At least not between a browser and Python. The browser is a sandbox for security reasons, so there will be no memory sharing.
from nglview.
That is not going to happen, ever! At least not between a browser and Python. The browser is a sandbox for security reasons, so there will be no memory sharing.
yeah, right. So my work here is still useful. =)) #67
from nglview.
@kain88-de @dotsdl I just update MDA support for new data transfer protocol in my new PR.
Let me know if the view play is reasonably fast or not.
PR: #67
should check branch: https://github.com/hainm/nglview/tree/on_msg_f32
That branch includes notebook test for MDA too, just run it.
The speed can be still improved (see @arose comment in that PR).
from nglview.
note: if using view.caching()
the viewer play is much smoother.
from nglview.
done. Problem left is sending binary data.
from nglview.
Related Issues (20)
- nv.write_html doesn't show any molecule. HOT 8
- Visualization of an MDAnalysis Universe resets its translation HOT 1
- Nglview not showing HOT 9
- Load MD trajectory with controls HOT 2
- VSCode : receiving java script error while running nv.demo() HOT 13
- follow up problem on rendering data and saving it to file ( based on FAQ: How to make nglview view object write PNG file?) HOT 9
- Compatibility with jupyterlab 4 HOT 6
- How to load both surface point and protein at the same time? HOT 2
- custom rgb color HOT 4
- vscode generates empty image HOT 5
- Support `inferBonds` parameter in PDB files HOT 4
- slow shape.add_cylinder HOT 1
- Component handling not working properly under Google Colab HOT 4
- upgrade nglview so will work with ipywidgets 8 or greater? HOT 9
- memory address error when rendering image from nglview HOT 3
- No widget renders on Jupyterlab 4.1 HOT 8
- Issue during rendering when using MovieMaker on NGLView HOT 6
- Visualizing arrows defined by atoms positions along a trajectory HOT 1
- nglview 3.1 not working with nbclassic 1.0 HOT 1
- write_html seems to be broken HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nglview.