Context. transform_process_response_sheet bakes ellipse polygon coords into x_coords / y_coords columns by calling create_ellipse_data. The orientation of those coords depends on the space_on_x argument. Downstream, add_processes (which calls _render_glyph) plots them positionally without re-checking.
Bug shape. If a caller passes space_on_x=False to add_processes but called transform_process_response_sheet without the matching argument (default True), the ellipses render with swapped x/y silently. The two halves of the API don't enforce or communicate the convention they share.
Reproduced in the merged leverage-points HTML before #22 fixed the calling site.
Possible fixes (in increasing order of API change):
- Document the contract. Add a docstring note to
transform_process_response_sheet and add_processes that space_on_x must match across the pipeline. (Cheapest; doesn't prevent the bug.)
- Stamp orientation as metadata. Have
transform_process_response_sheet add a column like _coord_orientation ("stommel" or "boyd"). Have add_processes raise if the orientation doesn't match its space_on_x argument.
- Regenerate at render time. Have
_render_glyph ignore x_coords / y_coords and call create_ellipse_data itself with the right space_on_x. Trades cache benefit for correctness.
Lean toward (2) — keeps the precomputed-coords benefit while making the failure mode loud.
Context.
transform_process_response_sheetbakes ellipse polygon coords intox_coords/y_coordscolumns by callingcreate_ellipse_data. The orientation of those coords depends on thespace_on_xargument. Downstream,add_processes(which calls_render_glyph) plots them positionally without re-checking.Bug shape. If a caller passes
space_on_x=Falsetoadd_processesbut calledtransform_process_response_sheetwithout the matching argument (default True), the ellipses render with swapped x/y silently. The two halves of the API don't enforce or communicate the convention they share.Reproduced in the merged leverage-points HTML before #22 fixed the calling site.
Possible fixes (in increasing order of API change):
transform_process_response_sheetandadd_processesthatspace_on_xmust match across the pipeline. (Cheapest; doesn't prevent the bug.)transform_process_response_sheetadd a column like_coord_orientation("stommel" or "boyd"). Haveadd_processesraise if the orientation doesn't match itsspace_on_xargument._render_glyphignorex_coords/y_coordsand callcreate_ellipse_dataitself with the rightspace_on_x. Trades cache benefit for correctness.Lean toward (2) — keeps the precomputed-coords benefit while making the failure mode loud.