qtcad.device.analysis module

Functions to plot and save simulation outputs.

qtcad.device.analysis.analyze_dot(dvc, verbose=False)

Gets the average position and size of the probability distribution of an electron or hole in a quantum dot.

Parameters:
  • dvc (Device or SubDevice) – A Device or SubDevice object on which the single-particle Schrödinger’s equation has been solved.

  • verbose (bool, optional) – If True, print the dot properties.

Returns:

dict – A dictionary containing the following entries: “position”, a 1D array containing the average xyz coordinates of the dot (defined as the average position of the particle in its ground state); “std”, a 1D array containing the standard deviation \(\sigma\) of the particle probability density in the dot ground state in each Cartesian direction; and “size”, a 1D array containing the dot size in each direction, defined as four times the standard deviation sigma (\(\pm 2\sigma\)) in each direction.

Note

It is strongly recommended to first plot the eigenstates of the quantum dot being analyzed here to make sure that these eigenstates are bound.

qtcad.device.analysis.get_slices(mesh, array, title='untitled', x=None, y=None, z=None, path=None, length_unit='nm')

Produce slices in xy, yz, or zx plane.

Parameters:
  • mesh (mesh object) – The mesh over which data is defined.

  • array (list of 1d arrays) – The arrays to save.

  • title (str, optional) – Title of the slices.

  • x (float or None, optional) – Position of the slice perpendicular to the x axis.

  • y (float or None, optional) – Position of the slice perpendicular to the y axis.

  • z (float or None, optional) – Position of the slice perpendicular to the z axis.

  • path (str or None, optional) – If not None, path of the vtu file in which to save the pyvista grids.

  • length_unit (str) – Units of length to use when exporting into vtu format. Default: “nm”. Other choices are: “um”, “mm”, and “m”.

Returns:

pyvista grid, or list of pyvista grid – The slices.

Note

If no xyz coordinate is specified, slices are taken at the middle of each axis. Otherwise, a slice is shown for each axis whose coordinate is specified.

qtcad.device.analysis.linecut(mesh, array, begin, end, method='default', res=500, array_name='Untitled quantity')

Produce linecut for some array quantity defined over mesh nodes.

Parameters:
  • mesh (mesh object) – The mesh over which data is defined.

  • array (list of 1d arrays) – The array for which to calculate the linecut.

  • begin (tuple) – xyz coordinates of the first point along the linecut

  • end (tuple) – xyz coordinats of the last point along the linecut

  • method (string, optional) – linecutting method. For 3D can be “default” or “pyvista” (default is “default”). For 2D, is is ignored, and the “pyvista” method is used.

  • res (int, optional) – number of points over which to interpolate. Default: 500. Only used by PyVista linecutter.

  • array_name (str, optional) – name of the array to consider (3D only).

Returns:

tuple – a tuple (d, v) where d is a 1d array containing distance along linecut and v in a 1d array containing values of the attribute

qtcad.device.analysis.plot(mesh, array, scaling=1.0, title=None, cmap='jet', show_mesh=False, cb_axis_label=None, ylabel='y', path=None, show_figure=True, length_unit='nm')

Plot on the surface of a mesh.

Parameters:
  • mesh (Mesh object) – The mesh to plot.

  • array (1d or 2d array) – The variable to plot at global or local nodes

  • scaling (float, optional) – Prefactor by which to multiply the attribute, e.g. for unit conversion. Default: 1.

  • title (str, optional) – Title of the plot. If None, uses the name of the attribute. Default: None.

  • cmap (str, optional) – The matplotlib colormap to use. Default: ‘jet’.

  • show_mesh (bool, optional) – If true, display the mesh in addition to the data (2D only). Default: False.

  • cb_axis_label (str, optional) – Label of the colorbar (2D only).

  • ylabel (str, optional) – Label of the y axis (1D only). Default: “y”.

  • path (str, optional) – String for the path in which the plot is saved in .png format, or None. If None, no file is saved. Default: None.

  • show_figure (bool, optional) – Whether figure should be shown. Default: True.

  • length_unit (str, optional) – Units of length to use (1D and 2D only). Default: “nm”. Other choices are: “um”, “mm”, and “m”.

qtcad.device.analysis.plot_bands(device, begin=None, end=None, method='default', res=500, title='Band diagram', path=None, show_figure=True, length_unit='nm')

Produce band diagram along some linecut.

Parameters:
  • device (device object) – The device to plot.

  • begin (tuple, optional) – xyz coordinates of the first point along the linecut. Mandatory in 2d or 3d, unused in 1d.

  • end (tuple, optional) – xyz coordinats of the last point along the linecut. Mandatory in 2d or 3d, unused in 1d.

  • method (string, optional) – linecutting method. Can be “default” or “pyvista”.

  • res (int, optional) – number of points over which to interpolate. Default: 500. Only used by PyVista linecutter.

  • title (str, optional) – Title of the plot

  • path (str, optional) – String for the path in which the plot is saved in .png format, or None. If None, no file is saved. Default: None.

  • show_figure (bool, optional) – Whether figure should be shown. Default: True.

  • length_unit (str) – Units of length to use. Default: “nm”. Other choices are: “um”, “mm”, and “m”.

qtcad.device.analysis.plot_linecut(mesh, array, begin, end, method='default', res=500, title='Untitled', ylabel='y', path=None, show_figure=True, length_unit='nm')

Produce linecut for some array quantity defined over mesh nodes and plot it.

Parameters:
  • mesh (mesh object) – The mesh over which data is defined.

  • array (1d array) – The array to plot.

  • begin (tuple) – xyz coordinates of the first point along the linecut

  • end (tuple) – xyz coordinats of the last point along the linecut

  • method (string, optional) – linecutting method. For 3D can be “default” or “pyvista” (default is “default”). For 2D, is is ignored, and the “pyvista” method is used.

  • res (int, optional) – number of points over which to interpolate. Default: 500. Only used by PyVista linecutter.

  • title (str, optional) – Name of the linecut.

  • ylabel (str, optional) – Label of the y axis.

  • path (str, optional) – String for the path in which the plot is saved in .png format, or None. If None, no file is saved. Default: None.

  • show_figure (bool, optional) – Whether figure should be shown. Default: True.

  • length_unit (str) – Units of length to use. Default: “nm”. Other choices are: “um”, “mm”, and “m”.

Returns:

tuple – a tuple (d, v) where d is a 1d array containing distance along linecut and v in a 1d array containing values of the attribute

qtcad.device.analysis.plot_slices(mesh, array, x=None, y=None, z=None, cmap='jet', title='untitled plot', path=None, show_grid=False, show_figure=True, length_unit='nm')

3D density plot of an array defined over a mesh on orthogonal slices inside the mesh.

Parameters:
  • mesh (mesh object) – The mesh over which data is defined.

  • array (list of 1d arrays) – The arrays to save.

  • x (float or None) – Position of the slice perpendicular to the x axis.

  • y (float or None) – Position of the slice perpendicular to the y axis.

  • z (float or None) – Position of the slice perpendicular to the z axis.

  • cmap (str, optional) – The matplotlib colormap to use.

  • title (str, optional) – Title of the plot.

  • path (str, optional) – String for the path in which the plot is saved in .png format, or None. If None, no file is saved.

  • show_grid (bool, optional) – Whether to show axes grid or not.

  • show_figure (bool, optional) – Whether figure should be shown.

  • length_unit (str) – Units of length to use in the output vtu file, if any. Choices are: “nm”, “um”, “mm”, and “m”.

Note

If no xyz coordinate is specified, slices are taken at the middle of each axis. Otherwise, a slice is shown for each axis whose coordinate is specified. Length units are only used in the output vtu files; for determining the slice positions, SI units are assumed.

qtcad.device.analysis.save_linecut(path, mesh, arrays, begin, end, method='default', res=500, array_names=None, length_unit='nm')

Produce linecuts for some array quantities defined over mesh nodes and save them.

Parameters:
  • path (str) – The path to the text file.

  • arrays (list of 1d arrays or dict_values) – The arrays to save.

  • begin (tuple) – xyz coordinates of the first point along the linecut

  • end (tuple) – xyz coordinats of the last point along the linecut

  • method (string, optional) – linecutting method. For 3D can be “default” or “pyvista” (default is “default”). For 2D it is ignored.

  • res (int, optional) – number of points over which to interpolate. Default: 500. Only used by PyVista linecutter.

  • array_names (list of str or dict_keys, optional) – The names of the arrays to save.

  • length_unit (str) – Units of length to use. Default: “nm”. Other choices are: “um”, “mm”, and “m”.

qtcad.device.analysis.save_mesh_arrays(path, mesh, arrays, array_names=None, format=None)

Saves a list of arrays defined on mesh nodes into a text file.

Parameters:
  • path (str) – The path to the text file.

  • mesh (mesh object) – The mesh over which data is defined.

  • arrays (list of arrays) – The arrays to save. All arrays must have the same dimensions.

  • array_names (list of str, optional) – The names of the arrays to save.

  • format (str, optional) – if not specified, data will be separated by spaces. If “csv”, data will be separated by commas.