sisl.viz.GeometryPlot
- class sisl.viz.GeometryPlot(geometry: Geometry, axes: Axes = ['x', 'y', 'z'], atoms: AtomsIndex = None, atoms_style: Sequence[AtomsStyleSpec] = [], atoms_scale: float = 1.0, atoms_colorscale: Colorscale | None = None, drawing_mode: Literal['scatter', 'balls', None] = None, bind_bonds_to_ats: bool = True, points_per_bond: int = 20, bonds_style: StyleSpec = {}, bonds_scale: float = 1.0, bonds_colorscale: Colorscale | None = None, show_atoms: bool = True, show_bonds: bool = True, show_cell: Literal['box', 'axes', False] = 'box', cell_style: StyleSpec = {}, nsc: tuple[int, int, int] = (1, 1, 1), atoms_ndim_scale: tuple[float, float, float] = (16, 16, 1), bonds_ndim_scale: tuple[float, float, float] = (1, 1, 10), dataaxis_1d: np.ndarray | Callable | None = None, arrows: Sequence[AtomArrowSpec] = (), backend='plotly')[source]
Bases:
Plot
Plots a geometry structure, with plentiful of customization options.
- Parameters:
geometry – The geometry to plot.
axes – The axes to project the geometry to.
atoms – The atoms to plot. If None, all atoms are plotted.
atoms_style – List of style specifications for the atoms. See the showcase notebooks for examples.
atoms_scale – Scaling factor for the size of all atoms.
atoms_colorscale – Colorscale to use for the atoms in case the color attribute is an array of values. If None, the default colorscale is used for each backend.
drawing_mode – The method used to draw the atoms.
bind_bonds_to_ats – Whether to display only bonds between atoms that are being displayed.
points_per_bond – When the points are drawn using points instead of lines (e.g. in some frameworks to draw multicolor bonds), the number of points used per bond.
bonds_style – Style specification for the bonds. See the showcase notebooks for examples.
bonds_scale – Scaling factor for the width of all bonds.
bonds_colorscale – Colorscale to use for the bonds in case the color attribute is an array of values. If None, the default colorscale is used for each backend.
show_atoms – Whether to display the atoms.
show_bonds – Whether to display the bonds.
show_cell – Mode to display the cell. If False, the cell is not displayed.
cell_style – Style specification for the cell. See the showcase notebooks for examples.
nsc – Number of unit cells to display in each direction.
atoms_ndim_scale – Scaling factor for the size of the atoms for different dimensionalities (1D, 2D, 3D).
bonds_ndim_scale – Scaling factor for the width of the bonds for different dimensionalities (1D, 2D, 3D).
dataaxis_1d – Only meaningful for 1D plots. The data to plot on the Y axis.
arrows – List of arrow specifications to display. See the showcase notebooks for examples.
backend – The backend to use to generate the figure.
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
(geometry[, axes, atoms, ...])Plots a geometry structure, with plentiful of customization options.
get
()Returns the up to date output of the workflow.
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)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)Attributes
Last time the logs of this node were updated
- __call__(*args, **kwargs)
Call self as a function.
- static evaluate_input_node(node: Node)
- 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.
- 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:
Workflow
– The newly created workflow class.
- static function(geometry: Geometry, axes: Sequence[Literal['x', 'y', 'z', '-x', '-y', '-z', 'a', 'b', 'c', '-a', '-b', '-c'] | Sequence[float]] = ['x', 'y', 'z'], atoms: sisl.typing.AtomsIndex = None, atoms_style: Sequence[AtomsStyleSpec] = [], atoms_scale: float = 1.0, atoms_colorscale: str | Sequence[Color] | Sequence[tuple[float, Color]] | None = None, drawing_mode: Literal['scatter', 'balls', None] = None, bind_bonds_to_ats: bool = True, points_per_bond: int = 20, bonds_style: StyleSpec = {}, bonds_scale: float = 1.0, bonds_colorscale: str | Sequence[Color] | Sequence[tuple[float, Color]] | None = None, show_atoms: bool = True, show_bonds: bool = True, show_cell: Literal['box', 'axes', False] = 'box', cell_style: StyleSpec = {}, nsc: tuple[int, int, int] = (1, 1, 1), atoms_ndim_scale: tuple[float, float, float] = (16, 16, 1), bonds_ndim_scale: tuple[float, float, float] = (1, 1, 10), dataaxis_1d: ndarray | Callable | None = None, arrows: Sequence[AtomArrowSpec] = (), backend='plotly') Figure
Plots a geometry structure, with plentiful of customization options.
- Parameters:
geometry – The geometry to plot.
axes – The axes to project the geometry to.
atoms – The atoms to plot. If None, all atoms are plotted.
atoms_style – List of style specifications for the atoms. See the showcase notebooks for examples.
atoms_scale – Scaling factor for the size of all atoms.
atoms_colorscale – Colorscale to use for the atoms in case the color attribute is an array of values. If None, the default colorscale is used for each backend.
drawing_mode – The method used to draw the atoms.
bind_bonds_to_ats – Whether to display only bonds between atoms that are being displayed.
points_per_bond – When the points are drawn using points instead of lines (e.g. in some frameworks to draw multicolor bonds), the number of points used per bond.
bonds_style – Style specification for the bonds. See the showcase notebooks for examples.
bonds_scale – Scaling factor for the width of all bonds.
bonds_colorscale – Colorscale to use for the bonds in case the color attribute is an array of values. If None, the default colorscale is used for each backend.
show_atoms – Whether to display the atoms.
show_bonds – Whether to display the bonds.
show_cell – Mode to display the cell. If False, the cell is not displayed.
cell_style – Style specification for the cell. See the showcase notebooks for examples.
nsc – Number of unit cells to display in each direction.
atoms_ndim_scale – Scaling factor for the size of the atoms for different dimensionalities (1D, 2D, 3D).
bonds_ndim_scale – Scaling factor for the width of the bonds for different dimensionalities (1D, 2D, 3D).
dataaxis_1d – Only meaningful for 1D plots. The data to plot on the Y axis.
arrows – List of arrow specifications to display. See the showcase notebooks for examples.
backend – The backend to use to generate the figure.
- 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_tree()
- 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.
- merge(*others, **kwargs)
- recursive_update_inputs(cls: Type | Tuple[Type, ...] | None = None, **inputs)
Updates the inputs of the node recursively.
This method updates the inputs of get 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)
- DELETE_KWARG = <object object>
- context: NodeContext = NodeContext({}, {}, {}, {}, {'lazy': True, 'lazy_init': None, 'log_level': 'INFO', 'raise_custom_errors': False, 'on_init': None, 'batch_iter': 'zip'})
- property default_inputs
- dryrun_nodes: WorkflowNodes = <nodify.workflow.WorkflowNodes object>
- property geometry
- property inputs
- network = <nodify.workflow.Network object>
- nodes: WorkflowNodes