def local_max_featuring(im, radius=<NUM_LIT>, noise_size=<NUM_LIT:1.>, bkg_size=None,<EOL>minmass=<NUM_LIT:1.>, trim_edge=False):
if radius <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>filtered = nd.gaussian_filter(im, noise_size, mode='<STR_LIT>')<EOL>if bkg_size is None:<EOL><INDENT>bkg_size = <NUM_LIT:2>*radius<EOL><DEDENT>filtered -= nd.gaussian_filter(filtered, bkg_size, mode='<STR_LIT>')<EOL>footprint = generate_sphere(radius)<EOL>e = nd.maximum_filter(filtered, footprint=footprint)<EOL>mass_im = nd.convolve(filtered, footprint, mode='<STR_LIT>')<EOL>good_im = (e==filtered) * (mass_im > minmass)<EOL>pos = np.transpose(np.nonzero(good_im))<EOL>if trim_edge:<EOL><INDENT>good = np.all(pos > <NUM_LIT:0>, axis=<NUM_LIT:1>) & np.all(pos+<NUM_LIT:1> < im.shape, axis=<NUM_LIT:1>)<EOL>pos = pos[good, :].copy()<EOL><DEDENT>masses = mass_im[pos[:,<NUM_LIT:0>], pos[:,<NUM_LIT:1>], pos[:,<NUM_LIT:2>]].copy()<EOL>return pos, masses<EOL>
Local max featuring to identify bright spherical particles on a
    dark background.

    Parameters
    ----------
        im : numpy.ndarray
            The image to identify particles in.
        radius : Float > 0, optional
            Featuring radius of the particles. Default is 2.5
        noise_size : Float, optional
            Size of Gaussian kernel for smoothing out noise. Default is 1.
        bkg_size : Float or None, optional
            Size of the Gaussian kernel for removing long-wavelength
            background. Default is None, which gives `2 * radius`
        minmass : Float, optional
            Return only particles with a ``mass > minmass``. Default is 1.
        trim_edge : Bool, optional
            Set to True to omit particles identified exactly at the edge
            of the image. False-positive features frequently occur here
            because of the reflected bandpass featuring. Default is
            False, i.e. find particles at the edge of the image.

    Returns
    -------
        pos, mass : numpy.ndarray
            Particle positions and masses