scistudio.previewers.data_access
Canonical import root: from scistudio.previewers.data_access import ...
Self-contained public-API reference — 11 symbols from this module's __all__, with signatures and docstrings inlined (ADR-052 §7). Generated; do not hand-edit.
ArrayPlane — class
Stability: provisional · Since 0.3.1
class ArrayPlane
ArrayPlane(shape: 'list[int]', axes: 'list[str]', dtype: 'str', slice_axis_name: 'str | None', slice_axis_size: 'int | None', slice_index: 'int | None', slice_axes: 'list[SliceAxis]', matrix: 'list[list[float | None]]', vmin: 'float | None', vmax: 'float | None', truncated: 'bool', ndim: 'int') -> None
A bounded 2-D plane sliced out of an N-D array, with axis metadata.
matrix holds the actual (downsampled) numeric values of the displayed
plane — the previewer renders these as a numeric heatmap table, not a lossy
grayscale image. Every non-displayed axis is listed in slice_axes with
its selected index, so an N-D array is fully navigable (one index picker per
extra axis).
ArrayTile — class
Stability: provisional · Since 0.3.1
class ArrayTile
ArrayTile(y0: 'int', x0: 'int', height: 'int', width: 'int', matrix: 'list[list[float]]') -> None
A bounded rectangular tile read out of a 2-D array plane.
Returned by PreviewDataAccess.array_tile so the frontend can fetch a
zoomed-in region of a large plane without loading the whole plane.
ArtifactInfo — class
Stability: provisional · Since 0.3.1
class ArtifactInfo
ArtifactInfo(path: 'str', mime_type: 'str', size_bytes: 'int', data_uri: 'str | None' = None) -> None
Bounded metadata about an opaque artifact, with no full read.
Describes a file artifact by path, MIME type, and size. A small,
directly-displayable image may also carry an inline data_uri; larger
files return metadata only.
CollectionSample — class
Stability: provisional · Since 0.3.1
class CollectionSample
CollectionSample(count: 'int', item_type: 'str | None', items: 'list[dict[str, Any]]', sampled: 'bool') -> None
A bounded sample of a collection's items.
CompositeSlots — class
Stability: provisional · Since 0.3.1
class CompositeSlots
CompositeSlots(slots: 'dict[str, str]') -> None
The slot inventory of a composite target, with no child rendered.
DataFramePage — class
Stability: provisional · Since 0.3.1
class DataFramePage
DataFramePage(columns: 'list[str]', rows: 'list[dict[str, Any]]', total_rows: 'int', page: 'int', page_size: 'int', total_pages: 'int', sort_by: 'str | None', sort_dir: 'str | None') -> None
One bounded page of a table, returned by PreviewDataAccess.dataframe_page.
Holds a single page of rows plus the paging/sort state the frontend needs to render a pager. The page size is capped by the session row budget.
PreviewDataAccess — class
Stability: provisional · Since 0.3.1
class PreviewDataAccess
PreviewDataAccess(*, max_rows: 'int' = 200, max_bytes: 'int' = 8388608, max_items: 'int' = 100, max_tile: 'int' = 256, max_dim: 'int' = 256, text_chars: 'int' = 5000, series_points: 'int' = 256) -> 'None'
The bounded reader a provider uses for every payload read.
This is the only sanctioned way a previewer provider reads a target's stored
bytes. The runtime builds it from the session budgets and injects it on
request.data_access — you call its methods and never construct it. It
never exposes raw storage paths to the frontend: you get typed result
objects and put only their JSON-safe contents into your envelope. Methods
named *_page / *_chunk / *_tile are bounded; methods returning
chart points return the complete set.
Example: >>> def render(request): ... page = request.data_access.dataframe_page(request.storage, page=1) ... return {"columns": page.columns, "rows": page.rows}
Members
dataframe_page(self, ref: 'StorageReference', *, page: 'int' = 1, page_size: 'int' = 50, sort_by: 'str | None' = None, sort_dir: 'str' = 'asc') -> 'DataFramePage'—provisional· Since0.3.1— Return one bounded, optionally sorted page of a CSV/Parquet table.table_xy_points(self, ref: 'StorageReference', *, x_column: 'str | None' = None, y_column: 'str | None' = None) -> 'TableXYPoints'—provisional· Since0.3.1— Return all finite x/y points from two Parquet table columns.array_plane(self, ref: 'StorageReference', *, slice_index: 'int' = 0, axis_indices: 'dict[int, int] | None' = None) -> 'ArrayPlane'—provisional· Since0.3.1— Return array shape/axes metadata plus one bounded, downsampled 2-D plane.array_tile(self, ref: 'StorageReference', *, slice_index: 'int' = 0, y0: 'int' = 0, x0: 'int' = 0, height: 'int | None' = None, width: 'int | None' = None) -> 'ArrayTile'—provisional· Since0.3.1— Read one bounded rectangular tile from a 2-D plane.series_points(self, ref: 'StorageReference', metadata: 'dict[str, Any]') -> 'SeriesPoints'—provisional· Since0.3.1— Return the complete set of chart points for a Series.text_chunk(self, ref: 'StorageReference') -> 'TextChunk'—provisional· Since0.3.1— Return a bounded chunk of text plus a truncation marker.artifact_metadata(self, ref: 'StorageReference', *, mime_type: 'str | None' = None) -> 'ArtifactInfo'—provisional· Since0.3.1— Return bounded artifact metadata, inlining a small image as a data URI.composite_slots(self, metadata: 'dict[str, Any]') -> 'CompositeSlots'—provisional· Since0.3.1— Return a composite's slot inventory without rendering any child.composite_slot_ref(self, ref: 'StorageReference', slot_name: 'str') -> 'StorageReference | None'—provisional· Since0.3.1— Resolve the storage reference for one slot of a composite target.composite_raster_slot(self, ref: 'StorageReference', slot_name: 'str' = 'raster') -> 'ArrayPlane | None'—provisional· Since0.3.1— Bounded read of a composite's raster slot subdirectory, if present.collection_sample(self, *, count: 'int', item_type: 'str | None', items: 'list[dict[str, Any]]') -> 'CollectionSample'—provisional· Since0.3.1— Return a bounded sample of a collection's item references.
SeriesPoints — class
Stability: provisional · Since 0.3.1
class SeriesPoints
SeriesPoints(points: 'list[dict[str, float]]', total: 'int', truncated: 'bool', nonnumeric: 'int' = 0) -> None
The complete finite set of (x, y) chart points for a Series preview.
Unlike the bounded readers, this returns every plottable point so a line preview and any point export match the stored data exactly.
SliceAxis — class
Stability: provisional · Since 0.3.1
class SliceAxis
SliceAxis(axis: 'int', name: 'str', size: 'int', index: 'int') -> None
One non-displayed (sliced) axis of an N-D array.
For an array with more than two dimensions, every axis that is not the displayed Y or X axis becomes a slider the user can move. This carries what the frontend needs to render one such index picker.
TableXYPoints — class
Stability: provisional · Since 0.3.1
class TableXYPoints
TableXYPoints(columns: 'list[str]', x_column: 'str', y_column: 'str', points: 'list[dict[str, float]]', total: 'int', truncated: 'bool', nonnumeric: 'int') -> None
The complete finite set of (x, y) points from two table columns.
TextChunk — class
Stability: provisional · Since 0.3.1
class TextChunk
TextChunk(content: 'str', truncated: 'bool', total_bytes: 'int', language: 'str') -> None
A bounded chunk of text plus a truncation marker.