Always pass step to `slice_from_time()` in view mode

Again, as per the signature change, never expect implicit time step
calcs from overlay processing/machinery code. Also, extend the debug
printing (yet again) to include better details around
"rescale-due-to-minor-range-out-of-view" cases and a detailed msg for
the transform/scaling calculation (inputs/outputs), particularly for the
cases when one of the curves has a lesser support.
log_linearized_curve_overlays
Tyler Goodlet 2023-03-07 15:18:34 -05:00
parent 32926747c6
commit 8d1c713a5a
1 changed files with 26 additions and 8 deletions

View File

@ -86,6 +86,7 @@ def intersect_from_longer(
start_t_second: float, start_t_second: float,
in_view_second: np.ndarray, in_view_second: np.ndarray,
step: float,
) -> np.ndarray: ) -> np.ndarray:
@ -114,6 +115,7 @@ def intersect_from_longer(
arr=longer, arr=longer,
start_t=find_t, start_t=find_t,
stop_t=find_t, stop_t=find_t,
step=step,
) )
return ( return (
longer[slc.start], longer[slc.start],
@ -228,15 +230,13 @@ def overlay_viewlists(
or len(overlay_viz_items) < 2 or len(overlay_viz_items) < 2
): ):
viz = active_viz viz = active_viz
if debug_print:
print(f'ONLY ranging THIS viz: {viz.name}')
out = _maybe_calc_yrange( out = _maybe_calc_yrange(
viz, viz,
yrange_kwargs, yrange_kwargs,
profiler, profiler,
chart_name, chart_name,
) )
if out is None: if out is None:
continue continue
@ -244,6 +244,9 @@ def overlay_viewlists(
viz.plot.vb._set_yrange(**yrange_kwargs) viz.plot.vb._set_yrange(**yrange_kwargs)
profiler(f'{viz.name}@{chart_name} single curve yrange') profiler(f'{viz.name}@{chart_name} single curve yrange')
if debug_print:
print(f'ONLY ranging THIS viz: {viz.name}')
# don't iterate overlays, just move to next chart # don't iterate overlays, just move to next chart
continue continue
@ -362,7 +365,7 @@ def overlay_viewlists(
f'y_ref: {y_ref}\n' f'y_ref: {y_ref}\n'
f'ymn: {ymn}\n' f'ymn: {ymn}\n'
f'ymx: {ymx}\n' f'ymx: {ymx}\n'
f'r_up disp: {r_up}\n' f'r_up: {r_up}\n'
f'r_down: {r_down}\n' f'r_down: {r_down}\n'
f'(full) disp: {disp}\n' f'(full) disp: {disp}\n'
) )
@ -398,6 +401,7 @@ def overlay_viewlists(
dnt.in_view, dnt.in_view,
start_t, start_t,
in_view, in_view,
viz.index_step(),
) )
profiler(f'{viz.name}@{chart_name} intersect by t') profiler(f'{viz.name}@{chart_name} intersect by t')
@ -451,6 +455,7 @@ def overlay_viewlists(
upt.in_view, upt.in_view,
start_t, start_t,
in_view, in_view,
viz.index_step(),
) )
profiler(f'{viz.name}@{chart_name} intersect by t') profiler(f'{viz.name}@{chart_name} intersect by t')
@ -669,6 +674,19 @@ def overlay_viewlists(
r_down_from_major_at_xref, r_down_from_major_at_xref,
) = mx_viz.scalars_from_index(xref) ) = mx_viz.scalars_from_index(xref)
if debug_print:
print(
'MAJOR PIN SCALING\n'
f'mx_xref: {mx_xref}\n'
f'major i_start: {i_start}\n'
f'y_ref_major: {y_ref_major}\n'
f'r_up_from_major_at_xref {r_up_from_major_at_xref}\n'
f'r_down_from_major_at_xref: {r_down_from_major_at_xref}\n'
f'-----to minor-----\n'
f'xref: {xref}\n'
f'y_start: {y_start}\n'
f'yref: {yref}\n'
)
ymn = yref * (1 + r_down_from_major_at_xref) ymn = yref * (1 + r_down_from_major_at_xref)
ymx = yref * (1 + r_up_from_major_at_xref) ymx = yref * (1 + r_up_from_major_at_xref)
@ -693,8 +711,8 @@ def overlay_viewlists(
if debug_print: if debug_print:
print( print(
f'RESCALE {viz.name} ymn -> {y_min}' f'RESCALE {mx_viz.name} DUE TO {viz.name} ymn -> {y_min}\n'
f'RESCALE MAJ ymn -> {mx_ymn}' f'-> MAJ ymn (w r_down: {r_dn_minor}) -> {mx_ymn}\n\n'
) )
# rescale all already scaled curves to new # rescale all already scaled curves to new
# increased range for this side as # increased range for this side as
@ -735,8 +753,8 @@ def overlay_viewlists(
if debug_print: if debug_print:
print( print(
f'RESCALE {viz.name} ymn -> {y_max}' f'RESCALE {mx_viz.name} DUE TO {viz.name} ymx -> {y_max}\n'
f'RESCALE MAJ ymx -> {mx_ymx}' f'-> MAJ ymx (r_up: {r_up_minor} -> {mx_ymx}\n\n'
) )
for _view in scaled: for _view in scaled: