cogpy.plot.hv.orthoslicer
Interactive orthoslicer with a linked time-window view (no RangeTool).
This module defines OrthoSlicerRanger,
a stabilized orthoslicer concept that shows a 1D time summary curve underneath
the time–frequency view with a shared time axis.
Key differences vs. orthoslicer_ranger.py:
The core plotting plumbing is built once in
_build_core()using stable HoloViewsDynamicMapobjects and streams, instead of being recreated inside the view functions on every parameter update.panel_app()usesview_tz/view_xyconsistently.
Compared to the other orthoslicer modules:
Adds a linked time-window (
t_window) that tracks the visible TZ x-range.Does not focus on general zoom persistence (see
orthoslicer_zoom.py) or faceting/local sampling helpers (seeorthoslicer_facet.py).
Example
>>> import numpy as np
>>> import xarray as xr
>>> import holoviews as hv
>>> import panel as pn
>>> from cogpy.datasets.tensor import make_dataset
>>> from cogpy.plot.orthoslicer_rangercopy import OrthoSlicerRanger
>>>
>>> pn.extension()
>>> hv.extension("bokeh")
>>>
>>> da = make_dataset()
>>> da = xr.concat([da] * 100, dim="time")
>>> fs = float(da["time"].values[1] - da["time"].values[0])
>>> da = da.assign_coords({"time": fs * np.arange(da.sizes["time"])})
>>>
>>> dx = ("ml", hv.Dimension("x", label="Medial-Lateral", unit="mm"))
>>> dy = ("ap", hv.Dimension("y", label="Anterior-Posterior", unit="mm"))
>>> dt = ("time", hv.Dimension("t", label="Time", unit="s"))
>>> dz = ("freq", hv.Dimension("z", label="Frequency", unit="Hz"))
>>>
>>> # 1D signal plotted under the TZ view (defaults to a mean if omitted)
>>> rangeslider_sig = da.mean(dim=("freq", "ap", "ml"))
>>>
>>> slicer = OrthoSlicerRanger(
... da, rangeslider_sig=rangeslider_sig, dt=dt, dz=dz, dy=dy, dx=dx
... )
>>> slicer.panel_app().show()
Functions
|
Classes
|
Panel/HoloViews refactor exposing: |