CoordinateSystem
A representation of a coordinate system. It doesn’t do much on its own but it does provide a way to unify internal, cartesian, derived type coordinates
return_derivs_key: str
deriv_key: str
__init__(self, name=None, basis=None, matrix=None, inverse=None, dimension=None, origin=None, coordinate_shape=None, jacobian_prep=None, converter_options=None, **extra):
Sets up the CoordinateSystem object
name:stra name to give to the coordinate system
basis:Anya basis for the coordinate system
matrix:np.ndarray | Nonean expansion coefficient matrix for the set of coordinates in its basis
dimension:Iterable[None | int]the dimension of a single configuration in the coordinate system (for validation)
jacobian_prep:function | Nonea function for preparing coordinates to be used in computing the Jacobian
coordinate_shape:iterable[int]the actual shape of a single coordinate in the coordinate system
to_state(self, serializer=None):
@classmethod
from_state(cls, data, serializer=None):
__call__(self, coords, **opts):
pre_convert(self, system):
[DEPRECATED, see pre_convert_to and pre_convert_from]
A hook to allow for handlign details before converting
system:Any:returns:_
pre_convert_to(self, system, opts=None):
pre_convert_from(self, system, opts=None):
@property
basis(self):
:returns:CoordinateSystemT h e
b a s i s
f o r
t h e
r e p r e s e n t a t i o n
o f
` m a t r i x `
@property
origin(self):
:returns:np.ndarrayT h e
o r i g i n
f o r
t h e
e x p a n s i o n
d e f i n e d
b y
` m a t r i x `
@property
matrix(self):
The matrix representation in the CoordinateSystem.basis
None is shorthand for the identity matrix
:returns:np.ndarraym a t
@property
inverse(self):
The inverse of the representation in the basis.
None is shorthand for the inverse or pseudoinverse of matrix.
:returns:np.ndarrayi n v
@property
dimension(self):
The dimension of the coordinate system.
None means unspecified dimension
:returns:int or Noned i m
register_converter(self, system, conversion):
get_direct_converter(self, target):
get_inverse_converter(self, target):
converter(self, system):
Gets the converter from the current system to a new system
system:CoordinateSystemthe target CoordinateSystem
:returns:CoordinateSystemConverterc o n v e r t e r
o b j e c t
convert_coords(self, coords, system, converter=None, apply_pre_converter=False, **kw):
Converts coordiantes from the current coordinate system to system
coords:CoordinateSetsystem:CoordinateSystemkw:Anyoptions to be passed through to the converter object
:returns:tuple(np.ndarray, dict)t h e
c o n v e r t e d
c o o r d i a n t e s
rescale(self, scaling, in_place=False):
rotate(self, rot, in_place=False):
displacement(self, amts):
Generates a displacement or matrix of displacements based on the vector or matrix amts The relevance of this method has become somewhat unclear…
amts:np.ndarray:returns:np.ndarray
derivatives(self, coords, function, order=1, coordinates=None, result_shape=None, **finite_difference_options):
Computes derivatives for an arbitrary function with respect to this coordinate system.
Basically a more flexible version of jacobian.
function:Anyorder:Anycoordinates:Anyfinite_difference_options:Any:returns:np.ndarrayd e r i v a t i v e
t e n s o r
jacobian(self, coords, system, order=1, coordinates=None, converter_options=None, all_numerical=False, analytic_deriv_order=None, allow_fd=True, **finite_difference_options):
Computes the Jacobian between the current coordinate system and a target coordinate system
system:CoordinateSystemthe target CoordinateSystem
order:int | Iterable[int]the order of the Jacobian to compute, 1 for a standard, 2 for the Hessian, etc.
coordinates:None | iterable[iterable[int] | Nonea spec of which coordinates to generate derivatives for (None means all)
mesh_spacing:float | np.ndarraythe spacing to use when displacing
prep:None | functiona function for pre-validating the generated coordinate values and grids
fd_options:Anyoptions to be passed straight through to FiniteDifferenceFunction
:returns:np.ndarrayd e r i v a t i v e
t e n s o r
__repr__(self):
Provides a clean representation of a CoordinateSystem for printing
:returns:str
@classmethod
is_compatible(cls, self, system):
has_conversion(self, system):