Skip to Content
DocsAPI ReferenceVisualization

Visualization

Инструменты визуализации

from svetlanna.visualization import ...

Классы

StepwiseForwardWidget

Наследует: anywidget.AnyWidget

SpecsWidget

Наследует: anywidget.AnyWidget

ElementHTML

Representation of an element in HTML format.

Функции

default_widget_html_method(index: int, name: str, element_type: str | None, subelements: list[ElementHTML]) -> str

Default _widget_html_ method used for rendering Specsable elements.

📥 Параметры

ПараметрТипОписание
indexintThe unique index of the element. Should be used as an id of HTML element containing the element.
namestrHuman readable name of the element
element_type`strNone`
subelementslist[ElementHTML]Subelements of the element.

📤 Возвращает

str

rendered HTML

generate_structure_html(subelements: list[_ElementInTree]) -> str

Generate HTML for a setup structure.

📥 Параметры

ПараметрТипОписание
subelementslist[_ElementInTree]Elements tree

📤 Возвращает

str

Rendered HTML

show_structure(*specsable: Specsable)

Display a setup structure using IPython’s HTML display. Useful for previewing specs hierarchies in notebooks.

show_specs(*specsable: Specsable) -> SpecsWidget

Display a setup structure with interactive specs preview

📤 Возвращает

SpecsWidget

The widget

draw_wavefront(wavefront: torch.Tensor, simulation_parameters: SimulationParameters, types_to_plot: tuple[StepwisePlotTypes, ...] = ('I', 'phase')) -> bytes

Show field propagation in the setup via widget. Currently only wavefronts of shape (W, H) are supported.

📥 Параметры

ПараметрТипОписание
wavefrontTensorThe Input wavefront
simulation_parametersSimulationParametersSimulation parameters
types_to_plottuple[StepwisePlotTypes, ...], optionalField properties to plot, by default (‘I’, ‘phase’)

📤 Возвращает

bytes

byte-coded image

show_stepwise_forward(*specsable: Specsable) -> StepwiseForwardWidget

Display the wavefront propagation through a setup structure using a widget interface. Currently only wavefronts of shape (W, H) are supported.

📥 Параметры

ПараметрТипОписание
inputtorch.TensorThe Input wavefront
simulation_parametersSimulationParametersSimulation parameters
types_to_plottuple[StepwisePlotTypes, ...], optionalField properties to plot, by default (‘I’, ‘phase’)

📤 Возвращает

StepwiseForwardWidget

The widget