(image, radius)
return win_std
Calculates the standard deviation of an image, using a moving window of 
    specified radius. Uses astropy's convolution library'
    
    Arguments:
    -----------
    image: np.array
        2D array containing the pixel intensities of a single-band image
    radius: int
        radius defining the moving window used to calculate the standard deviation. 
        For example, radius = 1 will produce a 3x3 moving window.
        
    Returns:    
    -----------
    win_std: np.array
        2D array containing the standard deviation of the image
Calculates the standard deviation of an image, using a moving window of 
    specified radius. Uses astropy's convolution library'
    
    Arguments:
    -----------
    image: np.array
        2D array containing the pixel intensities of a single-band image
    radius: int
        radius defining the moving window used to calculate the standard deviation. 
        For example, radius = 1 will produce a 3x3 moving window.
        
    Returns:    
    -----------
    win_std: np.array
        2D array containing the standard deviation of the image
Calculates the standard deviation of an image using a moving window of specified radius . Uses astropy s convolution library Arguments : ----------- image : np . array 2D array containing the pixel intensities of a single - band image radius : int radius defining the moving window used to calculate the standard deviation . For example radius = 1 will produce a 3x3 moving window . Returns : ----------- win_std : np . array 2D array containing the standard deviation of the image
def image_std(image, radius):
    """
    Calculates the standard deviation of an image, using a moving window of 
    specified radius. Uses astropy's convolution library'
    
    Arguments:
    -----------
    image: np.array
        2D array containing the pixel intensities of a single-band image
    radius: int
        radius defining the moving window used to calculate the standard deviation. 
        For example, radius = 1 will produce a 3x3 moving window.
        
    Returns:    
    -----------
    win_std: np.array
        2D array containing the standard deviation of the image
        
    """  
    
    # convert to float
    image = image.astype(float)
    # first pad the image
    image_padded = np.pad(image, radius, 'reflect')
    # window size
    win_rows, win_cols = radius*2 + 1, radius*2 + 1
    # calculate std with uniform filters
    win_mean = convolve(image_padded, np.ones((win_rows,win_cols)), boundary='extend',
                        normalize_kernel=True, nan_treatment='interpolate', preserve_nan=True)
    win_sqr_mean = convolve(image_padded**2, np.ones((win_rows,win_cols)), boundary='extend',
                        normalize_kernel=True, nan_treatment='interpolate', preserve_nan=True)
    win_var = win_sqr_mean - win_mean**2
    win_std = np.sqrt(win_var)
    # remove padding
    win_std = win_std[radius:-radius, radius:-radius]

    return win_std
def image_std ( image , radius ) : # convert to float image = image . astype ( float ) # first pad the image image_padded = np . pad ( image , radius , 'reflect' ) # window size win_rows , win_cols = radius * 2 + 1 , radius * 2 + 1 # calculate std with uniform filters win_mean = convolve ( image_padded , np . ones ( ( win_rows , win_cols ) ) , boundary = 'extend' , normalize_kernel = True , nan_treatment = 'interpolate' , preserve_nan = True ) win_sqr_mean = convolve ( image_padded ** 2 , np . ones ( ( win_rows , win_cols ) ) , boundary = 'extend' , normalize_kernel = True , nan_treatment = 'interpolate' , preserve_nan = True ) win_var = win_sqr_mean - win_mean ** 2 win_std = np . sqrt ( win_var ) # remove padding win_std = win_std [ radius : - radius , radius : - radius ] return win_std