Public API¶
The top-level package gathers the most important public types and entrypoints in one place.
Use DiagnosticsSpec when you want app-scoped perf logging config on
AppSpec(...) instead of relying on environment variables alone.
compneurovis ¶
Public authoring surface for CompNeuroVis.
Classes:
| Name | Description |
|---|---|
ActionSpec |
|
AttributeRef |
|
AppSpec |
|
BoolValueSpec |
|
ChoiceValueSpec |
|
ControlPresentationSpec |
|
ControlSpec |
|
DiagnosticsSpec |
|
Scene |
|
Field |
Dense labeled array with named axes and coordinate metadata. |
Geometry |
|
GridGeometry |
|
HistoryCaptureMode |
|
LayoutSpec |
|
LinePlotViewSpec |
|
MorphologyGeometry |
|
MorphologyViewSpec |
|
StateGraphViewSpec |
Static directed graph with live-colored nodes and edges. |
PanelSpec |
|
ReplaySession |
Session that replays a precomputed sequence of frame replacements. |
ScalarValueSpec |
|
SeriesSpec |
|
StateBinding |
Resolve a view or control value from frontend-owned state. |
SurfaceViewSpec |
|
ViewSpec |
|
XYValueSpec |
|
VispyFrontendWindow |
|
Functions:
| Name | Description |
|---|---|
build_replay_app |
Build an app that replays precomputed frames through ReplaySession. |
build_surface_app |
Build a static surface app from field data, optional geometry, and views. |
grid_field |
Create a Field/GridGeometry pair from a 2-D array and coordinate vectors. |
run_app |
|
ActionSpec
dataclass
¶
ActionSpec(
id: str,
label: str,
payload: dict[str, Any] = dict(),
shortcuts: tuple[str, ...] = (),
selection_mode: bool = False,
selection_payload_key: str = "entity_id",
)
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
label |
str
|
|
payload |
dict[str, Any]
|
|
shortcuts |
tuple[str, ...]
|
|
selection_mode |
bool
|
|
selection_payload_key |
str
|
|
AttributeRef
dataclass
¶
AppSpec
dataclass
¶
AppSpec(
scene: Scene | None = None,
session: Any = None,
interaction_target: Any = None,
title: str | None = None,
diagnostics: "DiagnosticsSpec | None" = None,
)
Attributes:
| Name | Type | Description |
|---|---|---|
scene |
Scene | None
|
|
session |
Any
|
|
interaction_target |
Any
|
|
title |
str | None
|
|
diagnostics |
'DiagnosticsSpec | None'
|
|
BoolValueSpec
dataclass
¶
ChoiceValueSpec
dataclass
¶
ControlPresentationSpec
dataclass
¶
ControlPresentationSpec(
kind: str | None = None,
steps: int | None = None,
scale: str = "linear",
shape: str | None = None,
)
ControlSpec
dataclass
¶
ControlSpec(
id: str,
label: str,
value_spec: ControlValueSpec,
presentation: ControlPresentationSpec | None = None,
state_key: str | None = None,
send_to_session: bool = False,
target: AttributeRef | None = None,
)
Methods:
| Name | Description |
|---|---|
default_value |
|
resolved_state_key |
|
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
label |
str
|
|
value_spec |
ControlValueSpec
|
|
presentation |
ControlPresentationSpec | None
|
|
state_key |
str | None
|
|
send_to_session |
bool
|
|
target |
AttributeRef | None
|
|
presentation
class-attribute
instance-attribute
¶
DiagnosticsSpec
dataclass
¶
DiagnosticsSpec(
perf_log_enabled: bool = False,
perf_log_dir: str | Path | None = None,
perf_echo_stderr: bool = False,
)
Attributes:
| Name | Type | Description |
|---|---|---|
perf_log_enabled |
bool
|
|
perf_log_dir |
str | Path | None
|
|
perf_echo_stderr |
bool
|
|
Scene
dataclass
¶
Scene(
fields: dict[str, Field],
geometries: dict[str, Geometry],
views: dict[str, ViewSpec],
operators: dict[str, OperatorSpec] = dict(),
controls: dict[str, ControlSpec] = dict(),
actions: dict[str, ActionSpec] = dict(),
layout: LayoutSpec = LayoutSpec(),
metadata: dict[str, Any] = dict(),
)
Methods:
| Name | Description |
|---|---|
replace_view |
|
replace_operator |
|
replace_control |
|
Attributes:
| Name | Type | Description |
|---|---|---|
fields |
dict[str, Field]
|
|
geometries |
dict[str, Geometry]
|
|
views |
dict[str, ViewSpec]
|
|
operators |
dict[str, OperatorSpec]
|
|
controls |
dict[str, ControlSpec]
|
|
actions |
dict[str, ActionSpec]
|
|
layout |
LayoutSpec
|
|
metadata |
dict[str, Any]
|
|
Field
dataclass
¶
Field(
id: str,
values: ndarray,
dims: tuple[str, ...],
coords: dict[str, ndarray],
unit: str | None = None,
attrs: dict[str, Any] = dict(),
)
Dense labeled array with named axes and coordinate metadata.
Methods:
| Name | Description |
|---|---|
axis_index |
|
coord |
|
with_values |
|
append |
|
resolve_indexer |
|
select |
|
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
values |
ndarray
|
|
dims |
tuple[str, ...]
|
|
coords |
dict[str, ndarray]
|
|
unit |
str | None
|
|
attrs |
dict[str, Any]
|
|
with_values ¶
with_values(
values: ndarray,
coords: Mapping[str, ndarray] | None = None,
attrs_update: Mapping[str, Any] | None = None,
) -> Field
append ¶
append(
dim: str,
values: ndarray,
coord_values: ndarray,
*,
max_length: int | None = None,
attrs_update: Mapping[str, Any] | None = None,
) -> Field
Geometry
dataclass
¶
GridGeometry
dataclass
¶
GridGeometry(
id: str,
dims: tuple[str, str],
coords: dict[str, ndarray],
metadata: dict[str, Any] = dict(),
)
HistoryCaptureMode ¶
LayoutSpec
dataclass
¶
LayoutSpec(
title: str = "CompNeuroVis",
panels: tuple[PanelSpec, ...] = (),
panel_grid: tuple[tuple[str, ...], ...] = (),
)
Methods:
| Name | Description |
|---|---|
resolved_panels |
|
panels_of_kind |
|
panel |
|
panel_for_view |
|
patch_panel |
Apply |
replace_panels |
Replace the full panel inventory and optional grid. Does not re-normalize. |
normalize_panels |
|
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str
|
|
panels |
tuple[PanelSpec, ...]
|
|
panel_grid |
tuple[tuple[str, ...], ...]
|
|
patch_panel ¶
Apply dataclasses.replace changes to one panel in the panels tuple.
Returns True if the panel was found and patched, False if not found.
replace_panels ¶
replace_panels(
panels: "tuple[PanelSpec, ...]",
panel_grid: "tuple[tuple[str, ...], ...]" = (),
) -> None
Replace the full panel inventory and optional grid. Does not re-normalize.
normalize_panels ¶
normalize_panels(
*,
views: dict[str, ViewSpec],
controls: dict[str, ControlSpec],
actions: dict[str, ActionSpec],
) -> None
LinePlotViewSpec
dataclass
¶
LinePlotViewSpec(
id: str,
title: str = "",
field_id: str = "",
operator_id: str | None = None,
x_dim: str | None = None,
series_dim: str | None = None,
selectors: dict[str, SelectorValue] = dict(),
x_label: str = "x",
y_label: str = "y",
x_unit: str = "",
y_unit: str = "",
pen: ValueOrBinding = "k",
background_color: ValueOrBinding = "w",
show_legend: bool = True,
series_colors: dict[str, ValueOrBinding] = dict(),
series_palette: tuple[ValueOrBinding, ...] = (),
rolling_window: float | None = None,
trim_to_rolling_window: bool = False,
max_refresh_hz: float | None = None,
y_min: float | None = None,
y_max: float | None = None,
x_major_tick_spacing: float | None = None,
x_minor_tick_spacing: float | None = None,
)
Bases: ViewSpec
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
title |
str
|
|
field_id |
str
|
|
operator_id |
str | None
|
|
x_dim |
str | None
|
|
series_dim |
str | None
|
|
selectors |
dict[str, SelectorValue]
|
|
x_label |
str
|
|
y_label |
str
|
|
x_unit |
str
|
|
y_unit |
str
|
|
pen |
ValueOrBinding
|
|
background_color |
ValueOrBinding
|
|
show_legend |
bool
|
|
series_colors |
dict[str, ValueOrBinding]
|
|
series_palette |
tuple[ValueOrBinding, ...]
|
|
rolling_window |
float | None
|
|
trim_to_rolling_window |
bool
|
|
max_refresh_hz |
float | None
|
|
y_min |
float | None
|
|
y_max |
float | None
|
|
x_major_tick_spacing |
float | None
|
|
x_minor_tick_spacing |
float | None
|
|
MorphologyGeometry
dataclass
¶
MorphologyGeometry(
id: str,
positions: ndarray,
orientations: ndarray,
radii: ndarray,
lengths: ndarray,
entity_ids: tuple[str, ...],
section_names: tuple[str, ...],
xlocs: ndarray,
colors: ndarray | None = None,
labels: tuple[str, ...] = (),
metadata: dict[str, Any] = dict(),
)
Bases: Geometry
Methods:
| Name | Description |
|---|---|
entity_index |
|
label_for |
|
entity_info |
|
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
kind |
str
|
|
positions |
ndarray
|
|
orientations |
ndarray
|
|
radii |
ndarray
|
|
lengths |
ndarray
|
|
entity_ids |
tuple[str, ...]
|
|
section_names |
tuple[str, ...]
|
|
xlocs |
ndarray
|
|
colors |
ndarray | None
|
|
labels |
tuple[str, ...]
|
|
metadata |
dict[str, Any]
|
|
metadata
class-attribute
instance-attribute
¶
MorphologyViewSpec
dataclass
¶
MorphologyViewSpec(
id: str,
title: str = "",
geometry_id: str = "morphology",
color_field_id: str | None = None,
entity_dim: str = "segment",
sample_dim: str | None = "time",
color_map: str = "scalar",
color_limits: ValueOrBinding = None,
color_norm: str = "auto",
background_color: ValueOrBinding = "white",
max_refresh_hz: float | None = None,
)
Bases: ViewSpec
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
title |
str
|
|
geometry_id |
str
|
|
color_field_id |
str | None
|
|
entity_dim |
str
|
|
sample_dim |
str | None
|
|
color_map |
str
|
|
color_limits |
ValueOrBinding
|
|
color_norm |
str
|
|
background_color |
ValueOrBinding
|
|
max_refresh_hz |
float | None
|
|
StateGraphViewSpec
dataclass
¶
StateGraphViewSpec(
id: str,
title: str = "",
node_field_id: str = "",
edge_field_id: str = "",
node_positions: tuple[
tuple[str, float, float], ...
] = (),
edges: tuple[tuple[str, str, str], ...] = (),
node_color_map: str = "fire",
edge_color_map: str = "bwr",
node_color_limits: tuple[float, float] = (0.0, 1.0),
edge_color_limits: tuple[float, float] = (-0.1, 0.1),
node_size: float = 20.0,
background_color: Any = "white",
max_refresh_hz: float | None = None,
)
Bases: ViewSpec
Static directed graph with live-colored nodes and edges.
node_positions: each entry is (state_name, x, y) in normalized [0,1] canvas space. edges: each entry is (source_state, target_state, edge_id). node_field_id: Field with dims=("state",); values are current state occupancies. edge_field_id: Field with dims=("edge",); values are net fluxes or rates.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
title |
str
|
|
node_field_id |
str
|
|
edge_field_id |
str
|
|
node_positions |
tuple[tuple[str, float, float], ...]
|
|
edges |
tuple[tuple[str, str, str], ...]
|
|
node_color_map |
str
|
|
edge_color_map |
str
|
|
node_color_limits |
tuple[float, float]
|
|
edge_color_limits |
tuple[float, float]
|
|
node_size |
float
|
|
background_color |
Any
|
|
max_refresh_hz |
float | None
|
|
PanelSpec
dataclass
¶
PanelSpec(
id: str,
kind: str,
view_ids: tuple[str, ...] = (),
control_ids: tuple[str, ...] = (),
action_ids: tuple[str, ...] = (),
operator_ids: tuple[str, ...] = (),
host_kind: str = "independent_canvas",
title: str | None = None,
camera_distance: float | None = 200.0,
camera_elevation: float = 30.0,
camera_azimuth: float = 30.0,
)
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
kind |
str
|
|
view_ids |
tuple[str, ...]
|
|
control_ids |
tuple[str, ...]
|
|
action_ids |
tuple[str, ...]
|
|
operator_ids |
tuple[str, ...]
|
|
host_kind |
str
|
|
title |
str | None
|
|
camera_distance |
float | None
|
|
camera_elevation |
float
|
|
camera_azimuth |
float
|
|
ReplaySession ¶
Bases: BufferedSession
Session that replays a precomputed sequence of frame replacements.
Methods:
| Name | Description |
|---|---|
startup_scene |
|
read_updates |
|
idle_sleep |
|
shutdown |
|
emit |
|
initialize |
|
is_live |
|
advance |
|
handle |
|
Attributes:
| Name | Type | Description |
|---|---|---|
scene |
|
|
field_id |
|
|
frames |
|
|
index |
|
|
interval_live |
|
ScalarValueSpec
dataclass
¶
ScalarValueSpec(
default: float | int,
min: float | int | None = None,
max: float | int | None = None,
value_type: Literal["float", "int"] = "float",
)
Attributes:
| Name | Type | Description |
|---|---|---|
default |
float | int
|
|
min |
float | int | None
|
|
max |
float | int | None
|
|
value_type |
Literal['float', 'int']
|
|
SeriesSpec
dataclass
¶
StateBinding
dataclass
¶
SurfaceViewSpec
dataclass
¶
SurfaceViewSpec(
id: str,
title: str = "",
field_id: str = "",
geometry_id: str | None = None,
color_map: ValueOrBinding = "bwr",
color_limits: ValueOrBinding = None,
color_by: ValueOrBinding = "height",
surface_color: ValueOrBinding = (0.5, 0.6, 0.8, 1.0),
surface_shading: ValueOrBinding = "unlit",
surface_alpha: ValueOrBinding = 1.0,
background_color: ValueOrBinding = "white",
render_axes: ValueOrBinding = False,
axes_in_middle: ValueOrBinding = True,
tick_count: ValueOrBinding = 5,
tick_length_scale: ValueOrBinding = 1.0,
tick_label_size: ValueOrBinding = 12.0,
axis_label_size: ValueOrBinding = 16.0,
axis_color: ValueOrBinding = "black",
text_color: ValueOrBinding = "black",
axis_alpha: ValueOrBinding = 1.0,
axis_labels: tuple[str, str, str] | None = None,
max_refresh_hz: float | None = None,
)
Bases: ViewSpec
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
title |
str
|
|
field_id |
str
|
|
geometry_id |
str | None
|
|
color_map |
ValueOrBinding
|
|
color_limits |
ValueOrBinding
|
|
color_by |
ValueOrBinding
|
|
surface_color |
ValueOrBinding
|
|
surface_shading |
ValueOrBinding
|
|
surface_alpha |
ValueOrBinding
|
|
background_color |
ValueOrBinding
|
|
render_axes |
ValueOrBinding
|
|
axes_in_middle |
ValueOrBinding
|
|
tick_count |
ValueOrBinding
|
|
tick_length_scale |
ValueOrBinding
|
|
tick_label_size |
ValueOrBinding
|
|
axis_label_size |
ValueOrBinding
|
|
axis_color |
ValueOrBinding
|
|
text_color |
ValueOrBinding
|
|
axis_alpha |
ValueOrBinding
|
|
axis_labels |
tuple[str, str, str] | None
|
|
max_refresh_hz |
float | None
|
|
surface_color
class-attribute
instance-attribute
¶
ViewSpec
dataclass
¶
XYValueSpec
dataclass
¶
XYValueSpec(
default: dict[str, float] = (
lambda: {"x": 0.5, "y": 0.5}
)(),
x_range: tuple[float, float] = (0.0, 1.0),
y_range: tuple[float, float] = (0.0, 1.0),
x_label: str = "X",
y_label: str = "Y",
)
VispyFrontendWindow ¶
Bases: QMainWindow
Methods:
| Name | Description |
|---|---|
paintEvent |
|
resizeEvent |
|
line_plot_panel |
|
controls_panel |
|
viewport_for |
|
keyPressEvent |
|
closeEvent |
|
Attributes:
| Name | Type | Description |
|---|---|---|
app_spec |
|
|
scene |
Scene | None
|
|
state |
dict[str, Any]
|
|
transport |
PipeTransport | None
|
|
refresh_planner |
RefreshPlanner | None
|
|
interaction_target |
|
|
viewports |
dict[str, Viewport3DPanel]
|
|
view_hosts |
dict[str, IndependentCanvas3DHostPanel]
|
|
line_plot_host_panels |
dict[str, LinePlotHostPanel]
|
|
line_plot_panels |
dict[str, LinePlotPanel]
|
|
controls_host_panels |
dict[str, ControlsHostPanel]
|
|
controls_panels |
dict[str, ControlsPanel]
|
|
state_graph_host_panels |
dict[str, StateGraphHostPanel]
|
|
state_graph_panels |
dict[str, StateGraphPanel]
|
|
timer |
|
|
viewport |
Viewport3DPanel | None
|
|
build_replay_app ¶
Build an app that replays precomputed frames through ReplaySession.
build_surface_app ¶
build_surface_app(
*,
field: Field,
geometry: GridGeometry | None = None,
title: str = "Surface",
surface_view: SurfaceViewSpec | None = None,
line_views: tuple[LinePlotViewSpec, ...] = (),
operators: dict[str, OperatorSpec] | None = None,
controls: dict[str, ControlSpec] | None = None,
panels: tuple[PanelSpec, ...] = (),
panel_grid: tuple[tuple[str, ...], ...] = (),
) -> AppSpec
Build a static surface app from field data, optional geometry, and views.
grid_field ¶
grid_field(
*,
field_id: str,
values: ndarray,
x_coords: ndarray,
y_coords: ndarray,
x_dim: str = "x",
y_dim: str = "y",
unit: str | None = None,
) -> tuple[Field, GridGeometry]
Create a Field/GridGeometry pair from a 2-D array and coordinate vectors.