Remarking#
Got something to highlight? Make a remark!
trigger condition#
To add a remark, pass a condition
; upon meeting that condition
, the remarks
will appear.
[1]:
import numpy as np
import ahlive as ah
xs = np.array([0, 1, 2])
ys = np.array([3, 4, 5])
arr = ah.Array(xs, ys)
arr = arr.remark(
condition=ys == 4,
remarks='y equals to 4!!'
)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[1], line 10
5 arr = ah.Array(xs, ys)
6 arr = arr.remark(
7 condition=ys == 4,
8 remarks='y equals to 4!!'
9 )
---> 10 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
remark
does not save the object inplace so be sure to either save it to a new variable or same variable!
Sometimes, when joining ah.Array
s, using condition
can get flaky.
[2]:
import numpy as np
import ahlive as ah
xs = np.array([0, 1, 2])
ys = np.array([3, 4, 5])
arr = ah.Array(xs, ys)
arr = arr - arr
try:
arr = arr.remark(
condition=ys == 4,
remarks='y equals to 4!!'
)
arr.render()
except ValueError as e:
print(e)
operands could not be broadcast together with shapes (3,) () (2,6)
To get around that, use the xr.Dataset
under data
for condition
.
[3]:
import numpy as np
import ahlive as ah
xs = np.array([0, 1, 2])
ys = np.array([3, 4, 5])
arr = ah.Array(xs, ys)
arr = arr - arr
ds = arr.data[1, 1]
arr = arr.remark(
condition=ds["y"] == 4,
remarks='y equals to 4!!'
)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[3], line 16
10 ds = arr.data[1, 1]
12 arr = arr.remark(
13 condition=ds["y"] == 4,
14 remarks='y equals to 4!!'
15 )
---> 16 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
[4]:
import numpy as np
import ahlive as ah
xs = np.array([0, 1, 2])
ys = np.array([3, 4, 5])
arr = ah.Array(xs, ys)
arr = arr - arr
arr.reference(y0s="y", last=True).render()
gifsicle: warning: trivial adaptive palette (only 131 colors in source)
[4]:
convenient conditions#
Instead of formulating a condition
, for convenience, values can be passed to xs
, ys
, cs
, labels
, state_labels
, and inline_labels
.
When the data values match the conditional values for the given label, remarks
will trigger.
[5]:
import numpy as np
import ahlive as ah
xs = np.array([0, 1, 2])
ys = np.array([3, 4, 5])
arr = ah.Array(xs, ys)
arr = arr - arr
ds = arr.data[1, 1]
arr = arr.remark(
ys=4,
remarks='y equals to 4!!'
)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[5], line 16
10 ds = arr.data[1, 1]
12 arr = arr.remark(
13 ys=4,
14 remarks='y equals to 4!!'
15 )
---> 16 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Values to match can be Iterables
as well.
[6]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 5])
arr = arr.remark(xs=[1, 2], remarks="y is matched!")
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 5])
3 arr = arr.remark(xs=[1, 2], remarks="y is matched!")
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Multiple remarks
can be passed too, as long as it matches the number of states.
[7]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 5])
arr = arr.remark(xs=[1, 2], remarks=['wont show', '1st show', '2nd show'])
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[7], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 5])
3 arr = arr.remark(xs=[1, 2], remarks=['wont show', '1st show', '2nd show'])
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Any labels listed under “Data variables” is valid for use as long as it contains a state
dimension.
[8]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 5], s=[6, 7, 8])
print(arr)
arr = arr.remark(s=[6, 7], remarks=['the size is 6', 'the size is 7', ''])
arr.render()
<ahlive.Data>
Subplot: (1, 1)
Dimensions: (item: 1, state: 3)
Data variables:
x (item, state) float64 0.0 1.0 2.0
y (item, state) float64 3.0 4.0 5.0
s (item, state) float64 6.0 7.0 8.0
chart (item) <U7 'scatter'
label (item, state) <U1 '' '' ''
group (item) <U1 ''
Attributes (0/49):
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[8], line 5
3 print(arr)
4 arr = arr.remark(s=[6, 7], remarks=['the size is 6', 'the size is 7', ''])
----> 5 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
dynamic remarks#
Rather than setting static values for remarks
, passing a label from the dataset, e.g. x
, y
, c
, label
, state_label
, and inline_label
(without the “s” suffix), can dynamically grab the value for that label at that given condition. Any labels listed under “Data variables” is valid for use as long as it contains a state
dimension.
[9]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 5])
print(arr)
arr = arr.remark(xs=[1, 2], remarks='x')
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
<ahlive.Data>
Subplot: (1, 1)
Dimensions: (item: 1, state: 3)
Data variables:
x (item, state) float64 0.0 1.0 2.0
y (item, state) float64 3.0 4.0 5.0
chart (item) <U7 'scatter'
label (item, state) <U1 '' '' ''
group (item) <U1 ''
Attributes (0/49):
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[9], line 5
3 print(arr)
4 arr = arr.remark(xs=[1, 2], remarks='x')
----> 5 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Note, remarks will be triggered every time the conditional value is met.
[10]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=4, remarks='y')
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[10], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=4, remarks='y')
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
delay durations#
It is also possible to add delays, in seconds, where there was a remark through durations
.
[11]:
import numpy as np
import ahlive as ah
xs = np.array([0, 1, 2])
ys = np.array([3, 4, 5])
arr = ah.Array(xs, ys)
arr = arr.remark(
condition=ys == 4,
remarks='y equals to 4!!',
durations=2
)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[11], line 11
5 arr = ah.Array(xs, ys)
6 arr = arr.remark(
7 condition=ys == 4,
8 remarks='y equals to 4!!',
9 durations=2
10 )
---> 11 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
durations
is only supported with gif, i.e. not video formats!
first encounter#
To have the remarks
trigger only once on the initial match, set first
to True
.
[12]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=4, remarks='y', first=True)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[12], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=4, remarks='y', first=True)
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
first
operates separately on each conditional value, i.e. remarks
will trigger for 3 and the first 4, but not the last 4.
[13]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=[3, 4], remarks='y', first=True)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[13], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=[3, 4], remarks='y', first=True)
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
first
does not work with manually input condition
, only with convenient conditions.
persist plot#
To have the plot marker persist:
[14]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=4, remarks='y', persist_plot=True)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[14], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=4, remarks='y', persist_plot=True)
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
persist inline#
To have the inline label persist:
[15]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=4, remarks='y', persist_inline=True)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[15], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=4, remarks='y', persist_inline=True)
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
tolerance levels#
An absolute tolerance atol
can be specified for inexact matching.
[16]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=4.15, remarks='y', atol=0.5)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[16], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=4.15, remarks='y', atol=0.5)
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
A relative tolerance rtol
can be passed too.
[17]:
import ahlive as ah
arr = ah.Array([0, 1, 2], [3, 4, 4])
arr = arr.remark(ys=4.15, remarks='y', rtol=0.1)
arr.render()
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
dtype = np.object
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[17], line 4
2 arr = ah.Array([0, 1, 2], [3, 4, 4])
3 arr = arr.remark(ys=4.15, remarks='y', rtol=0.1)
----> 4 arr.render()
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/animation.py:1998, in Animation.render(self)
1997 def render(self):
-> 1998 self_copy = self.finalize()
1999 try:
2000 data = self_copy.data
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1417, in Data.finalize(self)
1415 ds = self_copy._precompute_base(ds, chart) # must be after config chart
1416 ds = self_copy._add_geo_tiles(ds) # before interp
-> 1417 ds = self_copy._interp_dataset(ds)
1418 ds = self_copy._add_geo_transforms(ds, chart) # after interp
1419 ds = self_copy._add_geo_features(ds)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/data.py:1115, in Data._interp_dataset(self, ds)
1114 def _interp_dataset(self, ds):
-> 1115 ds = ds.map(self.interpolate, keep_attrs=True)
1117 if "s" in ds:
1118 ds["s"] = fillna(ds["s"].where(ds["s"] >= 0), how="both")
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5964, in Dataset.map(self, func, keep_attrs, args, **kwargs)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
-> 5964 variables = {
5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/xarray-2023.4.2-py3.11.egg/xarray/core/dataset.py:5965, in <dictcomp>(.0)
5962 if keep_attrs is None:
5963 keep_attrs = _get_keep_attrs(default=False)
5964 variables = {
-> 5965 k: maybe_wrap_array(v, func(v, *args, **kwargs))
5966 for k, v in self.data_vars.items()
5967 }
5968 if keep_attrs:
5969 for k, v in variables.items():
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:79, in Easing.interpolate(self, da, name)
77 array_dtype = array.dtype
78 if name in ["duration", "remark", "xerr", "yerr"] and not is_errorbar_morph:
---> 79 result = self._interp_first(
80 array, num_states, num_steps, num_items, num_result, name
81 )
82 elif interp == "fill" or name.endswith(
83 ("zoom", "discrete_trail", "morph_trail", "tick_label", "bar_label")
84 ):
85 result = self._interp_fill(array, num_states, num_steps, name)
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/ahlive-1.0.3.post6+dirty-py3.11.egg/ahlive/easing.py:193, in Easing._interp_first(self, array, num_states, num_steps, num_items, num_result, name)
191 if is_str(array):
192 fill = ""
--> 193 dtype = np.object
194 else:
195 fill = 0.0
File ~/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.11/site-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
rtol
and atol
cannot be used with the condition
keyword.