Fix sqrt_space docstring formatting
@@ -179,7 +179,9 @@ class NDDataArray:
def sqrt_space(start, stop, num):
"""Return numbers spaced evenly on a square root scale.
+
This function is similar to `numpy.linspace` and `numpy.logspace`.
+
Parameters
----------
start : float
@@ -188,16 +190,16 @@ def sqrt_space(start, stop, num):
stop is the final value of the sequence
num : int
Number of samples to generate.
+
Returns
-------
samples : `~numpy.ndarray`
1D array with a square root scale
+
Examples
--------
>>> from gammapy.utils.nddata import sqrt_space
>>> samples = sqrt_space(0, 2, 5)
array([ 0. , 1. , 1.41421356, 1.73205081, 2. ])
"""
- samples2 = np.linspace(start ** 2, stop ** 2, num)
- samples = np.sqrt(samples2)
- return samples
\ No newline at end of file
+ return np.sqrt(np.linspace(start ** 2, stop ** 2, num))
