ptyrad.optics.aberrations#

Aberrations class for aberration coefficients parsing and conversion

Classes

AberrationValue(nm, mag, angle)

Intermediate storage for export.

Aberrations([data])

Handles probe aberrations with support for Krivanek/Haider notations.

ParsedKey(nm, param, scale)

The resolved address and context for a user key.

class ptyrad.optics.aberrations.ParsedKey(nm, param, scale)[source]#

Bases: object

The resolved address and context for a user key.

Parameters:
  • nm (Tuple[int, int])

  • param (Literal['magnitude', 'angle', 'a', 'b'])

  • scale (float)

nm: Tuple[int, int]#
param: Literal['magnitude', 'angle', 'a', 'b']#
scale: float#
class ptyrad.optics.aberrations.AberrationValue(nm, mag, angle)[source]#

Bases: object

Intermediate storage for export.

Parameters:
  • nm (Tuple[int, int])

  • mag (float)

  • angle (float)

nm: Tuple[int, int]#
mag: float#
angle: float#
class ptyrad.optics.aberrations.Aberrations(data=None)[source]#

Bases: object

Handles probe aberrations with support for Krivanek/Haider notations. Internal state is always Polar Krivanek (Magnitude [Å], Angle [deg]).

Note that for round lens aberrations (m=0), the internal storage is always (mag, 0.0) for type uniformity. However, setting or getting “components” from these round lens aberrations is strictly forbidden for users. For example, ‘phi30’, ‘C10a’ are not allowed.

Parameters:

data (Optional[Dict])

get_coefficients(style='cartesian')[source]#

Get raw coefficients for computation (nested dictionary).

Parameters:

style (Literal['polar', 'cartesian', 'complex'])

Return type:

Dict[Tuple[int, int], Any]

get_haider(decimals=3)[source]#

Get flattened dictionary in Haider notation.

Return type:

Dict[str, float]

get_krivanek_polar(decimals=3)[source]#

Export Krivanek Polar (Flat dictionary).

Return type:

Dict[str, float]

get_krivanek_cartesian(decimals=3)[source]#

Export Krivanek Cartesian (Flat dictionary).

Return type:

Dict[str, float]

export(notation='krivanek', style='polar', layout='flat', round_decimals=3)[source]#
Parameters:
  • notation (Literal['krivanek', 'haider'])

  • style (Literal['polar', 'cartesian', 'complex'])

  • layout (Literal['flat', 'nested'])

  • round_decimals (int | None)

Return type:

Dict

pretty_print()[source]#

Generate a formatted table of current aberrations.

Return type:

str