processing_library/arrays/cleaners.py
def create_scalestack(scaleshape, scales, norm=True):
    """ Create a cube consisting of the scales

    :param scaleshape: desired shape of stack
    :param scales: scales (in pixels)
    :param norm: Normalise each plane to unity?
    :return: stack
    """
    assert scaleshape[0] == len(scales)

    basis = numpy.zeros(scaleshape)
    nx = scaleshape[1]
    ny = scaleshape[2]
    xcen = int(numpy.ceil(float(nx) / 2.0))
    ycen = int(numpy.ceil(float(ny) / 2.0))
    for iscale in numpy.arange(0, len(scales)):
        halfscale = int(numpy.ceil(scales[iscale] / 2.0))
        if scales[iscale] > 0.0:
            rscale2 = 1.0 / (float(scales[iscale]) / 2.0) ** 2
            x = range(xcen - halfscale - 1, xcen + halfscale + 1)
            # Unroll this since spheroidal_function needs a scalar
            for y in range(ycen - halfscale - 1, ycen + halfscale + 1):
                for x in range(xcen - halfscale - 1, xcen + halfscale + 1):
                    fx = float(x - xcen)
                    fy = float(y - ycen)
                    r2 = rscale2 * (fx * fx + fy * fy)
                    r = numpy.sqrt(r2)
                    basis[iscale, x, y] = spheroidal_function(r) * (1.0 - r ** 2)
            basis[basis < 0.0] = 0.0
            if norm:
                basis[iscale, :, :] /= numpy.sum(basis[iscale, :, :])
        else:
            basis[iscale, xcen, ycen] = 1.0
    return basis
 Create a cube consisting of the scales

    :param scaleshape: desired shape of stack
    :param scales: scales (in pixels)
    :param norm: Normalise each plane to unity?
    :return: stack
    
Create a cube consisting of the scales
Create a cube consisting of the scales
def create_scalestack(scaleshape, scales, norm=True):
    assert scaleshape[0] == len(scales)
    basis = numpy.zeros(scaleshape)
    nx = scaleshape[1]
    ny = scaleshape[2]
    xcen = int(numpy.ceil(float(nx) / 2.0))
    ycen = int(numpy.ceil(float(ny) / 2.0))
    for iscale in numpy.arange(0, len(scales)):
        halfscale = int(numpy.ceil(scales[iscale] / 2.0))
        if scales[iscale] > 0.0:
            rscale2 = 1.0 / (float(scales[iscale]) / 2.0) ** 2
            x = range(xcen - halfscale - 1, xcen + halfscale + 1)
            for y in range(ycen - halfscale - 1, ycen + halfscale + 1):
                for x in range(xcen - halfscale - 1, xcen + halfscale + 1):
                    fx = float(x - xcen)
                    fy = float(y - ycen)
                    r2 = rscale2 * (fx * fx + fy * fy)
                    r = numpy.sqrt(r2)
                    basis[iscale, x, y] = spheroidal_function(r) * (1.0 - r ** 2)
            basis[basis < 0.0] = 0.0
            if norm:
                basis[iscale, :, :] /= numpy.sum(basis[iscale, :, :])
        else:
            basis[iscale, xcen, ycen] = 1.0
    return basis
def create_scalestack ( scaleshape , scales , norm = True ) : assert scaleshape [ 0 ] == len ( scales ) basis = numpy . zeros ( scaleshape ) nx = scaleshape [ 1 ] ny = scaleshape [ 2 ] xcen = int ( numpy . ceil ( float ( nx ) / 2.0 ) ) ycen = int ( numpy . ceil ( float ( ny ) / 2.0 ) ) for iscale in numpy . arange ( 0 , len ( scales ) ) : halfscale = int ( numpy . ceil ( scales [ iscale ] / 2.0 ) ) if scales [ iscale ] > 0.0 : rscale2 = 1.0 / ( float ( scales [ iscale ] ) / 2.0 ) ** 2 x = range ( xcen - halfscale - 1 , xcen + halfscale + 1 ) for y in range ( ycen - halfscale - 1 , ycen + halfscale + 1 ) : for x in range ( xcen - halfscale - 1 , xcen + halfscale + 1 ) : fx = float ( x - xcen ) fy = float ( y - ycen ) r2 = rscale2 * ( fx * fx + fy * fy ) r = numpy . sqrt ( r2 ) basis [ iscale , x , y ] = spheroidal_function ( r ) * ( 1.0 - r ** 2 ) basis [ basis < 0.0 ] = 0.0 if norm : basis [ iscale , : , : ] /= numpy . sum ( basis [ iscale , : , : ] ) else : basis [ iscale , xcen , ycen ] = 1.0 return basis
Create a cube consisting of the scales
Create a cube consisting of the scales
""" Create a cube consisting of the scales

    :param scaleshape: desired shape of stack
    :param scales: scales (in pixels)
    :param norm: Normalise each plane to unity?
    :return: stack
    """ # Unroll this since spheroidal_function needs a scalar
None
scaleshape
desired shape of stack
desired shape of stack
scales
scales (in pixels)
scales ( in pixels )
norm
None