Skip to content

FR: Dimension dependent axis-item labels for treescope.render_array #3

Description

@amifalk

Currently, the axis-item labels for an array cannot depend on multiple dimensions, but sometimes the meaning of an axis depends on another dimension that is sliced into.

This interpretation should be coherent so long as the axis-item labels named array is a subset of the array to be rendered.

In general, it would be great if axis_item_labels could accept Penzai named arrays/Jax arrays (and internally cast each to a list or equivalent so the object is json-serializable).

import treescope
from penzai import pz

# dimension-dependent axis-item labels:
# should render different labels for each slice of `offset`
axis_item_labels = pz.nx.ones({"x": 10}) * pz.nx.arange("y", 10)  + pz.nx.arange("offset", 3)
treescope.render_array(pz.nx.ones({"offset": 3, "x": 10, "y": 10}), axis_item_labels=axis_item_labels)

# item labels for x and y:
treescope.render_array(pz.nx.ones({"x": 10, "y": 10}), axis_item_labels=[pz.nx.arange("x", 10), pz.nx.arange("y", 10)]) 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions