ezmsg.sigproc.coordinatespaces#
Coordinate space transformations for streaming data.
This module provides utilities and ezmsg nodes for transforming between Cartesian (x, y) and polar (r, theta) coordinate systems.
Note
This module supports the Array API standard, enabling use with NumPy, CuPy, PyTorch, and other compatible array libraries.
Functions
- cart2pol(x, y)[source]#
Convert Cartesian coordinates (x, y) to polar coordinates (r, theta).
- Parameters:
x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- cart2z(x, y)[source]#
Convert Cartesian coordinates to complex number representation.
- Parameters:
x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]
- pol2cart(r, theta)[source]#
Convert polar coordinates (r, theta) to Cartesian coordinates (x, y).
- Parameters:
r (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
theta (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- polar2z(r, theta)[source]#
Convert polar coordinates to complex number representation.
- Parameters:
r (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
theta (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]
- z2cart(z)[source]#
Convert complex number to Cartesian coordinates (x, y).
- Parameters:
z (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- z2polar(z)[source]#
Convert complex number to polar coordinates (r, theta).
- Parameters:
z (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
Classes
- class CoordinateMode(*values)[source]#
-
Transformation mode for coordinate conversion.
- CART2POL = 'cart2pol'#
Convert Cartesian (x, y) to polar (r, theta).
- POL2CART = 'pol2cart'#
Convert polar (r, theta) to Cartesian (x, y).
- class CoordinateSpaces(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[CoordinateSpacesSettings,AxisArray,AxisArray,CoordinateSpacesTransformer]Unit for transforming between Cartesian and polar coordinate systems.
See
CoordinateSpacesSettingsfor configuration options.- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
CoordinateSpacesSettings
- class CoordinateSpacesSettings(mode=CoordinateMode.CART2POL, axis=None)[source]#
Bases:
SettingsSettings for
CoordinateSpaces.See
coordinate_spacesfor argument details.- Parameters:
mode (CoordinateMode)
axis (str | None)
- mode: CoordinateMode = 'cart2pol'#
‘cart2pol’ or ‘pol2cart’.
- Type:
The transformation mode
- axis: str | None = None#
The name of the axis containing the coordinate components. Defaults to the last axis. Must have exactly 2 elements (x,y or r,theta).
- __init__(mode=CoordinateMode.CART2POL, axis=None)#
- Parameters:
mode (CoordinateMode)
axis (str | None)
- Return type:
None
- class CoordinateSpacesTransformer(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformer[CoordinateSpacesSettings,AxisArray,AxisArray]Transform between Cartesian and polar coordinate systems.
The input must have exactly 2 elements along the specified axis: - For cart2pol: expects (x, y), outputs (r, theta) - For pol2cart: expects (r, theta), outputs (x, y)
- Parameters:
settings (SettingsType)
- polar2z(r, theta)[source]#
Convert polar coordinates to complex number representation.
- Parameters:
r (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
theta (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]
- z2polar(z)[source]#
Convert complex number to polar coordinates (r, theta).
- Parameters:
z (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- cart2z(x, y)[source]#
Convert Cartesian coordinates to complex number representation.
- Parameters:
x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]
- z2cart(z)[source]#
Convert complex number to Cartesian coordinates (x, y).
- Parameters:
z (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- cart2pol(x, y)[source]#
Convert Cartesian coordinates (x, y) to polar coordinates (r, theta).
- Parameters:
x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- pol2cart(r, theta)[source]#
Convert polar coordinates (r, theta) to Cartesian coordinates (x, y).
- Parameters:
r (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
theta (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
- Return type:
Tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]
- class CoordinateMode(*values)[source]#
-
Transformation mode for coordinate conversion.
- CART2POL = 'cart2pol'#
Convert Cartesian (x, y) to polar (r, theta).
- POL2CART = 'pol2cart'#
Convert polar (r, theta) to Cartesian (x, y).
- class CoordinateSpacesSettings(mode=CoordinateMode.CART2POL, axis=None)[source]#
Bases:
SettingsSettings for
CoordinateSpaces.See
coordinate_spacesfor argument details.- Parameters:
mode (CoordinateMode)
axis (str | None)
- mode: CoordinateMode = 'cart2pol'#
‘cart2pol’ or ‘pol2cart’.
- Type:
The transformation mode
- axis: str | None = None#
The name of the axis containing the coordinate components. Defaults to the last axis. Must have exactly 2 elements (x,y or r,theta).
- __init__(mode=CoordinateMode.CART2POL, axis=None)#
- Parameters:
mode (CoordinateMode)
axis (str | None)
- Return type:
None
- class CoordinateSpacesTransformer(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformer[CoordinateSpacesSettings,AxisArray,AxisArray]Transform between Cartesian and polar coordinate systems.
The input must have exactly 2 elements along the specified axis: - For cart2pol: expects (x, y), outputs (r, theta) - For pol2cart: expects (r, theta), outputs (x, y)
- Parameters:
settings (SettingsType)
- class CoordinateSpaces(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[CoordinateSpacesSettings,AxisArray,AxisArray,CoordinateSpacesTransformer]Unit for transforming between Cartesian and polar coordinate systems.
See
CoordinateSpacesSettingsfor configuration options.- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
CoordinateSpacesSettings