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
__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
:str
a name to give to the coordinate system
basis
:Any
a basis for the coordinate system
matrix
:np.ndarray | None
an 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 | None
a 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
__call__(self, coords, **opts):
pre_convert(self, system):
A hook to allow for handlign details before converting
system
:Any
:returns
:_
@property
basis(self):
:returns
:CoordinateSystem
T 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.ndarray
T 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.ndarray
m 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.ndarray
i n v
@property
dimension(self):
The dimension of the coordinate system.
None
means unspecified dimension
:returns
:int or None
d i m
converter(self, system):
Gets the converter from the current system to a new system
system
:CoordinateSystem
the target CoordinateSystem
:returns
:CoordinateSystemConverter
c o n v e r t e r
o b j e c t
convert_coords(self, coords, system, converter=None, **kw):
Converts coordiantes from the current coordinate system to system
coords
:CoordinateSet
system
:CoordinateSystem
kw
:Any
options 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
:Any
order
:Any
coordinates
:Any
finite_difference_options
:Any
:returns
:np.ndarray
d 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, **finite_difference_options):
Computes the Jacobian between the current coordinate system and a target coordinate system
system
:CoordinateSystem
the 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] | None
a spec of which coordinates to generate derivatives for (None means all)
mesh_spacing
:float | np.ndarray
the spacing to use when displacing
prep
:None | function
a function for pre-validating the generated coordinate values and grids
fd_options
:Any
options to be passed straight through to FiniteDifferenceFunction
:returns
:np.ndarray
d 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
is_compatible(self, system):
has_conversion(self, system):