sisl.viz.WavefunctionPlot

class sisl.viz.WavefunctionPlot(eigenstate: EigenstateData, i: int = 0, geometry: Geometry | None = None, grid_prec: float = 0.2, grid: Grid | None = None, axes: Axes = ['z'], represent: Literal['real', 'imag', 'mod', 'phase', 'deg_phase', 'rad_phase'] = 'real', transforms: Sequence[str | Callable] = (), reduce_method: Literal['average', 'sum'] = 'average', boundary_mode: str = 'grid-wrap', nsc: Tuple[int, int, int] = (1, 1, 1), interp: Tuple[int, int, int] = (1, 1, 1), isos: Sequence[dict] = [], smooth: bool = False, colorscale: str | None = None, crange: Tuple[float, float] | None = None, cmid: float | None = None, show_cell: Literal['box', 'axes', False] = 'box', cell_style: dict = {}, x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, z_range: Sequence[float] | None = None, plot_geom: bool = False, geom_kwargs: dict = {}, backend: str = 'plotly')[source]

Bases: GridPlot

Plots a wavefunction in real space.

Parameters:
  • eigenstate (EigenstateData) – The eigenstate object containing information about eigenstates.

  • i (int) – The index of the eigenstate to plot.

  • geometry (Optional[Geometry]) – Geometry to use to project the eigenstate to real space. If None, the geometry associated with the eigenstate is used.

  • grid_prec (float) – The precision of the grid where the wavefunction is projected.

  • grid (Optional[Grid]) – The grid to plot.

  • axes (Axes) – The axes to project the grid to.

  • represent (Literal['real', 'imag', 'mod', 'phase', 'deg_phase', 'rad_phase']) – The representation of the grid to plot.

  • transforms (Sequence[Union[str, Callable]]) – List of transforms to apply to the grid before plotting.

  • reduce_method (Literal['average', 'sum']) – The method used to reduce the grid axes that are not displayed.

  • boundary_mode (str) – The method used to deal with the boundary conditions. Only used if the grid is to be orthogonalized. See scipy docs for more info on the possible values.

  • nsc (Tuple[int, int, int]) – The number of unit cells to display in each direction.

  • interp (Tuple[int, int, int]) – The interpolation factor to use for each axis to make the grid smoother.

  • isos (Sequence[dict]) – List of isosurfaces or isocontours to plot. See the showcase notebooks for examples.

  • smooth (bool) – Whether to ask the plotting backend to make an attempt at smoothing the grid display.

  • colorscale (Optional[str]) – Colorscale to use for the grid display in the 2D representation. If None, the default colorscale is used for each backend.

  • crange (Optional[Tuple[float, float]]) – Min and max values for the colorscale.

  • cmid (Optional[float]) – The value at which the colorscale is centered.

  • show_cell (Literal['box', 'axes', False]) – Method used to display the unit cell. If False, the cell is not displayed.

  • cell_style (dict) – Style specification for the cell. See the showcase notebooks for examples.

  • x_range (Optional[Sequence[float]]) – The range of the x axis to take into account. Even if the X axis is not displayed! This is important because the reducing operation will only be applied on this range.

  • y_range (Optional[Sequence[float]]) – The range of the y axis to take into account. Even if the Y axis is not displayed! This is important because the reducing operation will only be applied on this range.

  • z_range (Optional[Sequence[float]]) – The range of the z axis to take into account. Even if the Z axis is not displayed! This is important because the reducing operation will only be applied on this range.

  • plot_geom (bool) – Whether to plot the associated geometry (if any).

  • geom_kwargs (dict) – Keyword arguments to pass to the geometry plot of the associated geometry.

  • backend (str) – The backend to use to generate the figure.

Return type:

Figure

See also

scipy.ndimage.affine_transform

method used to orthogonalize the grid if needed.

Methods

evaluate_input_node(node)

final_node_key(*args)

Returns the key of the final (output) node of the workflow.

find_node_key(node, *args)

Returns the identifier key of a node in this workflow

from_func([func, context, module])

Builds a node from a function.

from_node_tree(output_node[, workflow_name])

Creates a workflow class from a node.

function(eigenstate[, i, geometry, ...])

Plots a wavefunction in real space.

get()

Returns the up to date output of the workflow.

get_diagram_label()

Returns the label to be used in diagrams when displaying this node.

get_input(key)

get_tree()

is_output_outdated(evaluated_inputs)

Checks if the node needs to be ran

map_inputs(inputs, func[, only_nodes, exclude])

Maps all inputs of the node applying a given function.

merge(*others, **kwargs)

plot_class_key()

recursive_update_inputs([cls])

Updates the inputs of the node recursively.

setup(*args, **kwargs)

Sets up the node based on its initial inputs.

update_inputs(**inputs)

Updates the inputs of the workflow.

update_settings(*args, **kwargs)

DELETE_KWARG

context

default_inputs

dryrun_nodes

inputs

last_log

Last time the logs of this node were updated

network

nodes

logs

DELETE_KWARG = <object object>
__call__(*args, **kwargs)

Call self as a function.

__init__(*args, **kwargs)
context: NodeContext = NodeContext({}, {}, {}, {}, {}, {'lazy': True, 'lazy_init': None, 'log_level': 'INFO', 'raise_custom_errors': False})
property default_inputs
dryrun_nodes: WorkflowNodes = <sisl.nodes.workflow.WorkflowNodes object>
static evaluate_input_node(node: Node)
Parameters:

node (Node)

classmethod final_node_key(*args) str

Returns the key of the final (output) node of the workflow.

Return type:

str

classmethod find_node_key(node, *args) str

Returns the identifier key of a node in this workflow

Return type:

str

classmethod from_func(func: Callable | None = None, context: dict | None = None, module: str | None = None)

Builds a node from a function.

Parameters:
  • func (function, optional) –

    The function to be converted to a node.

    If not provided, the return of this method is just a lambda function that expects the function. This is useful if you want to use this method as a decorator while also providing extra arguments (like the context argument).

  • context (dict, optional) – The context to be used as the default for the node class that will be created.

  • module (str | None)

classmethod from_node_tree(output_node: Node, workflow_name: str | None = None)

Creates a workflow class from a node.

It does so by recursively traversing the tree in the inputs direction until it finds the leaves. All the nodes found are included in the workflow. For each node, inputs that are not nodes are connected to the inputs of the workflow.

Parameters:
  • output_node (Node) – The final node, that should be connected to the output of the workflow.

  • workflow_name (str, optional) – The name of the new workflow class. If None, the name of the output node will be used.

Returns:

The newly created workflow class.

Return type:

Workflow

static function(eigenstate: EigenstateData, i: int = 0, geometry: Geometry | None = None, grid_prec: float = 0.2, grid: Grid | None = None, axes: Sequence[Literal['x', 'y', 'z', '-x', '-y', '-z', 'a', 'b', 'c', '-a', '-b', '-c'] | Sequence[float]] = ['z'], represent: Literal['real', 'imag', 'mod', 'phase', 'deg_phase', 'rad_phase'] = 'real', transforms: Sequence[str | Callable] = (), reduce_method: Literal['average', 'sum'] = 'average', boundary_mode: str = 'grid-wrap', nsc: Tuple[int, int, int] = (1, 1, 1), interp: Tuple[int, int, int] = (1, 1, 1), isos: Sequence[dict] = [], smooth: bool = False, colorscale: str | None = None, crange: Tuple[float, float] | None = None, cmid: float | None = None, show_cell: Literal['box', 'axes', False] = 'box', cell_style: dict = {}, x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, z_range: Sequence[float] | None = None, plot_geom: bool = False, geom_kwargs: dict = {}, backend: str = 'plotly') Figure

Plots a wavefunction in real space.

Parameters:
  • eigenstate (EigenstateData) – The eigenstate object containing information about eigenstates.

  • i (int) – The index of the eigenstate to plot.

  • geometry (Geometry | None) – Geometry to use to project the eigenstate to real space. If None, the geometry associated with the eigenstate is used.

  • grid_prec (float) – The precision of the grid where the wavefunction is projected.

  • grid (Grid | None) – The grid to plot.

  • axes (Sequence[Literal['x', 'y', 'z', '-x', '-y', '-z', 'a', 'b', 'c', '-a', '-b', '-c'] | ~typing.Sequence[float]]) – The axes to project the grid to.

  • represent (Literal['real', 'imag', 'mod', 'phase', 'deg_phase', 'rad_phase']) – The representation of the grid to plot.

  • transforms (Sequence[str | Callable]) – List of transforms to apply to the grid before plotting.

  • reduce_method (Literal['average', 'sum']) – The method used to reduce the grid axes that are not displayed.

  • boundary_mode (str) – The method used to deal with the boundary conditions. Only used if the grid is to be orthogonalized. See scipy docs for more info on the possible values.

  • nsc (Tuple[int, int, int]) – The number of unit cells to display in each direction.

  • interp (Tuple[int, int, int]) – The interpolation factor to use for each axis to make the grid smoother.

  • isos (Sequence[dict]) – List of isosurfaces or isocontours to plot. See the showcase notebooks for examples.

  • smooth (bool) – Whether to ask the plotting backend to make an attempt at smoothing the grid display.

  • colorscale (str | None) – Colorscale to use for the grid display in the 2D representation. If None, the default colorscale is used for each backend.

  • crange (Tuple[float, float] | None) – Min and max values for the colorscale.

  • cmid (float | None) – The value at which the colorscale is centered.

  • show_cell (Literal['box', 'axes', False]) – Method used to display the unit cell. If False, the cell is not displayed.

  • cell_style (dict) – Style specification for the cell. See the showcase notebooks for examples.

  • x_range (Sequence[float] | None) – The range of the x axis to take into account. Even if the X axis is not displayed! This is important because the reducing operation will only be applied on this range.

  • y_range (Sequence[float] | None) – The range of the y axis to take into account. Even if the Y axis is not displayed! This is important because the reducing operation will only be applied on this range.

  • z_range (Sequence[float] | None) – The range of the z axis to take into account. Even if the Z axis is not displayed! This is important because the reducing operation will only be applied on this range.

  • plot_geom (bool) – Whether to plot the associated geometry (if any).

  • geom_kwargs (dict) – Keyword arguments to pass to the geometry plot of the associated geometry.

  • backend (str) – The backend to use to generate the figure.

Return type:

Figure

See also

scipy.ndimage.affine_transform

method used to orthogonalize the grid if needed.

get()

Returns the up to date output of the workflow.

It will recompute it if necessary.

get_diagram_label()

Returns the label to be used in diagrams when displaying this node.

get_input(key: str)
Parameters:

key (str)

get_tree()
property inputs
is_output_outdated(evaluated_inputs: Dict[str, Any])

Checks if the node needs to be ran

Parameters:

evaluated_inputs (Dict[str, Any])

property last_log: float

Last time the logs of this node were updated

logs: str
map_inputs(inputs: Dict[str, Any], func: Callable, only_nodes: bool = False, exclude: Sequence[str] = ()) Dict[str, Any]

Maps all inputs of the node applying a given function.

It considers the args and kwargs keys.

Parameters:
  • inputs (Dict[str, Any]) – The inputs of the node.

  • func (Callable) – The function to apply to each value.

  • only_nodes (bool, optional) – Whether to apply the function only to nodes, by default False.

  • exclude (Sequence[str], optional) – The keys to exclude from the mapping. This means that these keys are returned as they are.

Return type:

Dict[str, Any]

merge(*others, **kwargs)
network = <sisl.nodes.workflow.Network object>
nodes: WorkflowNodes
classmethod plot_class_key() str
Return type:

str

recursive_update_inputs(cls: Type | Tuple[Type, ...] | None = None, **inputs)

Updates the inputs of the node recursively.

This method updates the inputs of the node and all its children.

Parameters:
  • cls (Optional[Union[Type, Tuple[Type, ...]]], optional) – Only update nodes of this class. If None, update all nodes.

  • inputs (Dict[str, Any]) – The inputs to update.

setup(*args, **kwargs)

Sets up the node based on its initial inputs.

update_inputs(**inputs)

Updates the inputs of the workflow.

update_settings(*args, **kwargs)