tmdsimpy.utils.harmonic.rotate_subtract_phase

tmdsimpy.utils.harmonic.rotate_subtract_phase(U_orig, Ndof, h, phase_angle, h_rotate)

Rotates a set of harmonic solutions through a phase defined at a given harmonic.

Parameters:
U_orig(M, Nhc*Ndof+a) or (Nhc*Ndof+a,) numpy.ndarray

This is a set of harmonic solutions where rows are independent solutions and each row contains Nhc sets of Ndof coordinates corresponding to solution displacements. The rows contain all of the first harmonic, then all of the second harmonic etc. as given by the harmonics in h. Each harmonic greater than 0 has all cosine terms then all sine terms. The last a columns of U_orig can be anything, are ignored and returned as provided.

Ndofint

Number of degrees of freedom defining the size of U_orig as above.

hnumpy.ndarray, sorted

Array of the harmonics used in U_orig.

phase_rotatefloat or (M,) numpy.ndarray

Phase to rotate the solution U_orig through. See Notes for description of sign. This rotation is applied to the harmonic h_rotate which other harmonics shifted by a consistent amount of time. If this is an array, then each row of U_orig is shifted by a different phase as given by the equivalent entry in this array.

h_rotateint

The harmonic that should be rotated by phase_angle.

Returns:
U_rot(M, Nhc*Ndof+a) or (1, Nhc*Ndof+a) numpy.ndarray

U_orig with the applied phase rotation. The last a columns are directly copied from U_orig.

Notes

The number of harmonic components is Nhc = tmdsimpy.utils.harmonic.Nhc(h)

The phase angle is subtracted so if the input is Uc * cos(Omega * t) the output is Uc*cos(Omega * t - phase_angle) for h_rotate==1.

The harmonic h_rotate is rotated by the phase angle and ther harmonics are consistently rotated based on some time shift t0 so that Uc*cos(h_rotate*Omega*(t-t0)) = Uc*cos(h_rotate*Omega - phase_angle).