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)
multichartz
Tyler Goodlet 2022-11-30 19:18:27 -05:00
parent 4a9896a29d
commit f2179dc6f8
3 changed files with 18 additions and 19 deletions

View File

@ -15,8 +15,22 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
''' '''
Graphics related downsampling routines for compressing to pixel Graphics downsampling using the infamous M4 algorithm.
limits on the display device.
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 import math
@ -56,16 +70,6 @@ def ds_m4(
This is more or less an OHLC style sampling of a line-style series. 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: # XXX: from infinite on downsampling viewable graphics:
# "one thing i remembered about the binning - if you are # "one thing i remembered about the binning - if you are
# picking a range within your timeseries the start and end bin # picking a range within your timeseries the start and end bin

View File

@ -27,10 +27,9 @@ from numba import (
# optional, # optional,
) )
# TODO: for ``numba`` typing..
# from ._source import numba_ohlc_dtype # from ._source import numba_ohlc_dtype
from ._compression import ( from ._m4 import ds_m4
ds_m4,
)
def xy_downsample( def xy_downsample(

View File

@ -36,10 +36,6 @@ from PyQt5.QtGui import (
) )
from .._profile import pg_profile_enabled, ms_slower_then from .._profile import pg_profile_enabled, ms_slower_then
from ._style import hcolor from ._style import hcolor
# from ._compression import (
# # ohlc_to_m4_line,
# ds_m4,
# )
from ..log import get_logger from ..log import get_logger
from .._profile import Profiler from .._profile import Profiler