Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error plotting table layers with 200,000 rows #309

Open
astrofrog opened this issue Jul 27, 2021 · 2 comments
Open

Error plotting table layers with 200,000 rows #309

astrofrog opened this issue Jul 27, 2021 · 2 comments

Comments

@astrofrog
Copy link
Member

The following example now crashes:

import numpy as np
from astropy.table import Table
from pywwt.qt import WWTQtClient

N = 200_000

table = Table()
table['x'] = np.random.uniform(-10, 10, N)
table['y'] = np.random.uniform(-10, 10, N)
table['z'] = np.random.uniform(-10, 10, N)

wwt = WWTQtClient(block_until_ready=True)
wwt.wait(5)
wwt.set_view('milky way')
wwt.layers.add_table_layer(table=table, frame='Sky',
                           x_att='x', y_att='y', z_att='z', xyz_unit='pc')
wwt.wait()

The error is:

Traceback (most recent call last):
  File "/Users/tom/Downloads/glue_dataverse/data/test.py", line 15, in <module>
    wwt.layers.add_table_layer(table=table, frame='Sky',
  File "/Users/tom/Code/pywwt/pywwt/layers.py", line 241, in add_table_layer
    layer = TableLayer(self._parent, table=table,
  File "/Users/tom/Code/pywwt/pywwt/layers.py", line 424, in __init__
    self._on_trait_change({'name': 'color', 'new': self.color})
  File "/Users/tom/Code/pywwt/pywwt/layers.py", line 847, in _on_trait_change
    self.parent._send_msg(event='table_layer_set',
  File "/Users/tom/Code/pywwt/pywwt/core.py", line 249, in _send_msg
    raise ViewerNotAvailableError()
pywwt.core.ViewerNotAvailableError: cannot complete the operation because the WWT viewer isn't responding

As discussed with @pkgw this is because the table serialization/deserialization takes more than the threshold for testing if the viewer is 'live'. Increasing that threshold does indeed make the error go away.

pkgw added a commit to pkgw/pywwt that referenced this issue Jul 27, 2021
Addresss WorldWideTelescope#309 the straightforward way. Slow operations can hold up the
Qt mainloop enough that the backend convinces itself that the app has
become nonresponsive.

Note that for the ipywidgets and JupyterLab app backends, the liveness
testing is done in the JS frontend code, which really ought to not
suffer from this possibility. So those deadlines are staying at their
current values, for now.
@pkgw pkgw mentioned this issue Jul 27, 2021
1 task
@pkgw
Copy link
Contributor

pkgw commented Jul 27, 2021

OK, I've filed #310 for this. I can't actually reproduce the problem on my computer, but the diagnosis seems pretty clear here.

pkgw added a commit to pkgw/pywwt that referenced this issue Jul 27, 2021
Addresss WorldWideTelescope#309 the straightforward way. Slow operations can hold up the
Qt mainloop enough that the backend convinces itself that the app has
become nonresponsive.

Note that for the ipywidgets and JupyterLab app backends, the liveness
testing is done in the JS frontend code, which really ought to not
suffer from this possibility. So those deadlines are staying at their
current values, for now.
pkgw added a commit that referenced this issue Jul 27, 2021
@pkgw
Copy link
Contributor

pkgw commented Jul 27, 2021

#310 is merged. Close if you feel satisfied? If a similar problem crops up again, we should think about different strategies (e.g., turning this into a warning rather than an error) but I'm optimistic that this system should be pretty robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants