vaex icon indicating copy to clipboard operation
vaex copied to clipboard

Example from the tutorial throws an error when it tried to run df.viz.heatmap

Open thomas-k-cameron opened this issue 1 year ago • 0 comments

Description

I tried to play with the code found on tutorial but df.viz.heatmap(df.x, df.y, what=np.log(vaex.stat.count()+1), selection=[None, True], limits='99.7%') yields an error.

I downloaded .ipynb from here

df.select(df.x > 0)
@vaex.jupyter.interactive_selection(df)
def plot(*args, **kwargs):
    print("Mean x for the selection is:", df.mean(df.x, selection=True))
    df.viz.heatmap(df.x, df.y, what=np.log(vaex.stat.count()+1), selection=[None, True], limits='99.7%')
    plt.show()

Software information

  • Vaex version (import vaex; vaex.__version__):
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vaex; vaex.__version__
{'vaex': '4.11.1', 'vaex-core': '4.11.1', 'vaex-viz': '0.5.2', 'vaex-hdf5': '0.12.3', 'vaex-server': '0.8.1', 'vaex-astro': '0.9.1', 'vaex-jupyter': '0.8.0', 'vaex-ml': '0.18.0'}
  • Vaex was installed via: pip / conda-forge / from source pip
  • OS: Docker container running on Windows Host machine. The container is rust:latest cat /etc/os-release yields
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Additional information


```python
Mean x for the selection is: 5.138019792304514
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
File /usr/local/lib/python3.9/dist-packages/vaex/jupyter/utils.py:254, in interactive_selection.<locals>.wrapped.<locals>._selection_changed(df, selection_name)
    252 with output:
    253     clear_output(wait=True)
--> 254     f_interact(df, selection_name)

Input In [190], in plot(*args, **kwargs)
      2 @vaex.jupyter.interactive_selection(df)
      3 def plot(*args, **kwargs):
      4     print("Mean x for the selection is:", df.mean(df.x, selection=True))
----> 5     df.viz.heatmap(df.x, df.y, what=np.log(vaex.stat.count()+1), selection=[None, True], limits='99.7%')
      6     plt.show()

File /usr/local/lib/python3.9/dist-packages/vaex/viz/mpl.py:32, in viz_method.<locals>.wrapper(self, *args, **kwargs)
     30 @functools.wraps(f)
     31 def wrapper(self, *args, **kwargs):
---> 32     return f(self.df, *args, **kwargs)

File /usr/local/lib/python3.9/dist-packages/vaex/viz/mpl.py:565, in heatmap(self, x, y, z, what, vwhat, reduce, f, normalize, normalize_axis, vmin, vmax, shape, vshape, limits, grid, colormap, figsize, xlabel, ylabel, aspect, tight_layout, interpolation, show, colorbar, colorbar_label, selection, selection_labels, title, background_color, pre_blend, background_alpha, visual, smooth_pre, smooth_post, wrap, wrap_columns, return_extra, hardcopy)
    563 for i, (binby, limits) in enumerate(zip(x, xlimits)):
    564     for j, what in enumerate(whats):
--> 565         grid = grid_of_grids[i][j].get()
    566         total_grid[i, j, :, :] = grid[:, None, ...]
    567 labels["what"] = what_labels

File /usr/local/lib/python3.9/dist-packages/aplus/__init__.py:170, in Promise.get(self, timeout)
    168     return self._value
    169 else:
--> 170     raise self._reason

File /usr/local/lib/python3.9/dist-packages/vaex/promise.py:121, in Promise.then.<locals>.callAndReject(r)
    119 try:
    120     if aplus._isFunction(failure):
--> 121         ret.fulfill(failure(r))
    122     else:
    123         ret.reject(r)

File /usr/local/lib/python3.9/dist-packages/vaex/delayed.py:38, in _log_error.<locals>._wrapped(exc)
     35     print(f"*** DEBUG: Error from {name}", exc)
     36 # import vaex
     37 # vaex.utils.print_stack_trace()
---> 38 raise exc

File /usr/local/lib/python3.9/dist-packages/vaex/promise.py:121, in Promise.then.<locals>.callAndReject(r)
    119 try:
    120     if aplus._isFunction(failure):
--> 121         ret.fulfill(failure(r))
    122     else:
    123         ret.reject(r)

File /usr/local/lib/python3.9/dist-packages/vaex/delayed.py:38, in _log_error.<locals>._wrapped(exc)
     35     print(f"*** DEBUG: Error from {name}", exc)
     36 # import vaex
     37 # vaex.utils.print_stack_trace()
---> 38 raise exc

    [... skipping similar frames: Promise.then.<locals>.callAndReject at line 121 (4 times), _log_error.<locals>._wrapped at line 38 (3 times)]

File /usr/local/lib/python3.9/dist-packages/vaex/delayed.py:38, in _log_error.<locals>._wrapped(exc)
     35     print(f"*** DEBUG: Error from {name}", exc)
     36 # import vaex
     37 # vaex.utils.print_stack_trace()
---> 38 raise exc

File /usr/local/lib/python3.9/dist-packages/vaex/promise.py:121, in Promise.then.<locals>.callAndReject(r)
    119 try:
    120     if aplus._isFunction(failure):
--> 121         ret.fulfill(failure(r))
    122     else:
    123         ret.reject(r)

File /usr/local/lib/python3.9/dist-packages/vaex/progress.py:91, in ProgressTree.exit_on.<locals>.error(arg)
     89 def error(arg):
     90     self.exit()
---> 91     raise arg

File /usr/local/lib/python3.9/dist-packages/vaex/promise.py:121, in Promise.then.<locals>.callAndReject(r)
    119 try:
    120     if aplus._isFunction(failure):
--> 121         ret.fulfill(failure(r))
    122     else:
    123         ret.reject(r)

File /usr/local/lib/python3.9/dist-packages/vaex/delayed.py:38, in _log_error.<locals>._wrapped(exc)
     35     print(f"*** DEBUG: Error from {name}", exc)
     36 # import vaex
     37 # vaex.utils.print_stack_trace()
---> 38 raise exc

File /usr/local/lib/python3.9/dist-packages/vaex/promise.py:121, in Promise.then.<locals>.callAndReject(r)
    119 try:
    120     if aplus._isFunction(failure):
--> 121         ret.fulfill(failure(r))
    122     else:
    123         ret.reject(r)

File /usr/local/lib/python3.9/dist-packages/vaex/delayed.py:38, in _log_error.<locals>._wrapped(exc)
     35     print(f"*** DEBUG: Error from {name}", exc)
     36 # import vaex
     37 # vaex.utils.print_stack_trace()
---> 38 raise exc

    [... skipping similar frames: _log_error.<locals>._wrapped at line 38 (1 times), Promise.then.<locals>.callAndReject at line 121 (1 times)]

File /usr/local/lib/python3.9/dist-packages/vaex/promise.py:121, in Promise.then.<locals>.callAndReject(r)
    119 try:
    120     if aplus._isFunction(failure):
--> 121         ret.fulfill(failure(r))
    122     else:
    123         ret.reject(r)

File /usr/local/lib/python3.9/dist-packages/vaex/delayed.py:38, in _log_error.<locals>._wrapped(exc)
     35     print(f"*** DEBUG: Error from {name}", exc)
     36 # import vaex
     37 # vaex.utils.print_stack_trace()
---> 38 raise exc

File /usr/local/lib/python3.9/dist-packages/vaex/execution.py:564, in ExecutorLocal.process_tasks(self, thread_index, i1, i2, chunks, run, df, tasks)
    562 try:
    563     if task.see_all:
--> 564         task_part.process(thread_index, i1, i2, filter_mask, selections, blocks)
    565     else:
    566         task_part.process(thread_index, i1, i2, filter_mask, selections, blocks)

File /usr/local/lib/python3.9/dist-packages/vaex/cpu.py:763, in TaskPartAggregation.process(self, thread_index, i1, i2, filter_mask, selection_masks, blocks)
    761 # we only have 1 data mask, since it's locally combined
    762 if selection_mask is not None:
--> 763     agg.set_data_mask(thread_index, selection_mask)
    764     references.extend([selection_mask])
    765 else:

RuntimeError: Expected a 1d array

thomas-k-cameron avatar Aug 14 '22 14:08 thomas-k-cameron