<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_sigma(x, min_limit=-np.inf, max_limit=np.inf):
 """Compute the standard deviations around the points for a 1D GMM. We take the distance from the nearest left and right neighbors for each point, then use the max as the estimate of standard deviation for the gaussian mixture around that point. Arguments --------- x : 1D array Set of points to create the GMM min_limit : Optional[float], default : -inf Minimum limit for the distribution max_limit : Optional[float], default : inf maximum limit for the distribution Returns ------- 1D array Array of standard deviations """


    z = np.append(x, [min_limit, max_limit])
    sigma = np.ones(x.shape)
    for i in range(x.size):
        # Calculate the nearest left neighbor of x[i]
        # Find the minimum of (x[i] - k) for k < x[i]
        xleft = z[np.argmin([(x[i] - k) if k < x[i] else np.inf for k in z])]

        # Calculate the nearest right neighbor of x[i]
        # Find the minimum of (k - x[i]) for k > x[i]
        xright = z[np.argmin([(k - x[i]) if k > x[i] else np.inf for k in z])]

        sigma[i] = max(x[i] - xleft, xright - x[i])
        if sigma[i] == np.inf:
            sigma[i] = min(x[i] - xleft, xright - x[i])
        if (sigma[i] == -np.inf):  # should never happen
            sigma[i] = 1.0
    return sigma