processing_library/arrays/cleaners.py
def find_global_optimum(hsmmpsf, ihsmmpsf, smresidual, windowstack, findpeak):
    """Find the optimum peak using one of a number of algorithms

    """
    if findpeak == 'Algorithm1':
        # Calculate the principal solution in moment-moment axes. This decouples the moments
        smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
        # Now find the location and scale
        mx, my, mscale = find_optimum_scale_zero_moment(smpsol, windowstack)
        mval = smpsol[mscale, :, mx, my]
    elif findpeak == 'CASA':
        # CASA 4.7 version
        smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
        #        smpsol = calculate_scale_moment_approximate_principal_solution(smresidual, hsmmpsf)
        nscales, nmoment, nx, ny = smpsol.shape  # pylint: disable=no-member
        dchisq = numpy.zeros([nscales, 1, nx, ny])
        for scale in range(nscales):
            for moment1 in range(nmoment):
                dchisq[scale, 0, ...] += 2.0 * smpsol[scale, moment1, ...] * smresidual[scale, moment1, ...]
                for moment2 in range(nmoment):
                    dchisq[scale, 0, ...] -= hsmmpsf[scale, moment1, moment2] * \
                        smpsol[scale, moment1, ...] * smpsol[scale, moment2, ...]

        mx, my, mscale = find_optimum_scale_zero_moment(dchisq, windowstack)
        mval = smpsol[mscale, :, mx, my]

    else:
        smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
        mx, my, mscale = find_optimum_scale_zero_moment(smpsol * smresidual, windowstack)

        mval = smpsol[mscale, :, mx, my]

    return mscale, mx, my, mval
Find the optimum peak using one of a number of algorithms

    
Find the optimum peak using one of a number of algorithms
Find the optimum peak using one of a number of algorithms
def find_global_optimum(hsmmpsf, ihsmmpsf, smresidual, windowstack, findpeak):
    if findpeak == 'Algorithm1':
        smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
        mx, my, mscale = find_optimum_scale_zero_moment(smpsol, windowstack)
        mval = smpsol[mscale, :, mx, my]
    elif findpeak == 'CASA':
        smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
        nscales, nmoment, nx, ny = smpsol.shape  
        dchisq = numpy.zeros([nscales, 1, nx, ny])
        for scale in range(nscales):
            for moment1 in range(nmoment):
                dchisq[scale, 0, ...] += 2.0 * smpsol[scale, moment1, ...] * smresidual[scale, moment1, ...]
                for moment2 in range(nmoment):
                    dchisq[scale, 0, ...] -= hsmmpsf[scale, moment1, moment2] * \
                        smpsol[scale, moment1, ...] * smpsol[scale, moment2, ...]
        mx, my, mscale = find_optimum_scale_zero_moment(dchisq, windowstack)
        mval = smpsol[mscale, :, mx, my]
    else:
        smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
        mx, my, mscale = find_optimum_scale_zero_moment(smpsol * smresidual, windowstack)
        mval = smpsol[mscale, :, mx, my]
    return mscale, mx, my, mval
def find_global_optimum ( hsmmpsf , ihsmmpsf , smresidual , windowstack , findpeak ) : if findpeak == 'Algorithm1' : smpsol = calculate_scale_moment_principal_solution ( smresidual , ihsmmpsf ) mx , my , mscale = find_optimum_scale_zero_moment ( smpsol , windowstack ) mval = smpsol [ mscale , : , mx , my ] elif findpeak == 'CASA' : smpsol = calculate_scale_moment_principal_solution ( smresidual , ihsmmpsf ) nscales , nmoment , nx , ny = smpsol . shape dchisq = numpy . zeros ( [ nscales , 1 , nx , ny ] ) for scale in range ( nscales ) : for moment1 in range ( nmoment ) : dchisq [ scale , 0 , ... ] += 2.0 * smpsol [ scale , moment1 , ... ] * smresidual [ scale , moment1 , ... ] for moment2 in range ( nmoment ) : dchisq [ scale , 0 , ... ] -= hsmmpsf [ scale , moment1 , moment2 ] * smpsol [ scale , moment1 , ... ] * smpsol [ scale , moment2 , ... ] mx , my , mscale = find_optimum_scale_zero_moment ( dchisq , windowstack ) mval = smpsol [ mscale , : , mx , my ] else : smpsol = calculate_scale_moment_principal_solution ( smresidual , ihsmmpsf ) mx , my , mscale = find_optimum_scale_zero_moment ( smpsol * smresidual , windowstack ) mval = smpsol [ mscale , : , mx , my ] return mscale , mx , my , mval
Find the optimum peak using one of a number of algorithms
Find the optimum peak using one of a number of algorithms
"""Find the optimum peak using one of a number of algorithms

    """ # Calculate the principal solution in moment-moment axes. This decouples the moments # Now find the location and scale # CASA 4.7 version #        smpsol = calculate_scale_moment_approximate_principal_solution(smresidual, hsmmpsf) # pylint: disable=no-member
hsmmpsf
ihsmmpsf
smresidual
windowstack
findpeak