CurvilinearCoordinateSystem#
- class coordinates.core.CurvilinearCoordinateSystem(**kwargs)[source]#
Base class for general curvilinear coordinate systems.
This class provides the foundational interface for coordinate systems in which the axes may be curved or non-uniform but are not necessarily orthogonal. Unlike OrthogonalCoordinateSystem, the metric tensor for a CurvilinearCoordinateSystem may contain off-diagonal components, allowing it to support a broader range of geometries including skewed, stretched, or sheared coordinate systems.
Subclasses must define the coordinate axes and parameters using the
__AXES__
and__PARAMETERS__
class attributes, and must implement the__construct_metric_tensor_symbol__
method to return the full symbolic metric tensor (including both diagonal and off-diagonal elements).Symbolic processing is triggered either lazily upon instantiation or eagerly at import time, depending on the
__setup_point__
attribute. Most systems should default to lazy initialization ("init"
) for improved performance and reduced import time.Features#
Symbolic representation and evaluation of the full (non-diagonal) metric tensor
Placeholder for extension to general differential geometry operations (gradient, divergence, etc.)
Support for user-defined coordinate systems with custom metric behavior
Encodes system axes, parameters, and symbolic processing hooks for downstream utilities
Notes
This class provides minimal functionality on its own, as it is intended to be subclassed by users creating general curvilinear systems. Users must implement custom logic for differential geometry operations unless handled externally.
See also
OrthogonalCoordinateSystem
Specialized base class for systems with diagonal metrics.
_CoordinateSystemBase
Internal base class that defines the shared core logic.
Methods
__init__
(**kwargs)Initialize a coordinate system instance with specific parameter values.
adjust_dense_tensor_signature
(tensor_field, ...)Raise and/or lower multiple tensor slots in one call.
axes_complement
(axes)Return all axes in the coordinate system that are not present in axes.
build_axes_mask
(axes)Construct a boolean mask array indicating which axes are in
axes
.compute_expression
(expression, coordinates)Evaluate a named symbolic expression over mixed coordinate inputs.
compute_expression_from_coordinates
(...[, ...])Evaluate a named expression over 1D coordinate arrays with optional fixed axes.
compute_function_from_coordinates
(func, ...)Evaluate a function over 1D coordinate arrays with optional fixed axes.
convert_axes_to_indices
(axes)Convert axis name(s) to their corresponding index or indices.
convert_indices_to_axes
(axes_indices)Convert axis index or indices to their corresponding axis name(s).
convert_to
(target_system, *native_coords)Convert coordinates from this system to another coordinate system via Cartesian intermediate.
coordinate_meshgrid
(*coordinate_arrays[, ...])Construct a coordinate-aligned meshgrid from 1D coordinate arrays.
create_coordinate_list
(coordinate_arrays, /)Assemble a list of coordinate components (arrays or scalars) in canonical axis order.
from_cartesian
(*coords)Convert Cartesian coordinates to native coordinates in this system.
from_hdf5
(filename[, group_name, registry])Save this coordinate system to HDF5.
get_axes_from_mask
(mask)Convert a boolean axis mask into a list of axis names.
get_axes_latex
(axes)Return the LaTeX representation(s) of one or more axis names.
get_axes_order
(src_axes, dst_axes)Compute the reordering indices that will reorder src_axes into the order of dst_axes.
get_axes_permutation
(src_axes, dst_axes)Compute the permutation needed to reorder src_axes into dst_axes.
get_axes_units
(unit_system)Resolve the physical units for each axis in a given unit system.
get_canonical_axes_order
(src_axes)Compute the permutation indices to reorder src_axes into sorted alphabetical order.
Compute the permutation needed to reorder axes into the canonical order defined by the coordinate system.
get_class_expression
(expression_name)Retrieve a derived expression for this coordinate system by name.
get_conversion_transform
(other)Construct a coordinate transformation function that maps native coordinates from this coordinate system to the target coordinate system.
get_expression
(expression_name)Retrieve an instance-specific symbolic expression.
get_free_fixed
([axes, fixed_axes])Split a list of coordinate axes into fixed and free components.
get_indices_from_mask
(mask)Convert a boolean mask of length
ndim
back to numeric indices.get_mask_from_axes
(axes)Return a boolean mask of shape
(ndim,)
with True on the positions corresponding toaxes
.get_mask_from_indices
(indices)Boolean mask that is True at the supplied numeric indices.
get_numeric_expression
(expression_name)Retrieve a numerically evaluable version of a coordinate system expression given the expression name.
has_class_expression
(expression_name)Check if the coordinate system has a specific expression registered to it.
has_expression
(expression_name)Check if a symbolic expression is registered at the instance level.
in_axes_order
(iterable, src_axes, dst_axes)Reorder a sequence of values from src_axes order to dst_axes order.
in_canonical_order
(iterable, src_axes)Reorder a sequence of values from src_axes order to canonical axis order.
insert_fixed_axes
(iterable, src_axes[, ...])Insert fixed axis values into an iterable of values according to canonical axis order.
is_axes_subset
(axes_a, axes_b)Check if axes_a is a subset of axes_b.
is_axes_superset
(axes_a, axes_b)Check if axes_a is a superset of axes_b.
is_axis
(axis)Check whether the given axis name(s) exist in this coordinate system.
lambdify_expression
(expression)Convert a symbolic expression into a callable function.
List the available coordinate system expressions.
List the available instance-level expressions.
lower_index_dense
(tensor_field, index, rank, ...)Lower a single tensor index using \(g_{ab}\).
order_axes
(src_axes, dst_axes)Reorder src_axes into the order defined by dst_axes.
order_axes_canonical
(src_axes)Reorder a list of axis names into the canonical order of this coordinate system.
pprint
()Print a detailed description of the coordinate system, including its axes, parameters, and expressions.
raise_index_dense
(tensor_field, index, rank, ...)Raise a single tensor index using \(g^{ab}\).
requires_expression
(value, expression, ...)Return value if not None; otherwise evaluate compute_expression.
requires_expression_from_coordinates
(value, ...)Return value if not None; otherwise evaluate compute_expression_from_coordinates.
resolve_axes
([axes, require_subset, ...])Normalize and validate a user-supplied list of axis names.
set_expression
(expression_name, expression)Set a symbolic expression at the instance level.
substitute_expression
(expression)Replace symbolic parameters with numerical values in an expression.
to_cartesian
(*coords)Convert native coordinates to Cartesian coordinates.
to_hdf5
(filename[, group_name, overwrite])Save this coordinate system to HDF5.
Attributes
The axes names present in this coordinate system.
Return the symbolic physical dimensions associated with each axis.
The symbols representing each of the coordinate axes in this coordinate system.
Returns the callable function for the inverse metric tensor of the coordinate system.
The symbolic inverse metric tensor for this coordinate system instance.
Returns the callable function for the metric tensor of the coordinate system.
The symbolic metric tensor for this coordinate system instance.
The number of dimensions spanned by this coordinate system.
Get the symbolic representations of the coordinate system parameters.
The parameters of this coordinate system.