ase_notebook.configuration module¶
A module for creating visualisations of a structure.
-
class
ase_notebook.configuration.
MillerPlane
(h: float = 0, k: float = 0, l: float = 0, fill_color: str = 'red', stroke_color: str = 'red', stroke_width: float = 1.0, fill_opacity: float = 0.5, stroke_opacity: float = 0.9)[source]¶ Bases:
object
A data class to define a Miller Plane to visualise.
- Parameters
-
fill_color
¶
-
fill_opacity
¶
-
h
¶
-
k
¶
-
l
¶
-
stroke_color
¶
-
stroke_opacity
¶
-
stroke_width
¶
-
class
ase_notebook.configuration.
ViewConfig
(*, rotations: str = '', element_colors: str = 'ase', element_radii: str = 'ase', radii_scale: float = 0.89, atom_show_label: bool = True, atom_label_by: str = 'element', atom_label_array: str = '', atom_font_size: int = 14, atom_font_color: str = 'black', atom_stroke_width: float = 1.0, atom_stroke_opacity: float = 0.95, atom_color_by: str = 'element', atom_color_array: str = '', atom_colormap: str = 'jet', atom_colormap_range: Union[list, tuple] = (None, None), atom_lighten_by_depth: float = 0.0, atom_opacity: float = 0.95, force_vector_scale: float = 1.0, velocity_vector_scale: float = 1.0, ghost_stroke_width: float = 0.0, ghost_lighten: float = 0.0, ghost_opacity: float = 0.4, ghost_stroke_opacity: float = 0.4, ghost_show_label: bool = False, ghost_cross_out: bool = False, show_unit_cell: bool = True, show_uc_repeats: Union[bool, list] = False, uc_dash_pattern: Union[None, Tuple[float, float]] = None, uc_color: str = 'black', show_bonds: bool = False, bond_radii_scale: float = 1.5, bond_array_name: Optional[str] = None, bond_pairs_filter: Optional[list] = None, bond_opacity: float = 0.8, bond_color_by: str = 'atoms', bond_colormap: str = 'jet', bond_colormap_range: Union[list, tuple] = (None, None), show_miller_planes: bool = True, miller_planes=(), miller_as_lines: bool = False, show_axes: bool = True, axes_uc: bool = False, axes_length: float = 15, axes_font_size: int = 14, axes_line_color: str = 'black', axes_offset: Tuple[float, float] = (20, 20), canvas_size: Tuple[float, float] = (400, 400), canvas_color_foreground: str = '#000000', canvas_color_background: str = '#ffffff', canvas_background_opacity: float = 0.0, canvas_crop: Union[list, tuple, None] = None, zoom: float = 1.0, camera_fov: float = 10.0, gui_swap_mouse: bool = False)[source]¶ Bases:
object
Configuration settings for initialisation of atom visualisations.
- Parameters
rotations (str) – Initial unit cell rotation in string format, e.g. ‘50x,-10y,120z’ (note: order matters) Default: “”
element_colors (str) – Element to color mapping to use, if
atom_color_by='element'
. Default: “ase”element_radii (str) – Element to color mapping to use. Default: “ase”
radii_scale (float) – Scale all radii by this value. Default: 0.89
atom_show_label (bool) – Add atom labels to visualisation. Default: True
atom_label_by (str) – Atom property to label atoms by. Default: “element”
atom_label_array (str) – The array name to use, if
array
chosen foratom_label_by
Default: “”atom_font_size (int) – Font size for atom labels. Default: 14
atom_font_color (str) – Font size for atom labels. Default: “black”
atom_stroke_width (float) – line width for atom outlines. Default: 1.0
atom_stroke_opacity (float) – line opacity for atom outlines. Default: 0.95
atom_color_by (str) – Atom property to color atoms by. Default: “element”
atom_color_array (str) – The array name to use, if
array
chosen foratom_color_by
Default: “”atom_colormap (str) – The matplotlib colormap to use with
atom_color_by
values Default: “jet”atom_colormap_range (list, tuple) – The matplotlib colormap normalisation use with
atom_color_by
values Default: (None, None)atom_lighten_by_depth (float) – Fraction by which to lighten atom colors, based on their fractional distance along the line, from the maximum to minimum z-coordinate of all elements Default: 0.0
atom_opacity (float) – Default: 0.95
force_vector_scale (float) – Length of force vector arrows. Default: 1.0
velocity_vector_scale (float) – Length of velocity vector arrows. Default: 1.0
ghost_stroke_width (float) – Default: 0.0
ghost_lighten (float) – Lighten the ghost atom colors by this fraction. Default: 0.0
ghost_opacity (float) – Default: 0.4
ghost_stroke_opacity (float) – Default: 0.4
ghost_show_label (bool) – Default: False
ghost_cross_out (bool) – Default: False
show_unit_cell (bool) – Default: True
show_uc_repeats (bool, list) – If True, and the atoms have been repeated, show each unit cell of the original atoms. Default: False
uc_dash_pattern (NoneType, Tuple[float, float]) – A (length, gap) dash pattern for unit cell lines. Default: None
uc_color (str) – Unit cell line color. Default: “black”
show_bonds (bool) – Show atomic bonds. Default: False
bond_radii_scale (float) – Factor to scale atomic radii by, when computing bonds (via overlapping radii) Default: 1.5
bond_array_name (str, NoneType) – The name of a boolean array on the Atoms, specifying which atoms that bonds should be drawn for (if None, then all bonds are drawn). Default: None
bond_pairs_filter (list, NoneType) – A list of bond element pairs to filter by, e.g. [(‘Fe’, ‘O’), (‘Fe’, ‘Fe’)]. Default: None
bond_opacity (float) – Opacity of atomic bond lines. Default: 0.8
bond_color_by (str) – How to color bond: ‘atoms’ (same as connecting atoms) or ‘length’. Default: “atoms”
bond_colormap (str) – The matplotlib colormap to use with
bond_color_by='length'
Default: “jet”bond_colormap_range (list, tuple) – The matplotlib colormap normalisation to use with
bond_color_by='length'
Default: (None, None)show_miller_planes (bool) – Default: True
miller_planes (Tuple[dict]) – List of dictionaries, describing miller index planes to create. Default: ()
miller_as_lines (bool) – If True, the miller planes will be created as lines, rather than polygons. Default: False
show_axes (bool) – Show the ‘world’ axes, at a corner of the visualisation. Default: True
axes_uc (bool) – Show the ‘unit cell’ axes (abc), instead of the ‘world’ axes (XYZ) Default: False
axes_length (float) – Length of axes lines. Default: 15
axes_font_size (int) – Default: 14
axes_line_color (str) – Default: “black”
axes_offset (Tuple[float, float]) – Offset of axis origin from the bottom left of the canvas Default: (20, 20)
canvas_color_foreground (str) – Default: “#000000”
canvas_color_background (str) – Default: “#ffffff”
canvas_background_opacity (float) – Default: 0.0
canvas_crop (list, tuple, NoneType) – Crop canvas: (left, right, top, bottom) Default: None
zoom (float) – 3D camera zoom. Default: 1.0
camera_fov (float) – 3D camera field-of-view. Default: 10.0
gui_swap_mouse (bool) – Used with
make_gui
only. Default: False
-
_validate_canvas_crop
(attribute, value)[source]¶ Validate crop is of form (left, right, top, bottom).
-
_validate_uc_dash_pattern
(attribute, value)[source]¶ Validate uc_dash_pattern is of form (solid, gap).
-
atom_color_array
: str = None¶
-
atom_color_by
: str = None¶
-
atom_colormap
: str = None¶
-
atom_colormap_range
: Union[list, tuple] = None¶
-
atom_font_color
: str = None¶
-
atom_font_size
: int = None¶
-
atom_label_array
: str = None¶
-
atom_label_by
: str = None¶
-
atom_lighten_by_depth
: float = None¶
-
atom_opacity
: float = None¶
-
atom_show_label
: bool = None¶
-
atom_stroke_opacity
: float = None¶
-
atom_stroke_width
: float = None¶
-
axes_font_size
: int = None¶
-
axes_length
: float = None¶
-
axes_line_color
: str = None¶
-
axes_offset
: Tuple[float, float] = None¶
-
axes_uc
: bool = None¶
-
bond_array_name
: Optional[str] = None¶
-
bond_color_by
: str = None¶
-
bond_colormap
: str = None¶
-
bond_colormap_range
: Union[list, tuple] = None¶
-
bond_opacity
: float = None¶
-
bond_pairs_filter
: Optional[list] = None¶
-
bond_radii_scale
: float = None¶
-
camera_fov
: float = None¶
-
canvas_background_opacity
: float = None¶
-
canvas_color_background
: str = None¶
-
canvas_color_foreground
: str = None¶
-
canvas_crop
: Union[list, tuple, None] = None¶
-
canvas_size
: Tuple[float, float] = None¶
-
element_colors
: str = None¶
-
element_radii
: str = None¶
-
force_vector_scale
: float = None¶
-
ghost_cross_out
: bool = None¶
-
ghost_lighten
: float = None¶
-
ghost_opacity
: float = None¶
-
ghost_show_label
: bool = None¶
-
ghost_stroke_opacity
: float = None¶
-
ghost_stroke_width
: float = None¶
-
gui_swap_mouse
: bool = None¶
-
miller_as_lines
: bool = None¶
-
miller_planes
: Tuple[dict] = None¶
-
radii_scale
: float = None¶
-
rotations
: str = None¶
-
show_axes
: bool = None¶
-
show_bonds
: bool = None¶
-
show_miller_planes
: bool = None¶
-
show_uc_repeats
: Union[bool, list] = None¶
-
show_unit_cell
: bool = None¶
-
uc_color
: str = None¶
-
uc_dash_pattern
: Union[None, Tuple[float, float]] = None¶
-
velocity_vector_scale
: float = None¶
-
zoom
: float = None¶
-
ase_notebook.configuration.
convert_to_miller_dicts
(iterable)[source]¶ Convert items in a list to MillerPlane validated dictionaries.
-
ase_notebook.configuration.
in_range
(minimum=None, maximum=None, inclusive_min=True)[source]¶ Validate that an attribute value is a number >= 0.