orbithunter.OrbitKS.transform

OrbitKS.transform(to=None, array=False, inplace=False)[source]

Transform current state to a different basis.

Parameters
tostr

One of the following: ‘field’, ‘spatial_modes’, ‘modes’. Specifies the basis which the orbit will be converted to.

arraybool

Whether to return np.ndarray or OrbitKS instance

Returns
OrbitKS :

The class instance in the new basis.

Raises
ValueError

Raised if the provided basis is unrecognizable or state is an empty array.

Notes

This method is just a wrapper for different Fourier transforms. It’s purpose is to remove the need for the user to keep track of the basis by hand. Transforms should never be used directly. For a state in the field basis, self.transform(to=’modes’) is equivalent to self._space_transform()._time_transform() If ‘to’==self.basis then self (NOT a copy) is returned. While this could cause unintentional overwrites, the user should not be transforming to a basis it is already in anyway. However, for practical purposes, remembering the basis at all times can be troublesome and so not error is raised if this is true.