numpy.radians

numpy.radians(x[, out])

Convert angles from degrees to radians.

Parameters:

x : array_like

Input array in degrees.

out : ndarray, optional

Output array of same shape as x.

Returns:

y : ndarray

The corresponding radian values.

See also

deg2rad
equivalent function

Examples

Convert a degree array to radians

>>> deg = np.arange(12.) * 30.
>>> np.radians(deg)
array([ 0.        ,  0.52359878,  1.04719755,  1.57079633,  2.0943951 ,
        2.61799388,  3.14159265,  3.66519143,  4.1887902 ,  4.71238898,
        5.23598776,  5.75958653])
>>> out = np.zeros((deg.shape))
>>> ret = np.radians(deg, out)
>>> ret is out
True

Previous topic

numpy.degrees

Next topic

numpy.unwrap

This Page