You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Title to update when the root cause is identified...)
When attempting to modernize the IEX Trading example on examples.holoviz.org (holoviz-topics/examples#398) we encountered the error I report below. Sorry for the long code to reproduce the bug...
Output (displayed, but with the traceback too...):
Traceback:
WARNING:param.dynamic_operation: Callable raised "UFuncTypeError(<ufunc 'less_equal'>, (<class 'numpy.dtypes.DateTime64DType'>, <class 'numpy.dtypes._PyFloatDType'>, None))".
Invoked as dynamic_operation(x_range=(np.float64(nan), np.float64(nan)))
WARNING:param.dynamic_operation: Callable raised "UFuncTypeError(<ufunc 'less_equal'>, (<class 'numpy.dtypes.DateTime64DType'>, <class 'numpy.dtypes._PyFloatDType'>, None))".
Invoked as dynamic_operation(x_range=(np.float64(nan), np.float64(nan)))
numpy.exceptions.DTypePromotionError: The DType <class 'numpy.dtypes.DateTime64DType'> could not be promoted by <class 'numpy.dtypes._PyFloatDType'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is `object`. The full list of DTypes is: (<class 'numpy.dtypes.DateTime64DType'>, <class 'numpy.dtypes._PyFloatDType'>)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/mliquet/dev/holoviews/holoviews/plotting/util.py", line 300, in get_plot_frame
return map_obj[key]
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 1216, in __getitem__
val = self._execute_callback(*tuple_key)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 983, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 552, in __call__
return self.callable()
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1052, in dynamic_operation
key, obj = resolve(key, kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1041, in resolve
return key, map_obj[key]
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 1216, in __getitem__
val = self._execute_callback(*tuple_key)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 983, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 552, in __call__
return self.callable()
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 197, in dynamic_mul
self_el = self.select(HoloMap, **key_map) if self.kdims else self[()]
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 1216, in __getitem__
val = self._execute_callback(*tuple_key)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 983, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 552, in __call__
return self.callable()
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 197, in dynamic_mul
self_el = self.select(HoloMap, **key_map) if self.kdims else self[()]
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 1216, in __getitem__
val = self._execute_callback(*tuple_key)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 983, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 581, in __call__
ret = self.callable(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1052, in dynamic_operation
key, obj = resolve(key, kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1041, in resolve
return key, map_obj[key]
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 1216, in __getitem__
val = self._execute_callback(*tuple_key)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 983, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/core/spaces.py", line 581, in __call__
ret = self.callable(*args, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1053, in dynamic_operation
return apply(obj, *key, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1045, in apply
processed = self._process(element, key, kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/util/__init__.py", line 1027, in _process
return self.p.operation.process_element(element, key, **kwargs)
File "/Users/mliquet/dev/holoviews/holoviews/core/operation.py", line 192, in process_element
return self._apply(element, key)
File "/Users/mliquet/dev/holoviews/holoviews/core/operation.py", line 141, in _apply
ret = self._process(element, key)
File "/Users/mliquet/dev/holoviews/holoviews/operation/datashader.py", line 694, in _process
info = self._get_sampling(element, x, y, ndim=1, default=default)
File "/Users/mliquet/dev/holoviews/holoviews/operation/resample.py", line 142, in _get_sampling
x_range = (np.nanmin([np.nanmax([x0, ex0]), ex1]),
File "/Users/mliquet/dev/holoviews/.pixi/envs/test-39/lib/python3.9/site-packages/numpy/lib/_nanfunctions_impl.py", line 500, in nanmax
res = np.amax(a, axis=axis, out=out, **kwargs)
File "/Users/mliquet/dev/holoviews/.pixi/envs/test-39/lib/python3.9/site-packages/numpy/_core/fromnumeric.py", line 2916, in amax
return _wrapreduction(a, np.maximum, 'max', axis, None, out,
File "/Users/mliquet/dev/holoviews/.pixi/envs/test-39/lib/python3.9/site-packages/numpy/_core/fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
numpy._core._exceptions._UFuncNoLoopError: ufunc 'less_equal' did not contain a loop with signature matching types (<class 'numpy.dtypes.DateTime64DType'>, <class 'numpy.dtypes._PyFloatDType'>) -> None
I managed to avoid when making this change, as self.p.x_range is equal to (np.nan, np.nan) as this stage and causes the error.
diff --git a/holoviews/operation/resample.py b/holoviews/operation/resample.py
index bb482a79c..b858ae49e 100644
--- a/holoviews/operation/resample.py+++ b/holoviews/operation/resample.py@@ -130,7 +130,7 @@ class ResampleOperation2D(ResampleOperation1D):
else:
if x is None:
x_range = self.p.x_range or (-0.5, 0.5)
- elif self.p.expand or not self.p.x_range:+ elif self.p.expand or (self.p.x_range is None or all(not isfinite(v) for v in self.p.x_range)):
if self.p.x_range and all(isfinite(v) for v in self.p.x_range):
x_range = self.p.x_range
else:
I was wondering why this changed. When looking into it, I saw that spikes_aggregate._process is called 4 times, while I'd expect it to be only called 2 times. Running the same snippet in an older environment (python 3.6, holoviews 1.13.0), I see it is only called 2 times. I also noticed that, after rendering, range_stream.x_range is (np.nan, np.nan) in the newer code (with the change applied), while it was None before. Printing in Stream.update and in spikes_aggregate._process, I can see the stream's x_range is updated a bunch of times, from GenericElementPlot.get_extents() with (np.nan, np.nan) after spikes_aggregate._process is called the first 2 times. Things were much different in the old code, with the first four lines only being printed.
(Title to update when the root cause is identified...)
When attempting to modernize the IEX Trading example on examples.holoviz.org (holoviz-topics/examples#398) we encountered the error I report below. Sorry for the long code to reproduce the bug...
Output (displayed, but with the traceback too...):
Traceback:
I managed to avoid when making this change, as
self.p.x_range
is equal to(np.nan, np.nan)
as this stage and causes the error.I was wondering why this changed. When looking into it, I saw that
spikes_aggregate._process
is called 4 times, while I'd expect it to be only called 2 times. Running the same snippet in an older environment (python 3.6, holoviews 1.13.0), I see it is only called 2 times. I also noticed that, after rendering,range_stream.x_range
is(np.nan, np.nan)
in the newer code (with the change applied), while it wasNone
before. Printing inStream.update
and inspikes_aggregate._process
, I can see the stream'sx_range
is updated a bunch of times, fromGenericElementPlot.get_extents()
with(np.nan, np.nan)
afterspikes_aggregate._process
is called the first 2 times. Things were much different in the old code, with the first four lines only being printed.The text was updated successfully, but these errors were encountered: