Always pass full `ShmArray._array` buf to `ContentsLables` updates so the label can be used outside the "backfilled-valid" range

distribute_dis
Tyler Goodlet 2023-12-22 12:06:55 -05:00
parent d006ecce7e
commit 1f346483a0
1 changed files with 9 additions and 3 deletions

View File

@ -272,10 +272,15 @@ class ContentsLabels:
x_in: int, x_in: int,
) -> None: ) -> None:
for chart, name, label, update in self._labels: for (
chart,
name,
label,
update,
)in self._labels:
viz = chart.get_viz(name) viz = chart.get_viz(name)
array = viz.shm.array array: np.ndarray = viz.shm._array
index = array[viz.index_field] index = array[viz.index_field]
start = index[0] start = index[0]
stop = index[-1] stop = index[-1]
@ -286,7 +291,7 @@ class ContentsLabels:
): ):
# out of range # out of range
print('WTF out of range?') print('WTF out of range?')
continue # continue
# call provided update func with data point # call provided update func with data point
try: try:
@ -294,6 +299,7 @@ class ContentsLabels:
ix = np.searchsorted(index, x_in) ix = np.searchsorted(index, x_in)
if ix > len(array): if ix > len(array):
breakpoint() breakpoint()
update(ix, array) update(ix, array)
except IndexError: except IndexError: