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_index_backup
Tyler Goodlet 2022-12-15 23:48:07 -05:00
parent 0316304e3d
commit 325fe1ca67
1 changed files with 17 additions and 19 deletions

View File

@ -314,10 +314,6 @@ class IncrementalFormatter(msgspec.Struct):
self.xy_nd_start -= prepend_len self.xy_nd_start -= prepend_len
profiler('prepended xy history: {prepend_length}') 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: if append_len:
self.incr_update_xy_nd( self.incr_update_xy_nd(
shm, shm,
@ -383,7 +379,10 @@ class IncrementalFormatter(msgspec.Struct):
# update the last "in view data range" # update the last "in view data range"
if len(x_1d): if len(x_1d):
self._last_ivdr = x_1d[0], x_1d[-1] 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() breakpoint()
profiler('.format_to_1d()') profiler('.format_to_1d()')
@ -497,7 +496,11 @@ class IncrementalFormatter(msgspec.Struct):
# NOTE: we don't include the very last datum which is filled in # NOTE: we don't include the very last datum which is filled in
# normally by another graphics object. # normally by another graphics object.
x_1d = array[self.index_field][:-1] 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() breakpoint()
y_1d = array[array_key][:-1] y_1d = array[array_key][:-1]
@ -610,6 +613,9 @@ class OHLCBarsFmtr(IncrementalFormatter):
array, array,
start, start,
bar_gap=w * self.index_step_size, 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 return x, y, c
@ -674,7 +680,6 @@ class StepCurveFmtr(IncrementalFormatter):
# fill out Nx2 array to hold each step's left + right vertices. # fill out Nx2 array to hold each step's left + right vertices.
y_out = np.empty( y_out = np.empty(
# (len(out), 2),
x_out.shape, x_out.shape,
dtype=out.dtype, dtype=out.dtype,
) )
@ -782,14 +787,6 @@ class StepCurveFmtr(IncrementalFormatter):
x_step = self.x_nd[start:stop] x_step = self.x_nd[start:stop]
y_step = self.y_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 # slice out in-view data
ivl, ivr = vr ivl, ivr = vr
@ -802,10 +799,11 @@ class StepCurveFmtr(IncrementalFormatter):
x_1d = x_step_iv.reshape(x_step_iv.size) x_1d = x_step_iv.reshape(x_step_iv.size)
y_1d = y_step_iv.reshape(y_step_iv.size) y_1d = y_step_iv.reshape(y_step_iv.size)
if not x_1d.size == y_1d.size: if (
breakpoint() self.index_field == 'time'
and x_1d.any()
if x_1d.any() and (x_1d == 0.5).any(): and (x_1d == 0.5).any()
):
breakpoint() breakpoint()
# debugging # debugging