From 2e67e98b4d0e7442f923937f175be6f72d3eeb6a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 30 Nov 2022 19:18:27 -0500 Subject: [PATCH] Go with explicit `.data._m4` mod name Since it's a notable and self-contained graphics compression algo, might as well give it a dedicated module B) --- piker/data/{_compression.py => _m4.py} | 28 +++++++++++++++----------- piker/data/_pathops.py | 5 ++--- piker/ui/_curve.py | 4 ---- 3 files changed, 18 insertions(+), 19 deletions(-) rename piker/data/{_compression.py => _m4.py} (91%) diff --git a/piker/data/_compression.py b/piker/data/_m4.py similarity index 91% rename from piker/data/_compression.py rename to piker/data/_m4.py index fde92500..26d5e0b0 100644 --- a/piker/data/_compression.py +++ b/piker/data/_m4.py @@ -15,8 +15,22 @@ # along with this program. If not, see . ''' -Graphics related downsampling routines for compressing to pixel -limits on the display device. +Graphics downsampling using the infamous M4 algorithm. + +This is one of ``piker``'s secret weapons allowing us to boss all other +charting platforms B) + +(AND DON'T YOU DARE TAKE THIS CODE WITHOUT CREDIT OR WE'LL SUE UR F#&@* ASS). + +NOTES: this method is a so called "visualization driven data +aggregation" approach. It gives error-free line chart +downsampling, see +further scientific paper resources: +- http://www.vldb.org/pvldb/vol7/p797-jugel.pdf +- http://www.vldb.org/2014/program/papers/demo/p997-jugel.pdf + +Details on implementation of this algo are based in, +https://github.com/pikers/piker/issues/109 ''' import math @@ -56,16 +70,6 @@ def ds_m4( This is more or less an OHLC style sampling of a line-style series. ''' - # NOTE: this method is a so called "visualization driven data - # aggregation" approach. It gives error-free line chart - # downsampling, see - # further scientific paper resources: - # - http://www.vldb.org/pvldb/vol7/p797-jugel.pdf - # - http://www.vldb.org/2014/program/papers/demo/p997-jugel.pdf - - # Details on implementation of this algo are based in, - # https://github.com/pikers/piker/issues/109 - # XXX: from infinite on downsampling viewable graphics: # "one thing i remembered about the binning - if you are # picking a range within your timeseries the start and end bin diff --git a/piker/data/_pathops.py b/piker/data/_pathops.py index acc02be4..144bea33 100644 --- a/piker/data/_pathops.py +++ b/piker/data/_pathops.py @@ -27,10 +27,9 @@ from numba import ( # optional, ) +# TODO: for ``numba`` typing.. # from ._source import numba_ohlc_dtype -from ._compression import ( - ds_m4, -) +from ._m4 import ds_m4 def xy_downsample( diff --git a/piker/ui/_curve.py b/piker/ui/_curve.py index 8df1cda0..ad415031 100644 --- a/piker/ui/_curve.py +++ b/piker/ui/_curve.py @@ -36,10 +36,6 @@ from PyQt5.QtGui import ( ) from .._profile import pg_profile_enabled, ms_slower_then from ._style import hcolor -# from ._compression import ( -# # ohlc_to_m4_line, -# ds_m4, -# ) from ..log import get_logger from .._profile import Profiler