Overview
Thecoordinates module provides coordinate system definitions and transformations for spectral simulations. It includes Cartesian, spherical, polar, and S2 coordinate systems with support for curvilinear coordinates and vector transformations.
Coordinate Systems
Coordinate
Parameters
- name (str): Name of the coordinate
- cs (CoordinateSystem, optional): Parent coordinate system
Attributes
- dim (int): Dimension (always 1 for Coordinate)
- curvilinear (bool): Whether coordinate is curvilinear (default: False)
- coords (tuple): Tuple containing self
Example
CartesianCoordinates
Parameters
- names (str): Names for each coordinate axis
- right_handed (bool, optional): Whether 3D system is right-handed (default: True)
Attributes
- dim (int): Number of dimensions
- coords (tuple): Tuple of Coordinate objects
- curvilinear (bool): Always False for Cartesian
Example
SphericalCoordinates
Parameters
- azimuth (str): Name of azimuthal coordinate (φ)
- colatitude (str): Name of colatitude coordinate (θ)
- radius (str): Name of radial coordinate (r)
Attributes
- dim (int): Always 3
- curvilinear (bool): Always True
- spin_ordering (tuple): Component ordering (-1, +1, 0)
- right_handed (bool): Always False
Methods
cartesian(phi, theta, r) - Convert to Cartesian coordinatesExample
S2Coordinates
Parameters
- azimuth (str): Name of azimuthal coordinate
- colatitude (str): Name of colatitude coordinate
Attributes
- dim (int): Always 2
- curvilinear (bool): Always True
- spin_ordering (tuple): Component ordering (-1, +1)
Example
PolarCoordinates
Parameters
- azimuth (str): Name of azimuthal coordinate
- radius (str): Name of radial coordinate
Attributes
- dim (int): Always 2
- curvilinear (bool): Always True
- spin_ordering (tuple): Component ordering (-1, +1)
Methods
cartesian(phi, r) - Convert to Cartesian coordinatesExample
DirectProduct
Parameters
- coordsystems: Coordinate system objects to combine
- right_handed (bool, optional): For 3D systems, whether right-handed
Attributes
- dim (int): Sum of component system dimensions
- coords (tuple): Flattened tuple of all coordinates
- coordsystems (tuple): Component coordinate systems