Set `path_arrays_from_ohlc(use_time_index=True)` on epoch indexing

Allows easily switching between normal array `int` indexing and time
indexing by just flipping the `Viz._index_field: str`.

Also, guard all the x-data audit breakpoints with a time indexing
condition.
epoch_indexing_and_dataviz_layer
Tyler Goodlet 2022-12-15 23:48:07 -05:00
parent 93330954c2
commit 24b384f3ef
1 changed files with 17 additions and 19 deletions

View File

@ -315,10 +315,6 @@ class IncrementalFormatter(msgspec.Struct):
self.xy_nd_start -= prepend_len
profiler('prepended xy history: {prepend_length}')
xndall = self.x_nd[self.xy_slice]
if xndall.any() and (xndall == 0.5).any():
breakpoint()
if append_len:
self.incr_update_xy_nd(
shm,
@ -384,7 +380,10 @@ class IncrementalFormatter(msgspec.Struct):
# update the last "in view data range"
if len(x_1d):
self._last_ivdr = x_1d[0], x_1d[-1]
if (x_1d[-1] == 0.5).any():
if (
self.index_field == 'time'
and (x_1d[-1] == 0.5).any()
):
breakpoint()
profiler('.format_to_1d()')
@ -498,7 +497,11 @@ class IncrementalFormatter(msgspec.Struct):
# NOTE: we don't include the very last datum which is filled in
# normally by another graphics object.
x_1d = array[self.index_field][:-1]
if x_1d.any() and (x_1d[-1] == 0.5).any():
if (
self.index_field == 'time'
and x_1d.any()
and (x_1d[-1] == 0.5).any()
):
breakpoint()
y_1d = array[array_key][:-1]
@ -613,6 +616,9 @@ class OHLCBarsFmtr(IncrementalFormatter):
array,
start,
bar_gap=w * self.index_step_size,
# XXX: don't ask, due to a ``numba`` bug..
use_time_index=(self.index_field == 'time'),
)
return x, y, c
@ -677,7 +683,6 @@ class StepCurveFmtr(IncrementalFormatter):
# fill out Nx2 array to hold each step's left + right vertices.
y_out = np.empty(
# (len(out), 2),
x_out.shape,
dtype=out.dtype,
)
@ -785,14 +790,6 @@ class StepCurveFmtr(IncrementalFormatter):
x_step = self.x_nd[start:stop]
y_step = self.y_nd[start:stop]
# debugging
# if y_step.any():
# s = 3
# print(
# f'x_step:\n{x_step[-s:]}\n'
# f'y_step:\n{y_step[-s:]}\n\n'
# )
# slice out in-view data
ivl, ivr = vr
@ -805,10 +802,11 @@ class StepCurveFmtr(IncrementalFormatter):
x_1d = x_step_iv.reshape(x_step_iv.size)
y_1d = y_step_iv.reshape(y_step_iv.size)
if not x_1d.size == y_1d.size:
breakpoint()
if x_1d.any() and (x_1d == 0.5).any():
if (
self.index_field == 'time'
and x_1d.any()
and (x_1d == 0.5).any()
):
breakpoint()
# debugging