Block out `do_print` stuff inside `Viz.maxmin()`

epoch_indexing_and_dataviz_layer
Tyler Goodlet 2022-12-07 19:59:27 -05:00
parent 44f50e3d0e
commit 35a16ded2d
1 changed files with 16 additions and 17 deletions

View File

@ -289,29 +289,21 @@ class Viz(msgspec.Struct): # , frozen=True):
# https://stackoverflow.com/a/29980872 # https://stackoverflow.com/a/29980872
rkey = (round(lbar), round(rbar)) rkey = (round(lbar), round(rbar))
cached_result = self._mxmns.get(rkey) cached_result = self._mxmns.get(rkey)
do_print = 'btc' in self.name do_print = False
if cached_result: if cached_result:
# if do_print: if do_print:
# print( print(
# f'{self.name} CACHED maxmin\n' f'{self.name} CACHED maxmin\n'
# f'{rkey} -> {cached_result}' f'{rkey} -> {cached_result}'
# ) )
return cached_result return cached_result
shm = self.shm shm = self.shm
if shm is None: if shm is None:
breakpoint()
return None return None
arr = shm.array arr = shm.array
# times = arr['time']
# step = round(times[-1] - times[-2])
# if (
# do_print
# and step == 60
# ):
# breakpoint()
# get relative slice indexes into array # get relative slice indexes into array
if self.index_field == 'time': if self.index_field == 'time':
@ -331,7 +323,6 @@ class Viz(msgspec.Struct): # , frozen=True):
if not slice_view.size: if not slice_view.size:
log.warning(f'{self.name} no maxmin in view?') log.warning(f'{self.name} no maxmin in view?')
# breakpoint()
return None return None
elif self.yrange: elif self.yrange:
@ -353,10 +344,18 @@ class Viz(msgspec.Struct): # , frozen=True):
yhigh = np.max(view) yhigh = np.max(view)
mxmn = ylow, yhigh mxmn = ylow, yhigh
if do_print: if (
do_print
# and self.index_step() > 1
):
s = 3
print( print(
f'{self.name} MANUAL ohlc={self.is_ohlc} maxmin:\n' f'{self.name} MANUAL ohlc={self.is_ohlc} maxmin:\n'
f'{rkey} -> {mxmn}' f'{rkey} -> {mxmn}\n'
f'read_slc: {read_slc}\n'
f'abs_slc: {slice_view["index"]}\n'
f'first {s}:\n{slice_view[:s]}\n'
f'last {s}:\n{slice_view[-s:]}\n'
) )
# cache result for input range # cache result for input range