|
18 | 18 | from uuid import uuid4 |
19 | 19 | from collections import namedtuple |
20 | 20 |
|
21 | | -import orjson |
22 | 21 | import dash |
23 | 22 | import numpy as np |
24 | 23 | import pandas as pd |
@@ -293,6 +292,7 @@ def _check_update_trace_data( |
293 | 292 | hf_series, hf_trace_data["max_n_samples"] |
294 | 293 | ) |
295 | 294 | # Also parse the data types to an orjson compatible format |
| 295 | + # Note this can be removed once orjson supports f16 |
296 | 296 | trace["x"] = self._parse_dtype_orjson(s_res.index) |
297 | 297 | trace["y"] = self._parse_dtype_orjson(s_res.values) |
298 | 298 | # todo -> first draft & not MP safe |
@@ -702,15 +702,6 @@ def _parse_get_trace_props( |
702 | 702 | except ValueError: |
703 | 703 | hf_y = hf_y.astype("str") |
704 | 704 |
|
705 | | - msg = ( |
706 | | - "Plotly-Resampler its aggregator functions do not support the float128" |
707 | | - + " dtype, so please consider casting your data to float64\n." |
708 | | - + " If you have an eligible usecase where float128 still is necessary," |
709 | | - + " please consider making an issue on GitHub." |
710 | | - ) |
711 | | - assert hf_x.dtype != np.float128, msg |
712 | | - assert hf_y.dtype != np.float128, msg |
713 | | - |
714 | 705 | assert len(hf_x) == len(hf_y), "x and y have different length!" |
715 | 706 | else: |
716 | 707 | self._print(f"trace {trace['type']} is not a high-frequency trace") |
@@ -1296,16 +1287,9 @@ def _parse_dtype_orjson(series: np.ndarray) -> np.ndarray: |
1296 | 1287 | # NOTE: |
1297 | 1288 | # * float16 and float128 aren't supported with latest orjson versions (3.8.1) |
1298 | 1289 | # * this method assumes that the it will not get a float128 series |
| 1290 | + # -> this method can be removed if orjson supports float16 |
1299 | 1291 | if series.dtype in [np.float16]: |
1300 | 1292 | return series.astype(np.float32) |
1301 | | - |
1302 | | - # orjson < 3.8.0 encoding cannot encode with int16 & uint16 dtype |
1303 | | - elif series.dtype in [np.int16, np.uint16]: |
1304 | | - major_v, minor_v = list(map(int, orjson.__version__.split(".")))[:2] |
1305 | | - if major_v < 3 or major_v == 3 and minor_v < 8: |
1306 | | - if series.dtype == np.uint16: |
1307 | | - return series.astype("uint32") |
1308 | | - return series.astype(np.int32) |
1309 | 1293 | return series |
1310 | 1294 |
|
1311 | 1295 | @staticmethod |
|
0 commit comments