yt.utilities.math_utils.
modify_reference_frame
(CoM, L, P=None, V=None)[source]¶Rotates and translates data into a new reference frame to make calculations easier.
This is primarily useful for calculations of halo data. The data is translated into the center of mass frame. Next, it is rotated such that the angular momentum vector for the data is aligned with the z-axis. Put another way, if one calculates the angular momentum vector on the data that comes out of this function, it will always be along the positive z-axis. If the center of mass is re-calculated, it will be at the origin.
Parameters: | CoM : array
L : array
|
---|---|
Returns: | L : array
P : array
V : array
|
Examples
>>> CoM = np.array([0.5, 0.5, 0.5])
>>> L = np.array([1, 0, 0])
>>> P = np.array([[1, 0.5, 0.5], [0, 0.5, 0.5], [0.5, 0.5, 0.5], [0, 0, 0]])
>>> V = p.copy()
>>> LL, PP, VV = modify_reference_frame(CoM, L, P, V)
>>> LL
array([ 6.12323400e-17, 0.00000000e+00, 1.00000000e+00])
>>> PP
array([[ 3.06161700e-17, 0.00000000e+00, 5.00000000e-01],
[ -3.06161700e-17, 0.00000000e+00, -5.00000000e-01],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[ 5.00000000e-01, -5.00000000e-01, -5.00000000e-01]])
>>> VV
array([[ -5.00000000e-01, 5.00000000e-01, 1.00000000e+00],
[ -5.00000000e-01, 5.00000000e-01, 3.06161700e-17],
[ -5.00000000e-01, 5.00000000e-01, 5.00000000e-01],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]])