convert_cosine_to_angles#

atompy.convert_cosine_to_angles(cos_angles, y_data, full_range=False)[source]#

Convert data given as a cosine to radians.

Parameters:
cos_anglesarray_like

cosines of angles, within [-1, 1]

y_dataarray_like

the corresponding y-data

full_rangebool

The range of the output data - True: 0 .. 2*pi (pi .. 2*pi will be mirrored) - False: 0 .. pi

Returns:
anglesndarray
y_datandarray

Examples

>>> import numpy as np
>>> import atompy as ap
>>> x, y = np.linspace(-1, 1, 5), np.linspace(0, 4, 5)
>>> x, y
(array([-1. , -0.5,  0. ,  0.5,  1. ]), array([0., 1., 2., 3., 4.]))
>>> ap.convert_cosine_to_angles(x, y)
(array([0., 1.04, 1.57, 2.09, 3.14]), array([4., 3., 2., 1., 0.]))
>>> ap.convert_cosine_to_angles(x, y, full_range=True)
(array([0., 1.04, 1.57, 2.09, 3.14, 3.14, 4.18, 4.71, 5.23, 6.28]),
 array([4., 3., 2., 1., 0., 0., 1., 2., 3., 4.]))