GammaSurface

class atomman.defect.GammaSurface(model: str | IOBase | DataModelDict | None = None, a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a1: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, E_gsf: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, box: Box | None = None, delta: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None)

Bases: object

Class for representing gamma surfaces, i.e., generalized stacking faults.

E_gsf(**kwargs) float | ndarray

Returns values for generalized stacking fault energy interpolated from the raw data. Values can be obtained relative to a1, a2 fractional coordinates, x, y plotting coordinates, or pos Cartesian coordinates.

Parameters:
  • a1 (array-like object, optional) – Fractional coordinate(s) along a1vect.

  • a2 (array-like object, optional) – Fractional coordinate(s) along a2vect.

  • pos (array-like object, optional) – 3D Cartesian position vector(s).

  • x (array-like object, optional) – Plotting x coordinate(s).

  • y (array-like object, optional) – Plotting y coordinate(s).

  • a1vect (array-like object, optional) – Vector for the a1 fractional coordinates. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Vector for the a2 fractional coordinates. Default value of None uses the saved a2vect.

  • xvect (array-like object, optional) – Cartesian vector corresponding to the plotting x-axis. If None (default), this is taken as the Cartesian of a1vect.

  • smooth (bool, optional) – If True (default) the returned values are smoothed using a RBF fit. If False, the closest measured values are returned.

Returns:

The generalized stacking fault energy value(s).

Return type:

float or np.ndarray

E_gsf_line_plot(vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, num: int = None, smooth: bool = True, length_unit: str = 'Å', energyperarea_unit: str = 'eV/Å^2', figsize: tuple | None = None, fig: figure | None = None, **kwargs) figure

Generates a line plot for the interpolated generalized stacking fault energy along a specified crystallographic vector in the (a1, a2) plane.

Parameters:
  • vect (numpy.array, optional) – Vector to plot the gsf along. If box is set, this vect will be a lattice vector, otherwise it will be a Cartesian vector. Must be in the plane defined by the GammaSurface object’s a1vect and a2vect vectors. Default value will use the set a1vect.

  • num (int, optional) – The number of points to evaluate the generalized stacking fault energy for. Default value is 100 if smooth is True, otherwise is number of unique a1 values from 0 to 1.

  • smooth (bool, optional) – If True (default), then plot shows smooth interpolated values. If False, plot shows nearest raw data values.

  • length_unit (str, optional) – The unit of length to display the x-axis coordinates in. Default value is ‘Å’.

  • energyperarea_unit (str, optional) – The unit of energy per area to display the stacking fault energies in. Default value is ‘eV/Å^2’.

  • figsize (tuple, optional) – The x,y size of the figure to return. Default value is (10, 6).

  • fig (matplotlib.figure, optional) – An existing figure object to add the new plot to. If not given, a new figure is generated.

  • **kwargs (dict, optional) – Additional keywords are passed into the underlying matplotlib.pyplot.plot(). This allows control of such things like line color, style, etc.

Return type:

matplotlib.figure

E_gsf_surface_plot(normalize: bool = False, smooth: bool = True, a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, xvect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, length_unit: str = 'Å', energyperarea_unit: str = 'eV/Å^2', numx: int = 100, numy: int = 100, figsize: tuple | None = None, **kwargs) figure

Creates a 2D surface plot from the stacking fault energy values.

Parameters:
  • normalize (bool, optional) – Flag indicating if axes are Cartesian (False, default) or normalized by a1, a2 vectors (True).

  • smooth (bool, optional) – If True (default), then plot shows smooth interpolated values. If False, plot shows nearest raw data values.

  • a1vect (np.array, optional) – Crystal vector for the a1 vector to use for plotting. Default value of None uses the saved a1vect.

  • a2vect (np.array, optional) – Crystal vector for the a2 vector to use for plotting. Default value of None uses the saved a2vect.

  • xvect (numpy.array, optional) – Crystal vector to align with the plotting x-axis for non-normalized plots. If not given, this is taken as the Cartesian of a1vect.

  • length_unit (str, optional) – The unit of length to display non-normalized axes values in. Default value is ‘Å’.

  • energyperarea_unit (str, optional) – The unit of energy per area to display the stacking fault energies in. Default value is ‘eV/Å^2’.

  • numx (int, optional) – The number of plotting points to use along the x-axis. Default value is 100.

  • numy (int, optional) – The number of plotting points to use along the y-axis. Default value is 100.

  • figsize (tuple or None, optional) – The figure’s x,y dimensions. If None (default), the values are scaled such that the x,y spacings are approximately equal, and the larger of the two values is set to 10.

  • **kwargs (dict, optional) – Additional keywords are passed into the underlying matplotlib.pyplot.pcolormesh(). This allows control of such things like the colormap (cmap).

Return type:

matplotlib.figure

a12_to_pos(a1: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a2: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) ndarray

Conversion function from normalized a1, a2 coordinates to Cartesian positions.

Parameters:
  • a1 (array-like object) – Fractional distance(s) along a1 vector.

  • a2 (array-like object) – Fractional distance(s) along a2 vector.

  • a1vect (array-like object, optional) – Crystal vector for the a1 vector. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Crystal vector for the a2 vector. Default value of None uses the saved a2vect.

Returns:

3D Cartesian position vector(s).

Return type:

np.array

a12_to_xy(a1: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a2: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, xvect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) Tuple[float, float] | Tuple[ndarray, ndarray]

Conversion function from normalized a1, a2 coordinates to plotting x, y coordinates.

Parameters:
  • a1 (array-like object) – Fractional distance(s) along a1 vector.

  • a2 (array-like object) – Fractional distance(s) along a2 vector.

  • a1vect (array-like object, optional) – Crystal vector for the a1 vector. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Crystal vector for the a2 vector. Default value of None uses the saved a2vect.

  • xvect (array-like object, optional) – Cartesian vector corresponding to the plotting x-axis. If None (default), this is taken as the Cartesian of a1vect.

Returns:

  • x (float or numpy.ndarray) – Plotting x coordinate(s).

  • y (float or numpy.ndarray) – Plotting y coordinate(s).

property a1vect: ndarray

The a1 shifting vector.

Type:

numpy.ndarray

property a2vect: ndarray

The a2 shifting vector.

Type:

numpy.ndarray

property box: Box

A unit cell box used for converting between crystal lattice and Cartesian vectors.

Type:

atomman.Box

build_path(pos: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], npoints: int = 31, style: str = 'ISM', gradientfxn: str = 'cdiff', gradientkwargs: dict | None = None, integratorfxn: str = 'rk') BasePath

Builds a subclass of atomman.mep.BasePath as one or two line segments along a gamma surface. The energy function along the path will be properly set using E_gsf.

Parameters:
  • pos (array-like object) – 2x3 or 3x3 array of Miller vector points that defines the end points of the path’s line segment(s).

  • npoints (int, optional) – The number of points to include along the path. Must be odd if three pos are used. Default value is 31.

  • style (str) – The path/relaxer style to use. Default value of ‘ISM’ will use improved string method.

  • gradientfxn (function, optional) – The function to use to estimate the gradient of the energy. Default value of ‘cdiff’ will use atomman.mep.gradient.central_difference

  • gradientkwargs (dict or None, optional) – The keyword arguments (i.e. settings) to use with the gradientfxn. Default value of None will use {‘shift’:1e-7}.

  • integratorfxn (str or function, optional) – The function to use to integrate relaxation steps. Default value of ‘rk’ will use atomman.mep.integrator.rungekutta.

Returns:

Specific class dictated by style: style==’ISM’ -> ISMPath (only style currently).

Return type:

subclass of atomman.mep.BasePath

property data: DataFrame

The raw data.

Type:

pandas.DataFrame

delta(**kwargs) float | ndarray

Returns values for generalized stacking fault relaxation distance interpolated from the raw data. Values can be obtained relative to a1, a2 fractional coordinates, x, y plotting coordinates, or pos Cartesian coordinates.

Parameters:
  • a1 (array-like object, optional) – Fractional coordinate(s) along a1vect.

  • a2 (array-like object, optional) – Fractional coordinate(s) along a2vect.

  • pos (array-like object, optional) – 3D Cartesian position vector(s).

  • x (array-like object, optional) – Plotting x coordinate(s).

  • y (array-like object, optional) – Plotting y coordinate(s).

  • a1vect (array-like object, optional) – Vector for the a1 fractional coordinates. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Vector for the a2 fractional coordinates. Default value of None uses the saved a2vect.

  • xvect (array-like object, optional) – Cartesian vector corresponding to the plotting x-axis. If None (default), this is taken as the Cartesian of a1vect.

  • smooth (bool, optional) – If True (default) the returned values are smoothed using a RBF fit. If False, the closest measured values are returned.

Returns:

The generalized stacking fault planar shift value(s).

Return type:

float or np.ndarray

delta_line_plot(vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, num: int | None = None, smooth: bool = True, length_unit: str = 'Å', figsize: tuple | None = None, fig: figure | None = None, **kwargs) figure

Generates a line plot for the interpolated delta planar shift values along a specified crystallographic vector in the (a1, a2) plane.

Parameters:
  • vect (numpy.array, optional) – Vector to plot the gsf along. If box is set, this vect will be a lattice vector, otherwise it will be a Cartesian vector. Must be in the plane defined by the GammaSurface object’s a1vect and a2vect vectors. Default value will use the set a1vect.

  • num (int, optional) – The number of points to evaluate the generalized stacking fault energy for. Default value is 100 if smooth is True, otherwise is number of unique a1 values from 0 to 1.

  • smooth (bool, optional) – If True (default), then plot shows smooth interpolated values. If False, plot shows nearest raw data values.

  • length_unit (str, optional) – The unit of length to display the x-axis coordinates in. Default value is ‘Å’.

  • figsize (tuple, optional) – The x,y size of the figure to return. Default value is (10, 6).

  • fig (matplotlib.figure, optional) – An existing figure object to add the new plot to. If not given, a new figure is generated.

  • **kwargs (dict, optional) – Additional keywords are passed into the underlying matplotlib.pyplot.plot(). This allows control of such things like line color, style, etc.

Return type:

matplotlib.figure

delta_surface_plot(normalize: bool = False, smooth: bool = True, a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, xvect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, length_unit: str = 'Å', numx: int = 100, numy: int = 100, figsize: tuple | None = None, **kwargs) figure

Creates a 2D surface plot from the delta planar displacement values.

Parameters:
  • normalize (bool, optional) – Flag indicating if axes are Cartesian (False, default) or normalized by a1, a2 vectors (True).

  • smooth (bool, optional) – If True (default), then plot shows smooth interpolated values. If False, plot shows nearest raw data values.

  • a1vect (np.array, optional) – Crystal vector for the a1 vector to use for plotting. Default value of None uses the saved a1vect.

  • a2vect (np.array, optional) – Crystal vector for the a2 vector to use for plotting. Default value of None uses the saved a2vect.

  • xvect (numpy.array, optional) – Crystal vector to align with the plotting x-axis for non-normalized plots. If not given, this is taken as the Cartesian of a1vect.

  • length_unit (str, optional) – The unit of length to display delta and non-normalized axes values in. Default value is ‘Å’.

  • numx (int, optional) – The number of plotting points to use along the x-axis. Default value is 100.

  • numy (int, optional) – The number of plotting points to use along the y-axis. Default value is 100.

  • figsize (tuple or None, optional) – The figure’s x,y dimensions. If None (default), the values are scaled such that the x,y spacings are approximately equal, and the larger of the two values is set to 10.

  • **kwargs (dict, optional) – Additional keywords are passed into the underlying matplotlib.pyplot.pcolormesh(). This allows control of such things like the colormap (cmap).

Return type:

matplotlib.figure

fit()

Defines the interpolation functions from the raw data.

model(model: str | IOBase | DataModelDict | None = None, length_unit: str = 'angstrom', energyperarea_unit: str = 'mJ/m^2') DataModelDict | None

Return or set DataModelDict representation of the gamma surface.

Parameters:
  • model (str, file-like object or DataModelDict, optional) – XML/JSON content to extract gamma surface energy from. If not given, model content will be generated.

  • length_unit (str, optional) – Units to report delta displacement values in when a new model is generated. Default value is ‘angstrom’.

  • energyperarea_unit (str, optional) – Units to report fault energy values in when a new model is generated. Default value is ‘mJ/m^2’.

Returns:

A dictionary containing the stacking fault data of the GammaSurface object. Returned if model is not given.

Return type:

DataModelDict

path(coord: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], style: str = 'ISM', gradientfxn: str = 'cdiff', gradientkwargs: dict | None = None, integratorfxn: str = 'rk') BasePath

Creates an mep Path object mapping for the gamma surface based on supplied xy coordinates along the path line.

Parameters:
  • coord (array-like object) – The xy coordinates of the points along the path.

  • style (str) – The path/relaxer style to use. Default value of ‘ISM’ will use improved string method.

  • gradientfxn (function, optional) – The function to use to estimate the gradient of the energy. Default value of ‘cdiff’ will use atomman.mep.gradient.central_difference

  • gradientkwargs (dict or None, optional) – The keyword arguments (i.e. settings) to use with the gradientfxn. Default value of None will use {‘shift’:1e-7}.

  • integratorfxn (str or function, optional) – The function to use to integrate relaxation steps. Default value of ‘rk’ will use atomman.mep.integrator.rungekutta.

Returns:

Specific class dictated by style: style==’ISM’ -> ISMPath (only style currently).

Return type:

subclass of atomman.mep.BasePath

property planenormal: ndarray

The Cartesian vector normal to the fault plane.

Type:

numpy.ndarray

pos_to_a12(pos: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) Tuple[float, float] | Tuple[ndarray, ndarray]

Conversion function from Cartesian positions to normalized a1, a2 coordinates.

Parameters:
  • pos (array-like object) – 3D Cartesian position vector(s).

  • a1vect (array-like object, optional) – Crystal vector for the a1 vector. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Crystal vector for the a2 vector. Default value of None uses the saved a2vect.

Returns:

  • a1 (float(s)) – Fractional distance(s) along a1 vector.

  • a2 (float(s)) – Fractional distance(s) along a2 vector.

pos_to_xy(pos: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], xvect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) Tuple[float, float] | Tuple[ndarray, ndarray]

Conversion function from Cartesian positions to plotting x, y coordinates.

Parameters:
  • pos (array-like object) – 3D Cartesian position vector(s).

  • xvect (array-like object, optional) – Cartesian vector corresponding to the plotting x-axis. If None (default), this is taken as the Cartesian of a1vect.

Returns:

  • x (float or numpy.ndarray) – Plotting x coordinate(s).

  • y (float or numpy.ndarray) – Plotting y coordinate(s).

set(a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a1: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a2: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], E_gsf: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], box: Box | None = None, delta: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None)

Sets generalized stacking fault data.

Parameters:
  • a1vect (array-like object) – The a1 shifting vector. If box is given, a1vect is taken as a crystal lattice vector, otherwise as a Cartesian vector.

  • a2vect (array-like object) – The a2 shifting vector. If box is given, a2vect is taken as a crystal lattice vector, otherwise as a Cartesian vector.

  • a1 (array-like object) – List of fractional coordinates along a1vect corresponding to the E_gsf (and delta) values.

  • a2 (array-like object) – List of fractional coordinates along a2vect corresponding to the E_gsf (and delta) values.

  • E_gsf (array-like object) – List of generalized stacking fault energies for the positions associated with the corresponding (a1, a2) fractional coordinates.

  • box (atomman.Box, optional) – Defines unit cell box dimensions for conversion between crystal lattice and Cartesian vectors. If not given, will be set as a square unit box, thus no conversion will occur (i.e. a1vect, a2vect will be Cartesian).

  • delta (array-like object, optional) – List of change in displacements normal to the fault plane for the positions associated with the corresponding (a1, a2) fractional coordinates.

xy_to_a12(x: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], y: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a1vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, a2vect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, xvect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) Tuple[float, float] | Tuple[ndarray, ndarray]

Conversion function from plotting x, y coordinates to normalized a1, a2 coordinates.

Parameters:
  • x (array-like object) – Plotting x coordinate(s).

  • y (array-like object) – Plotting y coordinate(s).

  • a1vect (array-like object, optional) – Crystal vector for the a1 vector. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Crystal vector for the a2 vector. Default value of None uses the saved a2vect.

  • xvect (array-like object, optional) – Cartesian vector corresponding to the plotting x-axis. If None (default), this is taken as the Cartesian of a1vect.

Returns:

  • a1 (float(s)) – Fractional distance(s) along a1 vector.

  • a2 (float(s)) – Fractional distance(s) along a2 vector.

xy_to_pos(x: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], y: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], xvect: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) ndarray

Conversion function from plotting x, y coordinates to Cartesian positions.

Parameters:
  • x (array-like object) – Plotting x coordinate(s).

  • y (array-like object) – Plotting y coordinate(s).

  • xvect (array-like object, optional) – Cartesian vector corresponding to the plotting x-axis. If None (default), this is taken as the Cartesian of a1vect.

Returns:

pos – 3D Cartesian position vector(s).

Return type:

np.array